22.09.2018, 03:41
The above method would be simple and will work but relying on random data to exit a iterative statement is a bad practice.You can remove random value from the iterator,assign it to a variable denoting president and again take the random value from iterator for vice president and add the value that was removed previously, back into the iterator.Also you can take the number of players in event using Iter_Count function.
PHP код:
if(Iter_Count(PlayersInEvent) > 2){
new president = Iter_Random(PlayersInEvent);
Iter_Remove(PlayersInEvent,president);
new vice_president = Iter_Random(PlayersInEvent);
Iter_Add(PlayersInEvent,president);
}else{
Iter_Clear(PlayersInEvent);
//end event ...
}