SA-MP Forums Archive
team balancer(when pressed F4) - 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: team balancer(when pressed F4) (/showthread.php?tid=511547)



team balancer(when pressed F4) - TheSimpleGuy - 06.05.2014

Onplayerdeath
pawn Код:
if(GetPlayerTeam(playerid) == 1) team1[playerid] = 1;
    if(GetPlayerTeam(playerid) == 2) team2[playerid] = 1;
OnPlayerRequestSpawn
pawn Код:
if(class1[playerid] == 1)
    {
        if(tcount > acount)
        {
            SendClientMessage(playerid, -1, "Team is "COL_VIOLET"full"COL_WHITE"!");
            return 0;
        }
        else
        {
            tcount++;
            if(team2[playerid] == 1) acount--;
            return 1;
        }
    }
   
    if(class2[playerid] == 1)
    {
        if(acount > tcount)
        {
            SendClientMessage(playerid, -1, "Team is "COL_VIOLET"full"COL_WHITE"!");
            return 0;
        }
        else
        {
            acount++;
            if(team1[playerid] == 1) tcount--;
            return 1;
        }
    }
I've created a command called /teams if I can record the error.
If I join terrorists, terrorists will be 1. If I join police, terrorists will be 1, and police will also be 1.
it doesn't subtract


Re: team balancer(when pressed F4) - Blademaster680 - 06.05.2014

So what you trying todo is make it so when you type /teams it will loop through all the players on all the times and display how many players are on each team?


Re: team balancer(when pressed F4) - TheSimpleGuy - 06.05.2014

No.
Quote:

If I join terrorists, terrorists will be 1. If I join police, terrorists will be 1, and police will also be 1.

My point is, there is already a subtract that when you are from another team, it will be subtracted, but it doesn't get subtracted at all!


Re: team balancer(when pressed F4) - Konstantinos - 06.05.2014

Don't subtract at all. You don't have to and it will cause problems.

Let's say you join team A and it goes 1 players. I join team B and it goes 1 players too but your team A goes 0 with the subtraction.


Re: team balancer(when pressed F4) - TheSimpleGuy - 06.05.2014

Can you give me some example from my script? I really do not get what I am scripting right now. THe only problem in my server is this fucking Team Balancer, I am fucking brainwashed.