Random Player
#2

pawn Code:
stock RandomID()
{
    next:
    new
        playerid;
       
    playerid = random(GetMaxPlayers());
    if(!IsPlayerConnected(playerid))
        goto next;
    return playerid;
}

//or this
stock players() {
    new c;
    for(new i = 0; i < MAX_PLAYERS; ++i) {
        if(IsPlayerConnected(i))
        {
            c++ ;
        }
    }
    return c;
}
//using
//random(players())
Reply


Messages In This Thread
Random Player - by geerdinho8 - 14.07.2011, 19:24
Re: Random Player - by Ricop522 - 14.07.2011, 19:33
Re: Random Player - by iggy1 - 14.07.2011, 19:45
Re: Random Player - by Shadoww5 - 14.07.2011, 20:31
Re: Random Player - by geerdinho8 - 17.07.2011, 02:30
Re: Random Player - by =WoR=Varth - 17.07.2011, 02:46
Re: Random Player - by CyNiC - 17.07.2011, 02:50
Re: Random Player - by geerdinho8 - 17.07.2011, 03:11
Re: Random Player - by =WoR=Varth - 17.07.2011, 03:14
Re: Random Player - by geerdinho8 - 17.07.2011, 03:17

Forum Jump:


Users browsing this thread: 2 Guest(s)