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



Teambalance? - geerdinho8 - 31.05.2011

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    if(classid == 0)
    {
    if(Team1Count > Team2Count)
    {
    SendClientMessage(playerid, COLOR_RED, "Please, join the other team to balance the teams.");
    GameTextForPlayer(playerid,"~r~RED ~w~TEAM",1000,5);
    }
    else if(classid == 1)
    {
    if(Team2Count > Team1Count)
    {
    GameTextForPlayer(playerid,"~b~BLUE ~w~TEAM",1000,5);
    SendClientMessage(playerid, COLOR_RED, "Please, join the other team to balance the teams.");
    }
    }
    }
    return 1;
}
Will this work?


Re: Teambalance? - SpiderWalk - 31.05.2011

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    if(classid == 0)
    {
    if(Team1Count > Team2Count)
    {
        SendClientMessage(playerid, COLOR_RED, "Please, join the other team to balance the teams.");
        GameTextForPlayer(playerid,"~r~RED ~w~TEAM",1000,5);
    }
    else if(classid == 1)
    {
    if(Team2Count > Team1Count)
    {
        GameTextForPlayer(playerid,"~b~BLUE ~w~TEAM",1000,5);
        SendClientMessage(playerid, COLOR_RED, "Please, join the other team to balance the teams.");
    }
    return 1;
}
If this is not working try your version.


Re: Teambalance? - geerdinho8 - 31.05.2011

Both dont work :S

Someone has suggestions? :O


Re: Teambalance? - Joe Staff - 31.05.2011

You've got your brackets out of order, you need 1 more before "else if"


Re: Teambalance? - geerdinho8 - 01.06.2011

Nope, does not work :S


Re: Teambalance? - Biesmen - 01.06.2011

Try this.
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    if(GetPlayerSkin(playerid) == *) // Replace * with the skin you entered at the first AddPlayerClass
    {
        if(Team1Count > Team2Count)
        {
            SendClientMessage(playerid, COLOR_RED, "Please, join the other team to balance the teams.");
            GameTextForPlayer(playerid,"~r~RED ~w~TEAM",1000,5);
        }
    }
    else if(GetPlayerSkin(playerid) == *) // Replace * with the skin you entered at the second AddPlayerClass
    {
        if(Team2Count  > Team1Count)
        {
            GameTextForPlayer(playerid,"~b~BLUE ~w~TEAM",1000,5);
            SendClientMessage(playerid, COLOR_RED, "Please, join the other team to balance the teams.");
        }
    }
    return 1;
}



Re: Teambalance? - geerdinho8 - 01.06.2011

Quote:
Originally Posted by Biesmen
Посмотреть сообщение
Try this.
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    if(GetPlayerSkin(playerid) == *) // Replace * with the skin you entered at the first AddPlayerClass
    {
        if(Team1Count > Team2Count)
        {
            SendClientMessage(playerid, COLOR_RED, "Please, join the other team to balance the teams.");
            GameTextForPlayer(playerid,"~r~RED ~w~TEAM",1000,5);
        }
    }
    else if(GetPlayerSkin(playerid) == *) // Replace * with the skin you entered at the second AddPlayerClass
    {
        if(Team2Count  > Team1Count)
        {
            GameTextForPlayer(playerid,"~b~BLUE ~w~TEAM",1000,5);
            SendClientMessage(playerid, COLOR_RED, "Please, join the other team to balance the teams.");
        }
    }
    return 1;
}
Nope does also not work :S


Re: Teambalance? - geerdinho8 - 01.06.2011

sume help lz


Re: Teambalance? - Raimis_R - 01.06.2011

At first you need create function to count teams like:

pawn Код:
for(new i = 0; i != MAX_PLAYERS; i++)
{
    new Team1,Team2;
    if(!IsPlayerConnected(i)) continue;
   
    if(IsPlayerIn1Team(i))
    {
        Team1++;
    }
    else
    {
        Team2++;
    }
}
and then you can check on Request