OnPlayerDeath
#1

i wonder why is this not working !!!
when a cop kills a wanted player, the player will go to jail and will appear to him a clock time of how much time remaining till he released from jail.

everything is working but the time is moving quickly, not "seconds" ...here is the code: do i miss returns or something?!

Note: i tested this on /arrest command and worked perfect, but it's not working on "OnPlayerDeath"


pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(LawEnforcementMode[killerid] == true) //check if the killer is a cop or law enforcement
    {
        if(PlayerTeam[playerid] != TEAM_CIV || PlayerTeam[playerid] == TEAM_CIV && GetPlayerWantedLevel(playerid)<=3)
        { //if the player that has been killed is not civilian or civilian and his wanted level is less than 3
            DecreaseScore(killerid, 1); // it will decrease the killerid score by 1
            SendDeathMessage(killerid, playerid, reason);
        }
        else
        { //else if he is civilian and his wanted level is greater than 3
       
            PlayerInfo[playerid][pJailTime] = (GetPlayerWantedLevel(playerid)*60)/4;
            PutPlayerInJail(playerid); //will put the playerid in jail as a takendown (arrest)
            IncreaseScore(killerid, 1);
            SendDeathMessage(killerid, playerid, reason);
        }
    }
    return 1;
}

public PutPlayerInJail(playerid)
{
    new Random = random(sizeof(RandomJail));
    SetPlayerInterior(playerid,3);
    SetPlayerVirtualWorld(playerid,1);
    SetPlayerPos(playerid, RandomJail[Random][0], RandomJail[Random][1], RandomJail[Random][2]);
    SetPlayerFacingAngle(playerid, RandomJail[Random][3]);
    SetCameraBehindPlayer(playerid);
    SetPlayerWantedLevel(playerid, 0);
    SetPlayerHealth(playerid, 100);
   
    JailTimer[playerid] = SetTimerEx("UpdateJailSystem", 1000, true, "i", playerid);
    //jail timer is for showing the clock textdraw (how much time is remaining till release from jail)
    return 1;
}

public UpdateJailSystem(playerid)
{
    if(PlayerInfo[playerid][pJailTime] > 0)
    {
        new string[128], gseconds, gminutes;
        gseconds = PlayerInfo[playerid][pJailTime] % 60;
        gminutes = (PlayerInfo[playerid][pJailTime] - gseconds) / 60;
        PlayerInfo[playerid][pJailTime] --;
        format(string, sizeof string, "%d:%02d", gminutes, gseconds);
        TextDrawSetString(JailTimeClock[playerid], string);
        TextDrawShowForPlayer(playerid, JailTimeClock[playerid]);
    }
    else
    {
        ReleasePlayerFromJail(playerid);
    }
    return 1;
}
Reply


Messages In This Thread
OnPlayerDeath - by AnonScripter - 18.01.2014, 21:29
Re: OnPlayerDeath - by AnonScripter - 19.01.2014, 13:05
Re: OnPlayerDeath - by Smally - 19.01.2014, 13:19
Re: OnPlayerDeath - by Sawalha - 19.01.2014, 13:26
Re: OnPlayerDeath - by AnonScripter - 19.01.2014, 16:40
Re: OnPlayerDeath - by SickAttack - 19.01.2014, 16:46
Re: OnPlayerDeath - by AnonScripter - 19.01.2014, 19:43
Re: OnPlayerDeath - by Lajko1 - 19.01.2014, 19:51
Re: OnPlayerDeath - by AnonScripter - 19.01.2014, 20:04
Re: OnPlayerDeath - by SickAttack - 19.01.2014, 20:07

Forum Jump:


Users browsing this thread: 1 Guest(s)