[1.8.6.1] extra_rc.hpp (Possible to add: if (_playerID == "") then {)

KrisiS

Member
Is it possible to make an option in the extra_rc.hpp only available to a player that has their PlayerID approved?

Similar to a Loadout in the server_playerLogin.sqf


Thank you for any help

:)
 
the hpp files are class defintions and I dont think they are able to have any conditional statements.
But in the file that loads that class definition you should be able to place your condition. What exactly do you want to do?
post your work in progress ...
 
I konw what I have here is WAY off the mark, but it might give you an idea of what I was thinking of achieving.
It's really not very important for me to get this type of thing working, but I thought it might come in useful for my server somewhere down the line...


I was thinking something of the following:




ExtraRc.hpp

Code:
if (_playerID == "") then {
_playerID = getPlayerUID _playerObj;};
_group1 = ["00000000000000000","11111111111111111"];


class ExtraRc {
    class ItemToolbox {
        class BuildBike  {
            text = "Deploy Bike";
            script = "['Old_bike_TK_INS_EP1'] execVM 'Scripts\EVD\EVD_deploy.sqf'";
        };
            if ((_playerID) in _group1) then {
            class BuildMotorcycle {
            text = "Deploy Motorcycle";
            script = "['TT650_Ins'] execVM 'Scripts\EVD\EVD_deploy.sqf'";
        };
    };
    class bloodBagONEG {
        class Use {
            text = "Use Bloodbag";
            script = "execVM 'Scripts\SelfBB.sqf'";
        };
    };
    class glock17_EP1 {
        class CommitSuicide {
            text = "Commit Suicide";
            script = "execVM ""Scripts\suicide.sqf"";";
        };
    };

etc......
etc......
etc......


Oh, and I also almost forgot to say hello to you old friend. Your expertise has helped me soooo much in the past,, you're a gent!! Thanks again
 
Oh, and I also almost forgot to say hello to you old friend. Your expertise has helped me soooo much in the past,, you're a gent!! Thanks again
Your always welcome and Thanks for the appreciation.

On to the issue:
The extra_rc.hpp file holds he class definitions for each itme you can right click on, for example
Code:
//EXTRA_RC.HPP
class ItemMachete {
        //Clear Brush
        class ClearGrass {
            text = "Clear Grass";
            script = "[] execVM ""scripts\crafting\clearbrush.sqf"";";
        };
    };

I dont have a working dayz server at the moment so havent tested any of this but ... with a bit of debugging it should work.
And the script that adds these 'right-clicks' is us_selectslot.sqf. Down on line 57 this code parses the extra_rc.hpp file and adds in the actions. THIS is where you can use that IF block for the players. The erc_cfgActions is an array with all the classes that are contained in extra_rc.hpp (I think). It loops through each one and adds the uiControl with that text and the script to run when you click on the control. So like the machete example:
Below the _text would be "Clear Grass" and the _script would be clearbrush.sqf and they are added to the player.
So, theoretically, you should be able to test the player UID and if he is allowed to "Clear Grass" you continue the rest of the loop, if he isnt allowed to Clear Grass then you skip to the end of the loop and continue with the next item.
Code:
//UI_SELECTSLOT.SQF
// Add extra context menus
    _erc_cfgActions = (missionConfigFile >> "ExtraRc" >> _item);
    _erc_numActions = (count _erc_cfgActions);
    if (isClass _erc_cfgActions) then {
        for "_j" from 0 to (_erc_numActions - 1) do
        {
            _menu =     _parent displayCtrl (1600 + _j + _numActions);
            _menu ctrlShow true;
            _config =     (_erc_cfgActions select _j);
            _text =     getText    (_config >> "text");
//-----------------COMPARE PLAYER UID WITH ALLOWED ACTION HERE ----------
//if Player is allowed {
            _script =     getText    (_config >> "script");
            _height = _height + (0.025 * safezoneH);
            uiNamespace setVariable ['uiControl', _control];
            _menu ctrlSetText _text;
            _menu ctrlSetEventHandler ["ButtonClick",_script];
//}:----closing bracket of if statement
        };
    };

The easiest way to check the players allowed events would be to assign a variable to each player with what they are allowed to use.
When player joins, do this ... player setvariable["cleargrass" true];
Then in ui_selectslot.sqf you check that variable:
_allowed = player getvariable["cleargrass", true/false]; <--set the default to true or false
 
Last edited:
Awesome man, thank you for the help. It will take me a little while to work through this and see what I can come up with. Do you have any idea where the cfgActions is located ?
 
if you mean THESE cfgactions its _erc_cfgActions is an array retrieved from the ExtraRC file.
GmbJoKv.png


if you mean this cfgaction .. https://github.com/DayZMod/DayZ/search?utf8=✓&q=cfgactions

well there you go, but as a class in the dayz_code you can't import or overwrite it
 
a little helpful hint here on how to find what you want. Go to the repository in github and you can search this repository for word and it shows up in all the files. Just have to bookmark all the mods
Dayz https://github.com/DayZMod/DayZ
Overwatch https://github.com/scrumbee/DayzOverwatch-Server
Epoch https://github.com/vbawol/DayZ-Epoch
Fallingsheep 1.6 Overpoch https://github.com/fallingsheep/0.16_Cash_Me_Up_Standard_Overpoch

Dayz and Epoch are the only githubs that include the dayz_code files so ... in Overpoch and Fallingsheeps you might not find what you want.
 
Back
Top