17.08.2012, 17:38
(
Последний раз редактировалось Dan.; 17.08.2012 в 18:50.
)
I go into the game, just started up the server. I choose a team, team England, or whatever team I want. Then my friend comes into the game, he can't choose team I chose because it's full, he will choose team Mexico.
But when I do /resetteam and /kill to change my team, I cant choose any of the teams, I cant choose the team I chose, can't choose the team my friend chose, cant choose any of the teams!
This is the OnPlayerRequestSpawn function:
The IsTeamFull stock:
And the stock "teammembers" what is used in the previous stock, this gets how many players are in the team:
But when I do /resetteam and /kill to change my team, I cant choose any of the teams, I cant choose the team I chose, can't choose the team my friend chose, cant choose any of the teams!
This is the OnPlayerRequestSpawn function:
pawn Код:
public OnPlayerRequestSpawn(playerid)
{
if(IsTeamFull(gTeam[playerid]))
{
SendClientMessage(playerid, C_GREY, "The team is full, please choose another one!");
return 0;
}
else
{
return 1;
}
}
pawn Код:
stock IsTeamFull(teamid)
{
if(teamid == T_ENGLAND)
{
if(TeamMembers(teamid) > TeamMembers(T_RUSSIA) || TeamMembers(teamid) > TeamMembers(T_MEXICO) || TeamMembers(teamid) > TeamMembers(T_IRAQ))
{
return 1;
}
else return 0;
}
if(teamid == T_RUSSIA)
{
if(TeamMembers(teamid) > TeamMembers(T_ENGLAND) || TeamMembers(teamid) > TeamMembers(T_MEXICO) || TeamMembers(teamid) > TeamMembers(T_IRAQ))
{
return 1;
}
else return 0;
}
if(teamid == T_MEXICO)
{
if(TeamMembers(teamid) > TeamMembers(T_RUSSIA) || TeamMembers(teamid) > TeamMembers(T_ENGLAND) || TeamMembers(teamid) > TeamMembers(T_IRAQ))
{
return 1;
}
else return 0;
}
if(teamid == T_IRAQ)
{
if(TeamMembers(teamid) > TeamMembers(T_RUSSIA) || TeamMembers(teamid) > TeamMembers(T_MEXICO) || TeamMembers(teamid) > TeamMembers(T_ENGLAND))
{
return 1;
}
else return 0;
}
return 0;
}
pawn Код:
stock TeamMembers(teamid)
{
new players = 0;
foreach(Player, i)
{
if(gTeam[i] == teamid)
{
if(GetPlayerState(i) != PLAYER_STATE_NONE) // If the player isn't choosing a class.
{
players ++;
}
}
}
return players;
}