Team Balance Problem - 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 Balance Problem (
/showthread.php?tid=320137)
Team Balance Problem -
SpiderWalk - 21.02.2012
Hello everybody.I created my own Team balance and its not working i dont see any problem maybe you will see.
pawn Код:
new swatcount;//Global Variable
new terrorcount;//Global Variable
public OnPlayerDisconnect(playerid, reason)
{
if(GetPlayerTeam(playerid) == 1)
{
terrorcount--;
}
else if(GetPlayerTeam(playerid) == 2)
{
swatcount--;
}
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
SetPlayerInterior(playerid, 0);
if(GetPlayerSkin(playerid) == 121)
{
SetPlayerTeam(playerid, 1);
SetPlayerColor(playerid,0xFF4600FF);
terrorcount++;
}
if(GetPlayerSkin(playerid) == 285)
{
SetPlayerTeam(playerid, 2);
SetPlayerColor(playerid,0x0091FFFF);
swatcount++;
}
if((terrorcount > swatcount) && (GetPlayerTeam(playerid) == 1))
{
GameTextForPlayer(playerid,"~r~Team Full choose other",2000,3);
return 0;
}
if((terrorcount < swatcount) && (GetPlayerTeam(playerid) == 2))
{
GameTextForPlayer(playerid,"~r~Team Full choose other",2000,3);
return 0;
}
return 1;
}
Re: Team Balance Problem -
WoodPecker - 21.02.2012
pawn Код:
public OnPlayerRequestSpawn(playerid)
{
SetPlayerInterior(playerid, 0);
if(GetPlayerSkin(playerid) == 121)
{
SetPlayerTeam(playerid, 1);
SetPlayerColor(playerid,0xFF4600FF);
terrorcount++;
}
if(GetPlayerSkin(playerid) == 285)
{
SetPlayerTeam(playerid, 2);
SetPlayerColor(playerid,0x0091FFFF);
swatcount++;
}
if(GetPlayerTeam[playerid] == 1 && swatcount > terrorcount)
{
GameTextForPlayer(playerid,"~r~Team Full choose other",2000,3);
return 0;
}
if(GetPlayerTeam[playerid] == 2 && terrorcount > swatcount)
{
GameTextForPlayer(playerid,"~r~Team Full choose other",2000,3);
return 0;
}
return 1;
}
Try this one.
Re: Team Balance Problem -
Luka P. - 22.02.2012
This should do it.
Naskripto sam ti ovo, al svejedno si budala <3
pawn Код:
#define TEAM_SWAT (0)
#define TEAM_TERROR (1)
#define TEAM_SWAT_COLOR (0xFF4600FF)
#define TEAM_TERROR_COLOR (0x0091FFFF)
new gTeamCount[2];
public OnPlayerConnect(playerid)
{
SetPlayerTeam(playerid, NO_TEAM);
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
SetPlayerInterior(playerid, 0);
new playerSkin = GetPlayerSkin(playerid);
switch(playerSkin)
{
case 121:
{
SetPlayerTeam(playerid, TEAM_SWAT);
SetPlayerColor(playerid, TEAM_SWAT_COLOR);
if((gTeamCount[TEAM_SWAT]++ > gTeamCount[TEAM_TERROR]) && (!(gTeamCount[TEAM_TERROR]++ > gTeamCount[TEAM_SWAT])) && (!(gTeamCount[TEAM_SWAT]++ == gTeamCount[TEAM_TERROR]++)))
{
GameTextForPlayer(playerid,"~r~This team is full~n~Choose another", 2000, 3);
return 0;
}
gTeamCount[TEAM_SWAT]++;
}
case 285:
{
SetPlayerTeam(playerid, TEAM_TERROR);
SetPlayerColor(playerid, TEAM_TERROR_COLOR);
if((gTeamCount[TEAM_TERROR]++ > gTeamCount[TEAM_SWAT]) && (!(gTeamCount[TEAM_SWAT]++ > gTeamCount[TEAM_TERROR])) && (!(gTeamCount[TEAM_TERROR]++ == gTeamCount[TEAM_SWAT]++)))
{
GameTextForPlayer(playerid,"~r~This team is full~n~Choose another", 2000, 3);
return 0;
}
}
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
switch(GetPlayerTeam(playerid))
{
case TEAM_SWAT:
{
gTeamCount[TEAM_SWAT] --;
}
case TEAM_TERROR:
{
gTeamCount[TEAM_TERROR] --;
}
}
return 1;
}
Re: Team Balance Problem -
SpiderWalk - 24.02.2012
Its not working

Luka.Also from WoodPecker
Re: Team Balance Problem - T0pAz - 24.02.2012
Quote:
Originally Posted by SpiderWalk
Its not working  Luka.Also from WoodPecker
|
What's the problem? What's not working?