8 Numbers - need them split in two, randomly
#4

This works perfectly:

pawn Код:
stock randomplayer()
{
    new z = 0, w, y = GetMaxPlayers();
    static Conectados[MAX_PLAYERS];
    while(z < y)
    {
        if(IsPlayerConnected(z))
        {
            Conectados[w] = z;
            w++;
        }
        z++;
    }
    return !w ? -1 : Conectados[random(w)];
}
How to Use:

pawn Код:
printf("Random ID: %d", randomplayer());
Credits: rjjj
Reply


Messages In This Thread
8 Numbers - need them split in two, randomly - by Donya - 19.07.2011, 20:30
Re: 8 Numbers - need them split in two, randomly - by lolumadd_ - 19.07.2011, 20:36
Re: 8 Numbers - need them split in two, randomly - by Donya - 19.07.2011, 20:42
Re: 8 Numbers - need them split in two, randomly - by Shadoww5 - 19.07.2011, 21:03
Re: 8 Numbers - need them split in two, randomly - by Donya - 19.07.2011, 22:27
Re: 8 Numbers - need them split in two, randomly - by Gamer_Z - 19.07.2011, 22:56
Re: 8 Numbers - need them split in two, randomly - by Donya - 19.07.2011, 23:12
AW: Re: 8 Numbers - need them split in two, randomly - by Nero_3D - 19.07.2011, 23:28

Forum Jump:


Users browsing this thread: 1 Guest(s)