SendPlayerToJail || OnPlayerDeath
#5

I try to guess what the problem is. Let me explain.

You have under OnPlayerSpawn a function that set the player position to where it need's to be spawned. Like if he's a cop he will be spawned at the section, if he's a civilian he will be spawned at the airport etc. So OnPlayerDeath you put that player in jail, and OnPlayerSpawn you get that player out of jail. I would recommend you to make an array to save all the players that must be in jail, and OnPlayerSpawn you should put them there. Something like:
pawn Код:
new PlayerJailed[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    PlayerJailed[playerid]=0; //reset the variables for each player connected.
}

public OnPlayerSpawn(playerid)
{
    if(PlayerJailed[playerid]==1)
    {
        SendPlayerToJail(playerid);
    }
    else
    {
        //Spawn him normally
    }
}

public OnPlayerDeath(playerid, killerid, reason)
{
    if(IsCop[killerid] == true)
    {
        if(PlayerTeam[playerid] == TEAM_CIVILIANS && GetPlayerWantedLevel(playerid)>=4)
        {
            IncreaseScore(killerid,1);
            PlayerJailed[playerid]=1;
            return 1;
        }
    }
    return 1;
}
Reply


Messages In This Thread
Removed - by AnonScripter - 03.06.2014, 13:13
Re: SendPlayerToJail || OnPlayerDeath - by iThePunisher - 03.06.2014, 13:17
Re: SendPlayerToJail || OnPlayerDeath - by rockhopper - 03.06.2014, 13:19
Re: SendPlayerToJail || OnPlayerDeath - by AnonScripter - 03.06.2014, 13:33
Re: SendPlayerToJail || OnPlayerDeath - by Koala818 - 03.06.2014, 13:34
Re: SendPlayerToJail || OnPlayerDeath - by AnonScripter - 03.06.2014, 13:43
Re: SendPlayerToJail || OnPlayerDeath - by rockhopper - 03.06.2014, 13:45
Re: SendPlayerToJail || OnPlayerDeath - by Koala818 - 03.06.2014, 13:49
Re: SendPlayerToJail || OnPlayerDeath - by AnonScripter - 03.06.2014, 14:00
Re: SendPlayerToJail || OnPlayerDeath - by AnonScripter - 03.06.2014, 15:27

Forum Jump:


Users browsing this thread: 1 Guest(s)