UID restriction help

gr8_boi52

Well-Known Member
Hi!

I am trying to restrict deploy bike script only for donators. This is what i have and its doesnt seem to work

fn_selfActions.sqf
near top:
Code:
_deploybikedonors = ["231720134","74271814","239981382","239982214"]

These are the IDs that will be allowed to deploy a bike

Deploy bike script:
Code:
//BIKE DEPLOY
if ("ItemToolbox" in _weapons and (getPlayerUID player) in _deploybikedonors) then {
        hasBikeItem = true;
    } else { hasBikeItem = false;};
    if((speed player <= 1) && hasBikeItem && _canDo) then {
        if (s_player_deploybike < 0) then {
            s_player_deploybike = player addaction[("<t color=""#25E31B"">" + ("Deploy Bike") +"</t>"),"deploys\bike\deploy.sqf","",5,false,true,"", ""];
        };
    } else {
        player removeAction s_player_deploybike;
        s_player_deploybike = -1;
};

I added (getPlayerUID player) in _deploybikedonors in the if statement

Looks alright to me, why doesnt it work?
 
Code:
if ("ItemToolbox" in _weapons and _deploybikedonors = []) then {

Really, no idea....just throwing out guesses....

I'm a network admin, not a coder.:D
 
_deploybikedonors is a variable that contains an array of all the admin UIDs so instead of doing this
Code:
(getPlayerUID player) in ["231720134","74271814","239981382","239982214"]

I simply added:
Code:
_deploybikedonors = ["231720134","74271814","239981382","239982214"]

and called it in the if statement. Going to try to remove the variable and try the old code.
 
Code:
_deploybikedonors is a variable that contains an array of all the admin UIDs
Exactly. Which is why setting the
Code:
_deploybikedonors - []
seems like it should work since it's calling the array.
 
I would also have to put
Code:
(getPlayerUID player) in

and what would
Code:
- []
do to the code. It goes over my head.

(your suggestion didnt work)
 
_deploybikedonors is the variable.
["231720134","74271814","239981382","239982214"] is the the array
So by using _deploybikedonors - [], it should be acknowledging the variable and calling the array.

Sounds legit to me...but if it's not working, then a.) that's not how it should be used or, b.) that's how it should work but something else is missing.

Also, I could be way off...but I'm not so sure...regardless, your code is close. Maybe @ShootingBlanks will chime in soon. Although I haven't seen him or heard from him in days.

Another thought....are you using infiSTAR antihack? If so, you'll need to whitelist the action also or you won't get the scroll wheel option. Scratch that.
 
Ya, its not woking so its probably wrong. I have whitelisted it already. It works good without the UID restriction
 
