Jump to content
Graz

UID-whitelist Trigger condition

Recommended Posts

I'm trying to write a trigger but getting my head around the syntax is proving difficult. Most of the information is on the forums it's just putting it together that's tough.

What I want the trigger to do

Everytime Bluefor enters the zone, it checks against an array of UIDs, if there's a clan member the trigger sleeps for an hour before rechecking. If the player isn't on the UID list, the trigger activates.

I'm having a bit of trouble putting the syntax together.

Check UID against array, if yes, sleep for 1 hour (3600)

If no activate

Does anyone know how to turn the above 2 lines into a condition/activate argument?

The activate is basically just to setpos with a hint, so it's fairly easy. what would I need to write in the deactivate though so it properly resets?

The stage I'm basically at is

EDIT: Updated!

class Sensors

{

items=1;

class Item0

{

position[]={4424.6094,5.6378021,2172.0027};

activationBy="WEST";

repeating=1;

age="UNKNOWN";

expActiv=" private ["_Clan213"];

_Clan213 = [3370054, 87734342, 74351430]; // THIS IS LINE 1963

private ["_PlayerUID"];

_PlayerUID = (getplayerUID player);

if (_PlayerUID in _Clan213) then

{

hint "Welcome to the clan area";

}

else

{

hint "You're trepassing!";

};";

class Effects

{

};

};

};

It's not working though, any help would be really appreciated

Edited by Graz
Updated line

Share this post


Link to post
Share on other sites

Hi man! so, look at this and find your errors

_UIDs = [
	"xxxxxxx",  //players uids 
	"yyyyyyy",
	"xuyxuyxuy"
	];

if (_playerID in _UIDs) then { 
diag_log ("LOGIN ATTEMPT: Player [" + _playerName + "] is  whitelisted");
hint "You are Whitelisted. Please vizit http://.....";
//and more codecodecodecodecodecodecodecode
}	else	{ 
if (codecodecode) exitWith { 
diag_log ("LOGIN DISATTEMPT: Player [" + _playerName + "] is not whitelisted");
hint "You are Whitelisted. Please vizit http://.....";
};
};

This code working. I tested this on my server.

Now I think how can made _UIDs list in out file... any ideas?

Edited by sprocker

Share this post


Link to post
Share on other sites

That's interesting

It's a bit hard to convert into an area trigger though

How are you defining your arrays?

My trigger activate line looks like:

private ["_Clan213"];

_Clan213 = [abc, bca, cba];

if (getplayerUID player in _Clan213) then

{

hint "Welcome to the clan area";

}

else

{

hint "You're trepassing!";

};

But I'm getting the invalid number expression O.o any ideas

Edited by Graz
Made Colon go away

Share this post


Link to post
Share on other sites

That's what : before private?

Also where you have abc, bca you actually have the playerID numbers as "strings" right? getPlayerUID returns a string. Also players are actually running that script and not just the server? Also code tags! And you're not gonna get anything in the editor, you're testing this in MP right?

Share this post


Link to post
Share on other sites

A couple ideas... I believe getplayerUID only works in Multiplayer so you must test in a MP environment or replace getplayerUID player with an actual string to test in SP.

Also...what's the colon there for?

[color="#FF0000"]:[/color] private ["_Clan213"];
_Clan213 = [abc, bca, cba];
if (getplayerUID player in _Clan213) then
{
hint "Welcome to the clan area";
}
else
{
hint "You're trepassing!";
};

EDIT: ninja'd

Share this post


Link to post
Share on other sites

Sorry the colon was a bad copy paste job, there's not one in the code. I'm using a dedicated server to test it with mp.

The error in the.rpt file is

21:57:10 File mpmissions\__cur_mp.Panthera2\mission.sqm, line 1963: '/Mission/Sensors/Item0.expActiv': Missing ';' at the end of line

21:57:10 Error context ];

ErrorMessage: File mpmissions\__cur_mp.Panthera2\mission.sqm, line 1963: '/Mission/Sensors/Item0._Clan213': '"' encountered instead of '='

The whole 'sensor' line is

class Sensors

{

items=1;

class Item0

{

position[]={4424.6094,5.6378021,2172.0027};

activationBy="WEST";

repeating=1;

age="UNKNOWN";

expActiv=" private ["_Clan213"];

_Clan213 = [3370054, 87734342, 74351430]; // THIS IS LINE 1963

private ["_PlayerUID"];

_PlayerUID = (getplayerUID player);

if (_PlayerUID in _Clan213) then

{

hint "Welcome to the clan area";

}

else

{

hint "You're trepassing!";

};";

class Effects

{

};

};

};

Share this post


Link to post
Share on other sites

Looks like you've been messing with the mission.sqm file. There's very few occasions where you will ever need to open that file. Certainly not to edit triggers etc. Edit everything like that from the editor. The mission.sqm is not meant to be edited directly.... it is not a script.

Maybe Squint can sort it out for you.... I'm not sure because I don't use it.

---------- Post added at 02:15 AM ---------- Previous post was at 02:08 AM ----------

Anyway... just looking at what's there... you can't use local variables in a trigger.... that might be one of your problems.

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

×