Team balancer - 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)
+--- Thread: Team balancer (
/showthread.php?tid=377234)
Team balancer -
mini_mi - 13.09.2012
i got a gm with 2 teams but i need team balancer can some one help me plz pm me
AW: Team balancer -
BiosMarcel - 13.09.2012
Simple ask how many members are in which team
like this
if(Map1Voll(0))
{
SetPVarInt(playerid,"TeamMap1",1);
}
else if(Map1Voll(1))
{
SetPVarInt(playerid,"TeamMap1",2);
}
if(Map1Voll(2))
{
SetPVarInt(playerid,"TeamMap1",1);
}
else if(Map1Voll(3))
{
SetPVarInt(playerid,"TeamMap1",2);
}
Re: Team balancer -
Squirrel - 13.09.2012
PHP код:
new TeamPlayers[ <Amount of teams here> ];
public OnPlayerRequestSpawn(playerid)
{
for(new teams; teams < [Team Amount]; teams++)
{
if(teams == gTeam[playerid]) continue;
if(TeamPlayers[gTeam[playerid]] > TeamPlayers[teams] + 3)
{
SendClientMessage(playerid, COLOR_RED, "You can't join this team as it would unbalance the game!");
return 0;
}
}
}
This is how it should be, something like this.
PHP код:
public OnPlayerRequestSpawn( playerid )
{
for( new teams; teams < 23; teams++ )
{
if( teams == gTeam[ playerid ] ) continue;
if( TeamPlayers[ gTeam[ playerid ] ] > TeamPlayers[ teams ] + 3)
{
SendClientMessage( playerid, COLOR_RED, "You can't join this team as it would unbalance the game!" );
return 0;
}
}
return 1;
}
Re: Team balancer -
mini_mi - 14.09.2012
tnx guys