Question: forEach with player UID array?

Freaking Fred

OpenDayZ Rockstar!
Hey guys! I have not frequented these forums in a long time and I have not been actively scripting in DayZ for just as long. I just recently found the time to start messing around with some scripts and I have run into a small obstacle that I am hoping someone can lead me through.

Is it possible to use an array of player UIDs with a forEach command or is there a similar work-around? Any help would be greatly appreciated.

Ex:

Code:
_uid = getPlayerUID player;
inList = _uid in ["123456789","987654321"];

{

// Insert Statements Here

} forEach inList
 
Hey guys! I have not frequented these forums in a long time and I have not been actively scripting in DayZ for just as long. I just recently found the time to start messing around with some scripts and I have run into a small obstacle that I am hoping someone can lead me through.

Is it possible to use an array of player UIDs with a forEach command or is there a similar work-around? Any help would be greatly appreciated.

Ex:

Code:
_uid = getPlayerUID player;
inList = _uid in ["123456789","987654321"];

{

// Insert Statements Here

} forEach inList

Would this work?

Code:
_uid = getPlayerUID player;
if (_uid in ["123456789","987654321"]);

{

// Insert Statements Here

} forEach inList
 
Technically, I could probably get away with just using an if statement. I was just curious if what I was attempting was even possible. Thanks for the reply.
 
No problem :) , I think the way it's scripted is key and one vs another way could possibly introduce loopback more than another. Also consider
Code:
if (_what in
as an alternative
 
I'd use an if statement like you said:

Code:
_donkeyPlayers = ["123456789","987654321"];
_uid = getPlayerUID player;

if (_uid in _donkeyPlayers) then {
   //code
};
 
Back
Top