Code:
if ("ItemToolbox" in _weapons and _deploybikedonors - []) then {
Is that it?
Theoretically, yes.

Or
Code:
if ("ItemToolbox" in _weapons && _deploybikedonors - []) then {

It's a shame someone more experienced with writing code hasn't dropped by and gave us their two cents. They could probably fix it in like 30 seconds for you.

Also...you should NEVER display UIDs on the forum for others to see....Always use XXXXXXX or 123456789, 0987654321 as UID when giving an example.
 
Hi!

I am trying to restrict deploy bike script only for donators. This is what i have and its doesnt seem to work

fn_selfActions.sqf
near top:
Code:
_deploybikedonors = ["231720134","74271814","239981382","239982214"]

These are the IDs that will be allowed to deploy a bike

Deploy bike script:
Code:
//BIKE DEPLOY
if ("ItemToolbox" in _weapons and (getPlayerUID player) in _deploybikedonors) then {
        hasBikeItem = true;
    } else { hasBikeItem = false;};
    if((speed player <= 1) && hasBikeItem && _canDo) then {
        if (s_player_deploybike < 0) then {
            s_player_deploybike = player addaction[("<t color=""#25E31B"">" + ("Deploy Bike") +"</t>"),"deploys\bike\deploy.sqf","",5,false,true,"", ""];
        };
    } else {
        player removeAction s_player_deploybike;
        s_player_deploybike = -1;
};

I added (getPlayerUID player) in _deploybikedonors in the if statement

Looks alright to me, why doesnt it work?


#######################


PHP:
_deploybikedonors = ["231720134","74271814","239981382","239982214"];
_uid = getPlayerUID player;

if((!isNull _uid) && (!isNull _deploybikedonors) && (_uid in _deploybikedonors)) then {
//Player is Donator
if (('ItemToolbox' in items player)) then {
//Player has Toolbox
//Not sure, if ItemToolbox is countet as Item or Weapon. 
};
};


#######################


Also make sure, that (if using InfiSTAR) you add "s_player_deploybike" in to your "AHConfig.sqf"
 
Adding that in from @Maddin's code

This is what i got

Code:
//BIKE DEPLOY
if((!isNull _uid) && (!isNull _deploybikedonors) && (_uid in _deploybikedonors)) then {
//Player is Donator
if (('ItemToolbox' in weapons player)) then {
//Player has Toolbox
        hasBikeItem = true;
    } else { hasBikeItem = false;};
    if((speed player <= 1) && hasBikeItem && _canDo) then {
        if (s_player_deploybike < 0) then {
            s_player_deploybike = player addaction[("<t color=""#25E31B"">" + ("Deploy Bike") +"</t>"),"deploys\bike\deploy.sqf","",5,false,true,"", ""];
        };
    } else {
        player removeAction s_player_deploybike;
        s_player_deploybike = -1;
};
};
 
Adding that in from @Maddin's code

This is what i got

Code:
//BIKE DEPLOY
if((!isNull _uid) && (!isNull _deploybikedonors) && (_uid in _deploybikedonors)) then {
//Player is Donator
if (('ItemToolbox' in weapons player)) then {
//Player has Toolbox
        hasBikeItem = true;
    } else { hasBikeItem = false;};
    if((speed player <= 1) && hasBikeItem && _canDo) then {
        if (s_player_deploybike < 0) then {
            s_player_deploybike = player addaction[("<t color=""#25E31B"">" + ("Deploy Bike") +"</t>"),"deploys\bike\deploy.sqf","",5,false,true,"", ""];
        };
    } else {
        player removeAction s_player_deploybike;
        s_player_deploybike = -1;
};
};


#############

Not sure, if "ItemToolbox" is a Weapon or Item. Might wanna check first:

Code:
//BIKE DEPLOY
if((!isNull _uid) && (!isNull _deploybikedonors) && (_uid in _deploybikedonors)) then {
//Player is Donator
player sideChat format["%1", items player]; //Give a List of Items from the Player. 
if (('ItemToolbox' in weapons player)) then {
//Player has Toolbox
        hasBikeItem = true;
    } else { hasBikeItem = false;};
    if((speed player <= 1) && hasBikeItem && _canDo) then {
        if (s_player_deploybike < 0) then {
            s_player_deploybike = player addaction[("<t color=""#25E31B"">" + ("Deploy Bike") +"</t>"),"deploys\bike\deploy.sqf","",5,false,true,"", ""];
        };
    } else {
        player removeAction s_player_deploybike;
        s_player_deploybike = -1;
};
};
 
I added a variable _weapons

Code:
_weapons = [currentWeapon player] + (weapons player) + (magazines player);
_isBike = typeOf cursorTarget in ["Old_bike_TK_INS_EP1","Old_bike_TK_CIV_EP1"];
_deploybikedonors = ["231720134","74271814","239981382","239982214"];
_uid = getPlayerUID player;

//BIKE DEPLOY
if((!isNull _uid) && (!isNull _deploybikedonors) && (_uid in _deploybikedonors)) then {
//Player is Donator
if (('ItemToolbox' in _weapons)) then {
//Player has Toolbox
        hasBikeItem = true;
    } else { hasBikeItem = false;};
    if((speed player <= 1) && hasBikeItem && _canDo) then {
        if (s_player_deploybike < 0) then {
            s_player_deploybike = player addaction[("<t color=""#25E31B"">" + ("Deploy Bike") +"</t>"),"deploys\bike\deploy.sqf","",5,false,true,"", ""];
        };
    } else {
        player removeAction s_player_deploybike;
        s_player_deploybike = -1;
};
};
 
Back
Top