SA-MP Forums Archive
Eh? How? - 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: Eh? How? (/showthread.php?tid=187049)



Eh? How? - Rocky Balboa - 31.10.2010

Look I was trying to make a server with 3 teams.Ok, team 1 only one guy has to take it. And if a guy from team 3 dies, a guy from team 1 goes on his place. But if there is no body at team 1, how do I know ? Which one wold work ?
pawn Код:
if(team[playerid] == 3)
    {
        new count = 0;
        for(new i; i<MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i) && team[i] == 1)
            {
                count = 1;
            }
            if(count == 0)
            {
                SendClientMessageToAll(red, "There is nobody at team 1");
            }
            if(count == 1)
            {
                if(IsPlayerConnected(i) && team[i] == 1)
                {
                    team[i] = 3;
                    OnPlayerSpawn(i);
                }
            }
        }
    }
OR
pawn Код:
if(team[playerid] == 3)
    {
        new count;
        for(new i; i<MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                if(team[i] != 1)
                {
                    count = 0;
                }
                else count++;
               
                if(count == 0)
                {
                    SendClientMessageToAll(red, "There is nobody at team 1");
                }
                if(count == 1)
                {
                    if(IsPlayerConnected(i) && team[i] == 1)
                    {
                        team[i] = 3;
                        OnPlayerSpawn(i);
                    }
                }
            }
        }
    }