Players constantly teleported when unjailed
#1

Hi,

When you arrest or admin jail somebody and they are released, they will get constantly teleported back to the release point every minute or so. I cannot find the issue anywhere, and it doesn't fix when they relog either.

Unjail Timer
pawn Code:
public UnjailTimer(playerid)
{
    new string[128];
    if(Player[playerid][JailTime] != 0)
    {
        Player[playerid][JailTime] --;
        format(string, sizeof(string), "You have %d minutes left in Jail.", Player[playerid][JailTime]);
        SendClientMessage(playerid, BLUE, string);
        SaveStats(playerid);
    }
    else
    {
        KillTimer(ArrestTimer[playerid]);
        Player[playerid][JailTime] = 0;
        SetPlayerPos(playerid, 628.9576, -543.6878, 16.3694); // releae point
        SetPlayerInterior(playerid, 0);
        TogglePlayerControllable(playerid, 1);
        SaveStats(playerid);
        SendClientMessage(playerid, WHITE, "You have been released from prison. Be good next time!");
    }
    return 1;
}
Arrest Command
pawn Code:
command(arrest, playerid, params[])
{
    if(Player[playerid][Faction] == 1)
    {
        if(IsPlayerInRangeOfPoint(playerid, 10.0, 221.5584, 121.7303, 999.9156))
        {
            new id, time, string[256];
            if(sscanf(params, "ui", id, time)) return SendClientMessage(playerid, WHITE, "<SERVER> /Arrest [ID/NAME] [TIME(Minutes)]");
            {
                if(time > 60) return SendClientMessage(playerid, WHITE, "The arrest time must be under 61 minutes, for more time go to the prison.");
                if(GetDistanceBetweenPlayers(playerid, id) <= 5.0)
                {
                    ArrestTimer[playerid] = SetTimerEx("UnjailTimer", 60000, 1, "i", id);
                    format(string, sizeof(string), "You have been jailed by %s %s for %i minutes.", GetRankName(playerid), MaskOnOff(playerid), time);
                    SendClientMessage(id, BLUE, string);
                    Player[id][JailTime] = time;
                    SetPlayerPos(id, 264.4176, 77.8930, 1001.0391);
                    SetPlayerInterior(id, 6);
                    format(string, sizeof(string), "You have jailed %s for %i minutes.", MaskOnOff(id), time);
                    SendClientMessage(playerid, WHITE, string);
                }
                else return SendClientMessage(playerid, WHITE, "You must be near the player.");
            }
        }
        else return SendClientMessage(playerid, WHITE, "You aren't at the SC-PD jailing point.");
    }
    else return SendClientMessage(playerid, WHITE, "You aren't a part of the SC-PD.");
    return 1;
}
Reply
#2

pawn Code:
SetTimerEx("UnjailTimer", 60000, 1, "i", id);
to
pawn Code:
SetTimerEx("UnjailTimer", 60000, 0, "i", id);// 60000 is 1 minute and 1 is for repeat put to 0
i mean if you want change the jailtime you have to change the 60000 ms ...

something like

pawn Code:
SetTimerEx("UnjailTimer",time * 60000, 0, "i", id);
also your code will not repeat this timer so you don't need a callback called constaltly
you have to modify some codes and it will look better
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)