25.06.2013, 12:17
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
Arrest Command
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;
}
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;
}