Teambalance help. - 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 help. (
/showthread.php?tid=124209)
Teambalance help. -
[dN]Eagle - 29.01.2010
pawn Код:
for(new p = 0; p < GetMaxPlayers(); p++)
{
if(IsPlayerConnected(p))
{
if (gTeam[p] == TEAM_HOBO)
{
count1++;
}
else if (gTeam[p] == TEAM_RICH)
{
count2++;
}
}
}
if ((count1 > count2) && gTeam[playerid] == TEAM_HOBO)
{
SendClientMessage(playerid, COLOR_SERVER, "[SERVER]: Choose another team to keep the teams even!");
SetPlayerHealth(playerid,100.0);
return 0;
}
else if ((count2 > count1) && gTeam[playerid] == TEAM_RICH)
{
SendClientMessage(playerid, COLOR_SERVER, "[SERVER]: Choose another team to keep the teams even!");
SetPlayerHealth(playerid,100.0);
return 0;
}
return 1;
}
Alright, so that's my team balancer but it's not working properly.
I can only select 1 class at the beginning :S
And I am only capeable to select 1 team.
Help please
Re: Teambalance help. -
[dN]Eagle - 29.01.2010
Bumpy dumy.
Re: Teambalance help. -
[dN]Eagle - 29.01.2010
Same reason as above.
Re: Teambalance help. -
[dN]Eagle - 30.01.2010
Bump.
Re: Teambalance help. -
MaykoX - 30.01.2010
Код:
public OnPlayerRequestSpawn(playerid)
{
new Count1, Count2;
for(new p = 0; p < GetMaxPlayers(); p++)
{
if (GetPlayerTeam(p) == TEAM_Terrorist) Count1++;
else if (GetPlayerTeam(p) == TEAM_Army) Count2++;
}
if ((Count1 > Count2) && GetPlayerTeam(playerid) == TEAM_Army)
{
SendClientMessage(playerid,COLOR_RED, "[BALANCER] Balancing teams. Choose Another Team");
return 0;
}
else if ((Count2 > Count1) && GetPlayerTeam(playerid) == TEAM_Terrorist)
{
SendClientMessage(playerid,COLOR_RED, "[BALANCER] Balancing teams. Choose Another Team");
return 0;
}
return 1;
}
Rember to change TEAMS !