SA-MP Forums Archive
How do I do this? - 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)
+--- Thread: How do I do this? (/showthread.php?tid=388281)



How do I do this? - Deaglez - 28.10.2012

How do I do this
Example: Check when everybody is gTeam[playerid] == TEAM_ZOMBIE
Then will auto restart round:
pawn Код:
SendRconCommand("gmx");
Not very good at this.

Thanks


Re: How do I do this? - Emmet_ - 28.10.2012

Can you elaborate a bit more please?

You want the server to restart IF there's a zombie online?


Re: How do I do this? - Deaglez - 28.10.2012

Means like when everybody is infected. No more humans left. And it will auto restart.


Re: How do I do this? - Emmet_ - 28.10.2012

pawn Код:
stock NewRound()
{
    new count, count2;
    for (new i = 0; i < MAX_PLAYERS; i ++)
    {
        if (IsPlayerConnected(i)) count++;
        if (gTeam[i] == TEAM_ZOMBIE) count2++;
    }
    if (count1 == count2)
    {
        SendRconCommand("gmx");
    }
    return 1;
}
That's a function. Add it into the bottom of your script. Then you can do something like this:

pawn Код:
CMD:newround(playerid, params[])
{
    NewRound();
    return 1;
}



Re: How do I do this? - Deaglez - 28.10.2012

Edited


Re: How do I do this? - Emmet_ - 28.10.2012

Shit. Try this:

pawn Код:
stock NewRound()
{
    new count, count2;
    for (new i = 0; i < MAX_PLAYERS; i ++)
    {
        if (IsPlayerConnected(i) && gTeam[i] != TEAM_ZOMBIE) count++;
    }
    for (new i = 0; i < MAX_PLAYERS; i ++)
    {
        if (IsPlayerConnected(i) && gTeam[i] == TEAM_ZOMBIE) count2++;
    }
    if (count == count2)
    {
        SendRconCommand("gmx");
    }
    return 1;
}



Re: How do I do this? - JaKe Elite - 28.10.2012

^^

Dude there is no count1 in the stock

Change count1 to count.


Re: How do I do this? - Emmet_ - 28.10.2012

Thanks for reminding me!

TAKE THESE!

*throws 7 rep points at Romel*


Re: How do I do this? - Deaglez - 28.10.2012

Can I add to OnGameModeInit?


Re: How do I do this? - JaKe Elite - 28.10.2012

Quote:
Originally Posted by Emmet_
Посмотреть сообщение
Thanks for reminding me!

TAKE THESE!

*throws 7 rep points at Romel*
Thanks bro.