SA-MP Forums Archive
ongamemodeinit explode 1 random player??? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: ongamemodeinit explode 1 random player??? (/showthread.php?tid=167198)



ongamemodeinit explode 1 random player??? - lSCARl - 11.08.2010

how would i set a timer for 1 minute so after game mode starts it blows up 1 random person? also after all players on TEAM_HIDER 0 are gone (cause i have on player death setplayerteam to the other team) the game mode restarts and it says all players exterminated! restarting in 5 seconds. please help. Thanks


Re: ongamemodeinit explode 1 random player??? - [DRD]Rodney - 11.08.2010

Stop making 500 topics and post all your requests in 1?

and OnGameModeInit, then there are no players connected...


Re: ongamemodeinit explode 1 random player??? - Kar - 11.08.2010

Quote:
Originally Posted by [DRD]Rodney
Посмотреть сообщение
Stop making 500 topics and post all your requests in 1?

and OnGameModeInit, then there are no players connected...
He Said A Timer.

i could make one but it will be buggy<.<


Re: ongamemodeinit explode 1 random player??? - lSCARl - 12.08.2010

Bump


Re: ongamemodeinit explode 1 random player??? - JaTochNietDan - 12.08.2010

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.


Re: ongamemodeinit explode 1 random player??? - lSCARl - 12.08.2010

Quote:
Originally Posted by JaTochNietDan
Посмотреть сообщение
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.
hmm you seem beast. thanks and if its not too much to ask no one has helped me with... how can i restart the game mode when all players on a team (TEAM_HIDER 0) like when theres no more players on that team when its empty because when they die they are switched to another team. so how can i do this?