20.06.2011, 15:37
Hey guys,
I got a problem with spawning.
I'm trying to prevent a player from spawning, is the teamcount equals to the maxteamcount.
Note from wiki: "Returning 0 in this callback will prevent the player from spawning. The player can be forced to spawn when SpawnPlayer is used however the player will re-enter class selection the next time they die."
I've made it return 0 if the teamcount equals to maxteamcount, but they're still able to spawn
What to do?
I got a problem with spawning.
I'm trying to prevent a player from spawning, is the teamcount equals to the maxteamcount.
Note from wiki: "Returning 0 in this callback will prevent the player from spawning. The player can be forced to spawn when SpawnPlayer is used however the player will re-enter class selection the next time they die."
I've made it return 0 if the teamcount equals to maxteamcount, but they're still able to spawn
What to do?
pawn Код:
#define MaxTeamCount 0
OnGameModeInit
TeamCount = 0;
public OnPlayerRequestClass(playerid, classid)
{
switch(classid)
{
case 0 .. 5:
{
if(TeamCount == MaxTeamCount)
{
GameTextForPlayer(playerid, "~r~Team is full~y~!", 1000, 3);
SetPlayerInterior(playerid, 0);
SetPlayerCameraPos(playerid, 1306.2509, 2194.7842, 12.3751); SetPlayerCameraLookAt(playerid, 1305.3710, 2195.2520, 12.0651);
SetPlayerPos(playerid,1303.5723,2197.1284,11.0234); SetPlayerFacingAngle(playerid, 217.7654);
return 0; // This should prevent the spawn
}
else
{
SetPlayerTeamFromClass(playerid, classid); SetPlayerPos(playerid,1303.5723,2197.1284,11.0234); SetPlayerFacingAngle(playerid, 217.7654);
SetPlayerCameraPos(playerid, 1306.2509, 2194.7842, 12.3751); SetPlayerCameraLookAt(playerid, 1305.3710, 2195.2520, 12.0651); SetPlayerInterior(playerid, 0);
return 1; // This will make the player spawn
}
}
}
return 1;
}