Prevent Spawning
#1

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?

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;
}
Reply


Messages In This Thread
Prevent Spawning - by Wesley221 - 20.06.2011, 15:37
Re: Prevent Spawning - by Alvord - 20.06.2011, 15:52
Re: Prevent Spawning - by Wesley221 - 20.06.2011, 16:22
Re: Prevent Spawning - by Alvord - 20.06.2011, 16:48
Re: Prevent Spawning - by Wesley221 - 20.06.2011, 16:50
Re: Prevent Spawning - by Steven82 - 20.06.2011, 17:08
Re: Prevent Spawning - by Wesley221 - 20.06.2011, 17:29
Re: Prevent Spawning - by Wesley221 - 20.06.2011, 22:31
Re: Prevent Spawning - by =WoR=Varth - 20.06.2011, 22:36
Re: Prevent Spawning - by Wesley221 - 21.06.2011, 09:16

Forum Jump:


Users browsing this thread: 1 Guest(s)