ongamemodeinit explode 1 random player???
#5

pawn Код:
public OnGameModeInit()
{
    SetTimer("ExplodePlayer",60000,false);
    return 1;
}

public ExplodePlayer()
{
    new conn_ID[MAX_PLAYERS],count;
    for(new i; i < MAX_PLAYERS; i++)
    {
        if(!IsPlayerConnected(i)) continue;
        conn_ID[count] = i;
        count++;
    }
    if(count == 0) return 1; // No players were connected...
    new Float:x,Float:y,Float:z;
    GetPlayerPos(conn_ID[random(count)],x,y,z);
    CreateExplosion(x, y, z, 5, 20); // Player goes boom
    return 1;
}
Maybe you can learn from that

Finding a random player to work with in the entire server is messy though, I can't think of another way to do it without looping through to make sure they're connected and build an array with the information in it.
Reply


Messages In This Thread
ongamemodeinit explode 1 random player??? - by lSCARl - 11.08.2010, 14:53
Re: ongamemodeinit explode 1 random player??? - by [DRD]Rodney - 11.08.2010, 15:24
Re: ongamemodeinit explode 1 random player??? - by Kar - 11.08.2010, 15:29
Re: ongamemodeinit explode 1 random player??? - by lSCARl - 12.08.2010, 21:36
Re: ongamemodeinit explode 1 random player??? - by JaTochNietDan - 12.08.2010, 21:54
Re: ongamemodeinit explode 1 random player??? - by lSCARl - 12.08.2010, 22:00

Forum Jump:


Users browsing this thread: 1 Guest(s)