Jump to content
  • 0

Trader for UID


Namindu

Question

Hello, So i wanted to make a trader work for a UID instead of Hummanity. So here is what I did.

 

 

So i made this file called VIPlevel.sqf

if ((getPlayerUID player) in
[
"0",
"0",
"0"
]) then {

_playerObj setVariable["vip1_list",1,true];

};

if ((getPlayerUID player) in
[
"#",
"##",
"###"
]) then {

_playerObj setVariable["vip2_list",1,true];

};

if ((getPlayerUID player) in
[
"0",
"0",
"0"
]) then {

_playerObj setVariable["vip3_list",1,true];

};

 

Then at the top of the fn_selfActions.sqf I did this:

#include "Viplevels.sqf"
diag_log ("Fn_selfActions Started");
scriptName "Functions\misc\fn_selfActions.sqf";

 

And then at the trader part this

    // All Traders
    if (_isMan and !_isPZombie and _traderType in serverTraders) then {
        
        if (s_player_parts_crtl < 0) then {

            // get humanity
            _humanity = player getVariable ["humanity",0];
            _traderMenu = call compile format["menu_%1;",_traderType];

            // get player vip
            
            _vip1 = player getVariable ["vip1_list",0];
            _vip2 = player getVariable ["vip2_list",0];
            _vip3 = player getVariable ["vip3_list",0];            
            
            // diag_log ("TRADER = " + str(_traderMenu));
            
            _low_high = "low";
            _humanity_logic = false;
            if((_traderMenu select 2) == "friendly") then {
                _humanity_logic = (_humanity < -5000);
            };
            if((_traderMenu select 2) == "hostile") then {
                _low_high = "high";
                _humanity_logic = (_humanity > -5000);
            };
            if((_traderMenu select 2) == "hero") then {
                _humanity_logic = (_humanity < 5000);
            };
            if((_traderMenu select 2) == "vip0") then {
                _humanity_logic = (_humanity < -5000000);
            };
            if((_traderMenu select 2) == "vip1") then {
                _humanity_logic = _vip1;
            };
            if((_traderMenu select 2) == "vip2") then {
                _humanity_logic = _vip2;
            };
            if((_traderMenu select 2) == "vip3") then {
                _humanity_logic = _vip3;
            };
            if(_humanity_logic) then {
                _cancel = player addAction [format[localize "STR_EPOCH_ACTIONS_HUMANITY",_low_high], "\z\addons\dayz_code\actions\trade_cancel.sqf",["na"], 0, true, false, "",""];
                s_player_parts set [count s_player_parts,_cancel];
            } else {

 

Anybody know who to get this to work. As soon as i head to one of these trades the fn_selfActions.sqf stops working.
 

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

Add a diag_log to see what _vip1 = player getVariable ["vip1_list",0]; is returning, and then adjust for it. I don't believe it is returning true or false like you think it is, I think it is instead returning the contents of the variable.

 

Instead of playing with variables, a better route may be just making a global array of playerIDs allowed and then checking against the array.

servVipArr1 = ["###","###","###"];
servVipArr2 = ["###","###","###"];
servVipArr3 = ["###","###","###"];
if((_traderMenu select 2) == "vip1") then {
            if ((getPlayerUID player) in servVipArr1) then {
                    _humanity_logic = true;
            };
};
Link to comment
Share on other sites

  • 0

 

Add a diag_log to see what _vip1 = player getVariable ["vip1_list",0]; is returning, and then adjust for it. I don't believe it is returning true or false like you think it is, I think it is instead returning the contents of the variable.

 

Instead of playing with variables, a better route may be just making a global array of playerIDs allowed and then checking against the array.

servVipArr1 = ["###","###","###"];
servVipArr2 = ["###","###","###"];
servVipArr3 = ["###","###","###"];
if((_traderMenu select 2) == "vip1") then {
            if ((getPlayerUID player) in servVipArr1) then {
                    _humanity_logic = true;
            };
};

Thanks it help, but when i put my Uid into "servVipArr2" and then go to the trader who sells "Vip2". It says my humanity is too low and when i go to the other two traders it works, even tho my uid is not in for them. Also i want it to be like if a person with Vip2 can also use vip1, this is not much since i can join add that part in Server_trader.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...