need help with jailtimer
#1

Hello everyone, i had someone who supported me in scripting the jail system.
it works fine but there is a bug into it and i tried to fix it a lot of times but failed.
When the player gets jailed by the law in game and enters the jail for 2 minutes and when the time passes the player gets unjailed. Well, after the player gets unjailed the timer still works like this:

Also there is another problem the anti-evade still works when someone dies in jail but it's supposed to work when a player disconnect then connect.
and here is the code for both of them
This is when they get arrested by the police with /ar (the arresting command) not killing
Код HTML:
CMD:ar(playerid,params[])
{
    new targetid;
    if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return SCM(playerid, COLOR_LIGHTRED, "You have to be on foot to use this command");
    if(GetPlayerState(targetid) != PLAYER_STATE_ONFOOT) return SCM(playerid, COLOR_LIGHTRED, "Your target must be on foot to use this command");
    if(pjob[playerid] == 0) return SendClientMessage(playerid, COLOR_RED, "You have to be a police officer in the freeroam gamemode to use this command" );
    if(pjob[playerid] == 1)
    {
        if(sscanf(params, "u", targetid)) return SCM(playerid, COLOR_FREEROAM, "Use: /ar [Playerid]");
        if(!IsPlayerConnected(targetid)) return SCM(playerid, COLOR_RED, "Error: Player not found!");
        if(targetid == playerid) return SCM(playerid, COLOR_RED, "Error: You can't arrest yourself!");
        if(GetPlayerWantedLevel(targetid) == 0) return SendClientMessage(playerid, COLOR_RED, "Leave him alone, he's not a criminal");
        if(GetDistanceBetweenPlayers(playerid, targetid) > 5.00) return SendClientMessage(playerid, COLOR_RED, "That player is too far away!");
        if(GetDistanceBetweenPlayers(playerid, targetid) < 5.00)
        {
            injail[targetid] = 1;
            SendClientMessage(targetid, COLOR_FREEROAM, "You're arrested by the police for 2 minutes");
            SetPlayerWantedLevel(targetid, 0);
            SetPlayerInterior(targetid, 6);
            SetPlayerPos(targetid, 264.3227,81.6192,1001.0391);
            SetPlayerFacingAngle(targetid, 296.0341);
            new pname[MAX_PLAYER_NAME], string[80];
            GetPlayerName(targetid, pname, sizeof(pname));
            format(string, sizeof(string), "%s has been arrested by the police for 2 minutes!", pname);
            SendClientMessageToAll(COLOR_POLICE, string);
            AccData[targetid][JailDuration] = 60*2; // 2: Number of minutes  || 60: Seconds per minute
            jailtimer[targetid] = SetTimerEx("jail", 1000, true, "i", targetid); // Decrease time each second
            PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
            GivePlayerMoney(playerid, 4800);
            GivePlayerMoney(targetid, -5000);
            SetPlayerColor(targetid, COLOR_CIVIL);
        }
    }
    return 1;
}
forward jail(playerid);
public jail(playerid)
{
    AccData[playerid][JailDuration] -= 1;
    if(AccData[playerid][JailDuration] == 0)
    {
        new string[50];
        SendClientMessage(playerid, COLOR_GREEN,"You're free now, go!");
        format(string, sizeof(string), "%s has been unjailed!", GetName(playerid));
        KillTimer(jailtimer[playerid]);
        SendClientMessageToAll(COLOR_FREEROAM, string);
        SetPlayerInterior(playerid,0);
        injail[playerid] = 0;
        if(SF[playerid] == 1)
        {
            SetPlayerPos(playerid,-1604.8895,720.1664,11.8497);
            SetPlayerFacingAngle(playerid,0.2900);
        }
        else if(LS[playerid] == 1)
        {
            SetPlayerPos(playerid,1544.0620,-1675.6432,13.5577);
            SetPlayerFacingAngle(playerid,90.3087);
        }
        else if(LV[playerid] == 1)
        {
            SetPlayerPos(playerid,2286.7761,2423.7617,10.8203);
            SetPlayerFacingAngle(playerid,179.1007);
        }
        
        SetPlayerSpecialAction(playerid,SPECIAL_ACTION_NONE);
        SetPlayerColor(playerid, COLOR_CIVIL);
        SetPlayerWantedLevel(playerid, 0);
        RemovePlayerAttachedObject(playerid, 9);
        AccData[playerid][JailDuration] = -1;
    }
    new s[25];
    format(s, sizeof(s), "Jail Time: %d Seconds", AccData[playerid][JailDuration]);
    GameTextForPlayer(playerid, s, 1000, 3);
    return 1;
}
if(AccData[playerid][JailDuration] > -1)
    {
        if( killedbypd[playerid] ) // Didn't evade, Already in jail
        {
            killedbypd[playerid] = false;
        }
        else 
        {
	        // Jail the player
	        injail[playerid] = 1;
	        SendClientMessage(playerid, COLOR_FREEROAM, "You'll have to finish your jail time");
	        SetPlayerWantedLevel(playerid, 0);
	        SetPlayerInterior(playerid, 6);
	        SetPlayerPos(playerid, 264.3227,81.6192,1001.0391);
	        SetPlayerFacingAngle(playerid, 296.0341);
	        new string[80];
	        format(string, sizeof(string), "Anti-Evade: %s has been jailed for %d seconds!", GetName(playerid), AccData[playerid][JailDuration]);
	        SendClientMessageToAll(COLOR_POLICE, string);
	        jailtimer[playerid] = SetTimerEx("jail", 1000, true, "i", playerid); // Decrease time each second

	        // Now Set his game stats to FreeRoaming
	        infreeroam[playerid] = 1;
	        SF[playerid] = 1;
	        SendClientMessage(playerid, COLOR_FREEROAM,"You'll be spawned in Freeroam gamemode (San Fierro)");
	        new stringesi[65];
	        format(stringesi, sizeof(stringesi), "%s has joined Freeroam gamemode (San Fierro)", GetName(playerid));
	        SendClientMessageToAll(COLOR_FREEROAM, stringesi);
	        lobby[playerid] = 0;
	        CreateDynamicMapIcon(-2625.9368,208.9869,4.6143, 6, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
	        CreateDynamicMapIcon(-2664.9614,639.6124,14.4531, 22, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
	        CreateDynamicMapIcon(-1593.9250,716.2734,-5.2422, 30, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
	        CreateDynamicMapIcon(-1786.8904,1208.3572,25.1250, 8, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
	        CreateDynamicMapIcon(-2173.1907,679.7965,55.1633, 58, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
	        CreateDynamicMapIcon(-1671.8628,1338.5602,7.1875, 60, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
	        CreateDynamicMapIcon(-2374.8813,910.1338,45.4453, 45, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);

	        CreateDynamicMapIcon(-1980.3044,288.4990,35.1719, 55, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
	        CreateDynamicMapIcon(-2491.6021,-197.0443,25.6172, 8, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
	        CreateDynamicMapIcon(-1673.4355,415.6969,7.1797, 51, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
	        CreateDynamicMapIcon(-1704.5774,785.6741,25.2780, 52, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
            SetPlayerSkillLevel(playerid,WEAPONSKILL_PISTOL,0);
	        // =========================================
		}
    }
    if(GetPlayerWantedLevel(playerid) > 0)
    {
        // Want the player
        LS[playerid] = 1;
        SendClientMessage(playerid, COLOR_FREEROAM, "You won't be able to evade");
        SetPlayerInterior(playerid, 0);
        SetPlayerColor(playerid, COLOR_WANTED);
        
        new string[80];
        format(string, sizeof(string), "Anti-Evade: %s has been re-wanted again to level %d !", GetName(playerid), GetPlayerWantedLevel(playerid));
        SendClientMessageToAll(COLOR_POLICE, string);
        SetPlayerPos(playerid, 1727.9077,-1668.2974,22.6094);
        SetPlayerFacingAngle(playerid, 33.4079);
        infreeroam[playerid] = 1;
        SendClientMessage(playerid, COLOR_FREEROAM,"You'll be spawned in Freeroam gamemode (San Fierro)");
        new stringesi[65];
        format(stringesi, sizeof(stringesi), "%s has joined Freeroam gamemode (San Fierro)", GetName(playerid));
        SendClientMessageToAll(COLOR_FREEROAM, stringesi);
        lobby[playerid] = 0;
        CreateDynamicMapIcon(-2625.9368,208.9869,4.6143, 6, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
        CreateDynamicMapIcon(-2664.9614,639.6124,14.4531, 22, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
        CreateDynamicMapIcon(-1593.9250,716.2734,-5.2422, 30, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
        CreateDynamicMapIcon(-1786.8904,1208.3572,25.1250, 8, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
        CreateDynamicMapIcon(-2173.1907,679.7965,55.1633, 58, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
        CreateDynamicMapIcon(-1671.8628,1338.5602,7.1875, 60, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
        CreateDynamicMapIcon(-2374.8813,910.1338,45.4453, 45, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
        CreateDynamicMapIcon(-1980.3044,288.4990,35.1719, 55, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
        CreateDynamicMapIcon(-2491.6021,-197.0443,25.6172, 8, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
        CreateDynamicMapIcon(-1673.4355,415.6969,7.1797, 51, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
        CreateDynamicMapIcon(-1704.5774,785.6741,25.2780, 52, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
        SetTimerEx("unwant", 480000, false, "i", playerid);
        SendClientMessage(playerid, COLOR_YELLOW, "You'll lose your wanted level after 8 minutes");
        SetPlayerSkillLevel(playerid,WEAPONSKILL_PISTOL,0);
        SetPlayerColor(playerid, COLOR_WANTED);
        // =========================================
}
and this is when he dies by the cop
Код HTML:
 if(pjob[killerid] == 1)
            {
                if(GetPlayerWantedLevel(playerid) > 0)
                {
                    injail[playerid] = 1;
                    killedbypd[playerid] = true;
                    SetPlayerInterior(playerid,6);
                    SetPlayerPos(playerid,264.3227,81.6192,1001.0391);
                    SetPlayerFacingAngle(playerid,296.0341);
                    new pname[MAX_PLAYER_NAME], string[197 + MAX_PLAYER_NAME];
                    GetPlayerName(playerid, pname, sizeof(pname));
                    format(string, sizeof(string), "%s has been arrested by the police for 2 minutes!", pname);
                    SendClientMessageToAll(COLOR_POLICE, string);
                    SendClientMessage(playerid,COLOR_FREEROAM,"You're arrested in jail for 2 minute");
                    SetPlayerWantedLevel(playerid, 0);
                    AccData[playerid][JailDuration] = 60*2; // 2: Number of minutes  || 60: Seconds per minute
                    jailtimer[playerid] = SetTimerEx("jail", 1000, true, "i", playerid); // Decrease time each second
                    PlayerPlaySound(killerid,1057,0.0,0.0,0.0);
                    GivePlayerMoney(killerid, 4800);
                    GivePlayerMoney(playerid, -5000);
                }
            }
I didn't find where is the problem exactly. btw, wanted level and jailtimer gets saved etc. That's how the anti-evade works. If you want to see the saving parts tell me. Just help me cuz this bug pissed me off i fixed it before and i don't know what happend now
Reply
#2

try to put the system down seconds in a 1 second timer already created, without creating timers every time you put it in jail.
Reply
#3

i did that and it still the same
Reply
#4

try not to create timers when you put it in jail and when seconds are greater than -1.

Код:
if(AccData[playerid][JailDuration] > -1)
    {
        if( killedbypd[playerid] ) // Didn't evade, Already in jail
        {
            killedbypd[playerid] = false;
        }
        else 
        {
	        // Jail the player
	        injail[playerid] = 1;
	        SendClientMessage(playerid, COLOR_FREEROAM, "You'll have to finish your jail time");
	        SetPlayerWantedLevel(playerid, 0);
	        SetPlayerInterior(playerid, 6);
	        SetPlayerPos(playerid, 264.3227,81.6192,1001.0391);
	        SetPlayerFacingAngle(playerid, 296.0341);
	        new string[80];
	        format(string, sizeof(string), "Anti-Evade: %s has been jailed for %d seconds!", GetName(playerid), AccData[playerid][JailDuration]);
	        SendClientMessageToAll(COLOR_POLICE, string);
	        jailtimer[playerid] = SetTimerEx("jail", 1000, true, "i", playerid);
Reply
#5

so that means i should remove that one??
Reply
#6

where you using this code, in what public or where?

Код:
if(AccData[playerid][JailDuration] > -1)
    {
        if( killedbypd[playerid] ) // Didn't evade, Already in jail
        {
            killedbypd[playerid] = false;
        }
        else 
        {
	        // Jail the player
	        injail[playerid] = 1;
	        SendClientMessage(playerid, COLOR_FREEROAM, "You'll have to finish your jail time");
	        SetPlayerWantedLevel(playerid, 0);
	        SetPlayerInterior(playerid, 6);
	        SetPlayerPos(playerid, 264.3227,81.6192,1001.0391);
	        SetPlayerFacingAngle(playerid, 296.0341);
	        new string[80];
	        format(string, sizeof(string), "Anti-Evade: %s has been jailed for %d seconds!", GetName(playerid), AccData[playerid][JailDuration]);
	        SendClientMessageToAll(COLOR_POLICE, string);
	        jailtimer[playerid] = SetTimerEx("jail", 1000, true, "i", playerid); // Decrease time each second

	        // Now Set his game stats to FreeRoaming
	        infreeroam[playerid] = 1;
	        SF[playerid] = 1;
	        SendClientMessage(playerid, COLOR_FREEROAM,"You'll be spawned in Freeroam gamemode (San Fierro)");
	        new stringesi[65];
	        format(stringesi, sizeof(stringesi), "%s has joined Freeroam gamemode (San Fierro)", GetName(playerid));
	        SendClientMessageToAll(COLOR_FREEROAM, stringesi);
	        lobby[playerid] = 0;
	        CreateDynamicMapIcon(-2625.9368,208.9869,4.6143, 6, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
	        CreateDynamicMapIcon(-2664.9614,639.6124,14.4531, 22, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
	        CreateDynamicMapIcon(-1593.9250,716.2734,-5.2422, 30, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
	        CreateDynamicMapIcon(-1786.8904,1208.3572,25.1250, 8, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
	        CreateDynamicMapIcon(-2173.1907,679.7965,55.1633, 58, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
	        CreateDynamicMapIcon(-1671.8628,1338.5602,7.1875, 60, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
	        CreateDynamicMapIcon(-2374.8813,910.1338,45.4453, 45, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);

	        CreateDynamicMapIcon(-1980.3044,288.4990,35.1719, 55, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
	        CreateDynamicMapIcon(-2491.6021,-197.0443,25.6172, 8, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
	        CreateDynamicMapIcon(-1673.4355,415.6969,7.1797, 51, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
	        CreateDynamicMapIcon(-1704.5774,785.6741,25.2780, 52, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
            SetPlayerSkillLevel(playerid,WEAPONSKILL_PISTOL,0);
	        // =========================================
		}
    }
    if(GetPlayerWantedLevel(playerid) > 0)
    {
        // Want the player
        LS[playerid] = 1;
        SendClientMessage(playerid, COLOR_FREEROAM, "You won't be able to evade");
        SetPlayerInterior(playerid, 0);
        SetPlayerColor(playerid, COLOR_WANTED);
        
        new string[80];
        format(string, sizeof(string), "Anti-Evade: %s has been re-wanted again to level %d !", GetName(playerid), GetPlayerWantedLevel(playerid));
        SendClientMessageToAll(COLOR_POLICE, string);
        SetPlayerPos(playerid, 1727.9077,-1668.2974,22.6094);
        SetPlayerFacingAngle(playerid, 33.4079);
        infreeroam[playerid] = 1;
        SendClientMessage(playerid, COLOR_FREEROAM,"You'll be spawned in Freeroam gamemode (San Fierro)");
        new stringesi[65];
        format(stringesi, sizeof(stringesi), "%s has joined Freeroam gamemode (San Fierro)", GetName(playerid));
        SendClientMessageToAll(COLOR_FREEROAM, stringesi);
        lobby[playerid] = 0;
        CreateDynamicMapIcon(-2625.9368,208.9869,4.6143, 6, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
        CreateDynamicMapIcon(-2664.9614,639.6124,14.4531, 22, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
        CreateDynamicMapIcon(-1593.9250,716.2734,-5.2422, 30, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
        CreateDynamicMapIcon(-1786.8904,1208.3572,25.1250, 8, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
        CreateDynamicMapIcon(-2173.1907,679.7965,55.1633, 58, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
        CreateDynamicMapIcon(-1671.8628,1338.5602,7.1875, 60, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
        CreateDynamicMapIcon(-2374.8813,910.1338,45.4453, 45, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
        CreateDynamicMapIcon(-1980.3044,288.4990,35.1719, 55, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
        CreateDynamicMapIcon(-2491.6021,-197.0443,25.6172, 8, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
        CreateDynamicMapIcon(-1673.4355,415.6969,7.1797, 51, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
        CreateDynamicMapIcon(-1704.5774,785.6741,25.2780, 52, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
        SetTimerEx("unwant", 480000, false, "i", playerid);
        SendClientMessage(playerid, COLOR_YELLOW, "You'll lose your wanted level after 8 minutes");
        SetPlayerSkillLevel(playerid,WEAPONSKILL_PISTOL,0);
        SetPlayerColor(playerid, COLOR_WANTED);
        // =========================================
}
Reply
#7

Quote:
Originally Posted by Florin48
Посмотреть сообщение
where you using this code, in what public or where?

Код:
if(AccData[playerid][JailDuration] > -1)
    {
        if( killedbypd[playerid] ) // Didn't evade, Already in jail
        {
            killedbypd[playerid] = false;
        }
        else 
        {
	        // Jail the player
	        injail[playerid] = 1;
	        SendClientMessage(playerid, COLOR_FREEROAM, "You'll have to finish your jail time");
	        SetPlayerWantedLevel(playerid, 0);
	        SetPlayerInterior(playerid, 6);
	        SetPlayerPos(playerid, 264.3227,81.6192,1001.0391);
	        SetPlayerFacingAngle(playerid, 296.0341);
	        new string[80];
	        format(string, sizeof(string), "Anti-Evade: %s has been jailed for %d seconds!", GetName(playerid), AccData[playerid][JailDuration]);
	        SendClientMessageToAll(COLOR_POLICE, string);
	        jailtimer[playerid] = SetTimerEx("jail", 1000, true, "i", playerid); // Decrease time each second

	        // Now Set his game stats to FreeRoaming
	        infreeroam[playerid] = 1;
	        SF[playerid] = 1;
	        SendClientMessage(playerid, COLOR_FREEROAM,"You'll be spawned in Freeroam gamemode (San Fierro)");
	        new stringesi[65];
	        format(stringesi, sizeof(stringesi), "%s has joined Freeroam gamemode (San Fierro)", GetName(playerid));
	        SendClientMessageToAll(COLOR_FREEROAM, stringesi);
	        lobby[playerid] = 0;
	        CreateDynamicMapIcon(-2625.9368,208.9869,4.6143, 6, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
	        CreateDynamicMapIcon(-2664.9614,639.6124,14.4531, 22, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
	        CreateDynamicMapIcon(-1593.9250,716.2734,-5.2422, 30, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
	        CreateDynamicMapIcon(-1786.8904,1208.3572,25.1250, 8, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
	        CreateDynamicMapIcon(-2173.1907,679.7965,55.1633, 58, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
	        CreateDynamicMapIcon(-1671.8628,1338.5602,7.1875, 60, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
	        CreateDynamicMapIcon(-2374.8813,910.1338,45.4453, 45, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);

	        CreateDynamicMapIcon(-1980.3044,288.4990,35.1719, 55, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
	        CreateDynamicMapIcon(-2491.6021,-197.0443,25.6172, 8, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
	        CreateDynamicMapIcon(-1673.4355,415.6969,7.1797, 51, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
	        CreateDynamicMapIcon(-1704.5774,785.6741,25.2780, 52, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
            SetPlayerSkillLevel(playerid,WEAPONSKILL_PISTOL,0);
	        // =========================================
		}
    }
    if(GetPlayerWantedLevel(playerid) > 0)
    {
        // Want the player
        LS[playerid] = 1;
        SendClientMessage(playerid, COLOR_FREEROAM, "You won't be able to evade");
        SetPlayerInterior(playerid, 0);
        SetPlayerColor(playerid, COLOR_WANTED);
        
        new string[80];
        format(string, sizeof(string), "Anti-Evade: %s has been re-wanted again to level %d !", GetName(playerid), GetPlayerWantedLevel(playerid));
        SendClientMessageToAll(COLOR_POLICE, string);
        SetPlayerPos(playerid, 1727.9077,-1668.2974,22.6094);
        SetPlayerFacingAngle(playerid, 33.4079);
        infreeroam[playerid] = 1;
        SendClientMessage(playerid, COLOR_FREEROAM,"You'll be spawned in Freeroam gamemode (San Fierro)");
        new stringesi[65];
        format(stringesi, sizeof(stringesi), "%s has joined Freeroam gamemode (San Fierro)", GetName(playerid));
        SendClientMessageToAll(COLOR_FREEROAM, stringesi);
        lobby[playerid] = 0;
        CreateDynamicMapIcon(-2625.9368,208.9869,4.6143, 6, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
        CreateDynamicMapIcon(-2664.9614,639.6124,14.4531, 22, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
        CreateDynamicMapIcon(-1593.9250,716.2734,-5.2422, 30, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
        CreateDynamicMapIcon(-1786.8904,1208.3572,25.1250, 8, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
        CreateDynamicMapIcon(-2173.1907,679.7965,55.1633, 58, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
        CreateDynamicMapIcon(-1671.8628,1338.5602,7.1875, 60, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
        CreateDynamicMapIcon(-2374.8813,910.1338,45.4453, 45, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
        CreateDynamicMapIcon(-1980.3044,288.4990,35.1719, 55, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
        CreateDynamicMapIcon(-2491.6021,-197.0443,25.6172, 8, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
        CreateDynamicMapIcon(-1673.4355,415.6969,7.1797, 51, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
        CreateDynamicMapIcon(-1704.5774,785.6741,25.2780, 52, 0, 0, 0, playerid, 100000000.0, MAPICON_LOCAL);
        SetTimerEx("unwant", 480000, false, "i", playerid);
        SendClientMessage(playerid, COLOR_YELLOW, "You'll lose your wanted level after 8 minutes");
        SetPlayerSkillLevel(playerid,WEAPONSKILL_PISTOL,0);
        SetPlayerColor(playerid, COLOR_WANTED);
        // =========================================
}
OnPlayerSpawn. i fixed it before but i don't know what happend now
Reply
#8

If the timer keeps running even if the jail time has ended it means that you do not KillTimer when the time has finished.

So
KillTimer once the jail time has finished or the play was released from the jail. ( if you using a timer ofc.
Reply
#9

Quote:
Originally Posted by LazzyBoy
Посмотреть сообщение
If the timer keeps running even if the jail time has ended it means that you do not KillTimer when the time has finished.

So
KillTimer once the jail time has finished or the play was released from the jail. ( if you using a timer ofc.
I've fixed it here but how about the anti-evade shit
Код HTML:
forward jail(playerid);
public jail(playerid)
{
    AccData[playerid][JailDuration] -= 1;
    if(AccData[playerid][JailDuration] == 0)
    {
        new string[50];
        SendClientMessage(playerid, COLOR_GREEN,"You're free now, go!");
        format(string, sizeof(string), "%s has been unjailed!", GetName(playerid));
        KillTimer(jailtimer[playerid]);
        SendClientMessageToAll(COLOR_FREEROAM, string);
        SetPlayerInterior(playerid,0);
        injail[playerid] = 0;
        if(SF[playerid] == 1)
        {
            SetPlayerPos(playerid,-1604.8895,720.1664,11.8497);
            SetPlayerFacingAngle(playerid,0.2900);
        }
        else if(LS[playerid] == 1)
        {
            SetPlayerPos(playerid,1544.0620,-1675.6432,13.5577);
            SetPlayerFacingAngle(playerid,90.3087);
        }
        else if(LV[playerid] == 1)
        {
            SetPlayerPos(playerid,2286.7761,2423.7617,10.8203);
            SetPlayerFacingAngle(playerid,179.1007);
        }
        
        SetPlayerSpecialAction(playerid,SPECIAL_ACTION_NONE);
        SetPlayerColor(playerid, COLOR_CIVIL);
        SetPlayerWantedLevel(playerid, 0);
        RemovePlayerAttachedObject(playerid, 9);
        AccData[playerid][JailDuration] = -1;
    }
    new s[25];
    format(s, sizeof(s), "Jail Time: %d Seconds", AccData[playerid][JailDuration]);
    GameTextForPlayer(playerid, s, 1000, 3);
    KillTimer(jailtimer[playerid]);
    return 1;
}
Reply
#10

mind if you explain a little bit more about this problem cuz im kinda having troubles finding out the real issues.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)