18.12.2011, 17:23
Try this
On top
Always try to use SetPlayerTeam with this
On top
pawn Код:
new players, cop, terrorist;
pawn Код:
public OnPlayerConnect(playerid)
{
players++;
return 1;
}
public OnPlayerDisconnect(playerid)
{
players--;
if(GetPlayerTeam(playerid) == TEAM_COPS)
{
cop--;
}
else if(GetPlayerTeam(playerid) == TEAM_TERRORISTS)
{
terrorist--;
}
return 1;
}
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
new _limit = (players/2), bool:limit;
if(terrorist >= _limit || cop >= _limit)
{
limit = true;
}
else
{
limit = false;
}
if(classid == TEAM_COPS && limit == true) return SendClientMessage(playerid, 0xFF0000, "That team is full!");
else
{
cop++;
}
if(classid == TEAM_TERRORISTS && limit == true) return SendClientMessage(playerid, 0xFF0000, "That team is full!");
else
{
terrorist++;
}
return 1;
}