Hallo,
ich habe Teambalance eingebaut. Leider funktioniert es nicht so wie ich es mir gedacht hatte, denn eben kam jemand on der in mein Team konnte, obwohl nur zwei online waren.
Und das Script prüft doch wo weniger Spieler drin sind ...?
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerTeamFromClass(playerid, classid);
PlayerPlaySound(playerid, 1183, 0.0, 0.0, 10.0);
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, -2469.8145,1545.0579,36.7992);
SetPlayerFacingAngle(playerid, 87.7678);
SetPlayerCameraLookAt(playerid, -2469.8145,1545.0579,36.7992);
SetPlayerCameraPos(playerid, -2469.8145 + (5 * floatsin(-87.7678, degrees)), 1545.0579 + (5 * floatcos(-87.7678, degrees)), 36.7992);
new mafiab,swatb;
for(new i=0; i<MAX_PLAYERS;i++)
{
if(i!=playerid && IsPlayerConnected(i))
{
switch(gTeam[i])
{
case TEAM_MAFIA:{mafiab++;}
case TEAM_SWAT:{swatb++;}
}
}
}
switch(classid)
{
case 0: gTeam[playerid] = TEAM_MAFIA;
case 1: gTeam[playerid] = TEAM_SWAT;
}
if(gTeam[playerid] == TEAM_MAFIA)
{
if(swatb < mafiab) {SendClientMessage(playerid,COLOR_RED,"This team is full! Teambalance."); return 0;}
return 1;
}
if(gTeam[playerid] == TEAM_SWAT)
{
if(swatb > mafiab) {SendClientMessage(playerid,COLOR_RED,"This Team is full! Teambalance."); return 0;}
return 1;
}
return 1;
}