Jump to content
Sign in to follow this  
1para{god-father}

how to limit Heli use by TAG name ?

Recommended Posts

If I wanted to limit who can acess a chopper by there TAG's how would I do this ? i.e -TAG-name1, -TAG-name2 , player1, player2 etc..

So only a player with -TAG- can get into and fly a chopper ?

Thanks

Share this post


Link to post
Share on other sites

if you mean clan tag. there is no way to do that, only way to do that is to check by id

else you can define all pilots.

pilots = [tag1,tag2,tag3,so on] ;
or 
#define pilots [tag1,tag2,tag3] 

depending on how you do it.

then use a getin event or make a loop script on the heli that checks if a player with tag is in driver seat.

if ((!player in pilots) && (player == driver heli)) then { player action["eject",vehicle player];};

hope you get the idea

Edited by nuxil

Share this post


Link to post
Share on other sites

Many thanks,

So there is no way to strip down the players name and just get

the first 5 digits ? As I know the clan tag will be 5 digits long so if it does not match pilots eject them?

If not them i presume the only way would be to write a complete list :(

Thanks

Share this post


Link to post
Share on other sites

Not sure you can the actual TAG itself cause that works different, than your name. So unless your name actually includes the TAG then I don't think you can get it, but if you can then:

private ["_i","_codep","_char","_nameArray","_tagStart","_actualTag","_tagText"];
//Get name and first letter (tag opener)
_nameArray = toArray(name player);
_tagStart = toString [_nameArray select 0];
//What's inside the tags [X] or -X- or =X=
_actualTag = [];

//Start at second letter
_i = 1;
_codep = _nameArray select _i; //code point
_char = toString [_codep]; // The char-string
while {_char != _tagStart && _i < (count _nameArray)} do {
   _actualTag set [count _actualTag, _codep]; //Save it
   _i = _i + 1;
   _codep = _nameArray select _i;
   _char = toString [_codep];
};
_tagText = toString _actualTag;
//Return _tagText
_tagText

Code is untested, however, I did give a check through squint.

Share this post


Link to post
Share on other sites

The Player name will be -TAG-somename for all clan members - so ill give your code a try and get back to you - much appreciated - trying to lock down the apache to just clan members

Cheers again

Share this post


Link to post
Share on other sites

name player will never show you the -tag-name

what you need is getPlayerUid

if you have a squad.xml you already know the Id for the players , so its just the mattre of putting them in a array,

_all_ids = [000000,111111,222222,333333,444444];
_player_id = getplayerUid player;

if ((!_player_id in _all_ids) && (player == driver vehicle player)) then {player action["eject",vehicle player];};

Edited by nuxil

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×