Random Animation
#5

Quote:
Originally Posted by aoky
Посмотреть сообщение
Is there anyway to do this without foreach?
It's possible without foreach, however is less optimized. This might work, I haven't tested it though.
pawn Код:
new RandomPlayer = INVALID_PLAYER_ID, TempIndex;
while(RandomPlayer == INVALID_PLAYER_ID)
{
    TempIndex = random(GetPlayerPoolSize() + 1);
    if(TempIndex != INVALID_PLAYER_ID)
        RandomPlayer = TempIndex;
}
This continues the code block until a random player has been selected.
Reply


Messages In This Thread
Random Animation - by aoky - 08.02.2017, 13:05
Re: Random Animation - by Abagail - 08.02.2017, 13:19
Re: Random Animation - by aoky - 08.02.2017, 13:26
Re: Random Animation - by aoky - 08.02.2017, 13:55
Re: Random Animation - by Abagail - 08.02.2017, 16:12
Re: Random Animation - by aoky - 08.02.2017, 16:41
Re: Random Animation - by Abagail - 08.02.2017, 18:25
Re: Random Animation - by aoky - 08.02.2017, 18:31
Re: Random Animation - by Abagail - 08.02.2017, 18:32
Re: Random Animation - by aoky - 08.02.2017, 18:47

Forum Jump:


Users browsing this thread: 1 Guest(s)