21.03.2015, 17:31
Example:
pawn Код:
new gTeam1,
gTeam2,
pTeam[MAX_PLAYERS];
public OnPlayerSpawn(playerid)
{
if(gTeam1 <= gTeam2)
{
SendClientMessage(playerid, -1 "You have joined team 1!");
pTeam[playerid] = 1;
gTeam1 ++;
}
else
{
SendClientMessage(playerid, -1 "You have joined team 2!");
pTeam[playerid] = 2;
gTeam2 ++;
}
return 1;
}
CMD:balanceteams(playerid, params[])
{
SendClientMessageToAll(-1, "An administrator has balanced the teams!");
gTeam1 = 0, gTeam2 = 0;
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(gTeam1 <= gTeam2)
{
SendClientMessage(playerid, -1 "You have joined team 1!");
pTeam[playerid] = 1;
gTeam1 ++;
}
else
{
SendClientMessage(playerid, -1 "You have joined team 2!");
pTeam[playerid] = 2;
gTeam2 ++;
}
}
return 1;
}