Teambalance?
#1

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?
Reply
#2

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.
Reply
#3

Both dont work :S

Someone has suggestions? :O
Reply
#4

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

Nope, does not work :S
Reply
#6

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;
}
Reply
#7

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
Reply
#8

sume help lz
Reply
#9

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)