Help ASAP [+rep] - 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: Help ASAP [+rep] (
/showthread.php?tid=313596)
Help ASAP [+rep] -
lordturhan - 26.01.2012
Ok guys i need a team balance script.I tryed hiddos's one but it gived errors.Ok i use SetPlayerTeam i have 2 teams.IF other team more then other team they cant join that team.
Need help asap because people keep choosing first skin
Re: Help ASAP [+rep] -
geerdinho8 - 26.01.2012
pawn Код:
public OnPlayerRequestSpawn(playerid)
{
new team1count, team2count;
for(new i, m = GetMaxPlayers(); i < m; i++)
{
if (IsPlayerConnected(i))
{
if (gTeam[i] == TEAM_ONE) team1count++;
else if (gTeam[i] == TEAM_TWO) team2count++;
}
}
if (gTeam[playerid] == TEAM_ONE)
{
if (team1count > (team2count+1)){
SendClientMessage(playerid, COLOR_YELLOW, "This team is full, please choose the other one.");
return 0;
}
}
else if (gTeam[playerid] == TEAM_TWO)
{
if ((team1count+1) < team2count){
SendClientMessage(playerid, COLOR_YELLOW, "This team is full, please choose the other one.");
return 0;
}
}
return 1;
}
Good Luck with it!
Change the gTeams.
Re: Help ASAP [+rep] -
lordturhan - 26.01.2012
You sure this scripts works?
Re: Help ASAP [+rep] -
lordturhan - 26.01.2012
Thanks it works +rep
Re: Help ASAP [+rep] -
geerdinho8 - 26.01.2012
Glad to hear!
Re: Help ASAP [+rep] -
[ABK]Antonio - 26.01.2012
Why would you use a loop when you can increment team2count and team1count when other players spawn then do your other checks on onplayerrequestspawn?