johnw7392 10 Posted September 18, 2016 Hello All, I am new to the forums here and have a quick question for all you the genius scripters here. In my mission, I would like to have a specific zone on the map to be a "whitelisted" zone so if you enter the zone and are not on the whitelist the you get teleport out of the zone. I am trying to find other topics about this but to no avail. I also attached a pic to help describe what i'm trying to achieve, if a player walks into zone "A" then a UID Whitelist is checked for their UID, if they are not on the whitelist the they will be teleported back to zone "B". I hope this helps and hope someone can help me solve this issue. Share this post Link to post Share on other sites
jshock 513 Posted September 18, 2016 private _myWhiteList = ["id1","id2","id3"]; while {true} do { { if ((!getPlayerUID _x in _myWhiteList) && _x inArea "zoneA") then { _x setPos getMarkerPos "zoneB";// or getPos "zoneB", depending on what the zones are }; } count allPlayers; sleep 3; }; 2 Share this post Link to post Share on other sites
theend3r 83 Posted September 18, 2016 private _myWhiteList = ["id1","id2","id3"]; while {true} do { { if ((!getPlayerUID _x in _myWhiteList) && _x inArea "zoneA") then { _x setPos getMarkerPos "zoneB";// or getPos "zoneB", depending on what the zones are }; } count allPlayers; sleep 3; }; I see count being used often like this. Is it better than forEach? Share this post Link to post Share on other sites
das attorney 858 Posted September 18, 2016 It's marginally faster, but lacks an index and expects bool or nothing so it's horses for courses. 1 Share this post Link to post Share on other sites
johnw7392 10 Posted September 19, 2016 I must be doing this wrong some how and can't figure it out, nothing I try works. I took the code that Jshock provided and saved it as "towWhitelist.sqf" in my scripts folder. Then I added [] execVM "scripts\towWhitelist.sqf" to my init.sqf. From there I created an area in my mission and named it "towZone" this being the area I only want whitelisted players able to enter. Then I placed down a helipad while testing named "zoneTP" this being the place non-whitelisted players get tp'd to. I then try to test the mission in an MP environment but get an error message as soon as I finish loading. Can anybody help solve this issue? I will provide links to images of the error. 1. Original Code Provided (edited to work with my markers) private _myWhiteList = ["id1","id2","id3"]; while {true} do { { if ((!getPlayerUID _x in _myWhiteList) && _x inArea "towZone") then { _x setPos getMarkerPos "zoneTP";// or getPos "zoneB", depending on what the zones are }; } count allPlayers; sleep 3; }; 2. Link to image of Error Message http://prnt.sc/cjp7vj 3. Link to 2d image of "Restricted" area marker http://prnt.sc/cjp82f 4. Link to 3d image of "Restricted" area marker http://prnt.sc/cjp7ms Share this post Link to post Share on other sites
Tajin 349 Posted September 19, 2016 I think your placement of the "!" was the issue. This should do: if ( (!(getPlayerUID _x) in _myWhiteList) && (_x inArea "towZone") ) then If you don't mind running it locally instead of on the server, you could also do it with a very simple trigger: condition: player in thisList onAct: if( (getPlayerUID player) in yourPublicWhiteListVariable ) then { ....whatever } else { hint "welcome to this very exclusive zone"; } Share this post Link to post Share on other sites
jshock 513 Posted September 19, 2016 Yup my apologies, kinda threw that together quickly :p (the below should also work): if (!(getPlayerUID _x in _myWhiteList) && (_x inArea "zoneA")) then {blah};And just an FYI, the _myWhiteList variable needs to contain all the approved player ID strings for your area, not what I provided, those are just for example purposes :). Share this post Link to post Share on other sites