26.09.2012, 20:06
Sorry to bump this, but I have the exact same issue, but weirdly, I'm killing the timer actually...
StartTimer public...
UnjailTimer public...
Код:
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 [playerid/name] [time(minutes)]"); { if(time > 60) return SendClientMessage(playerid, WHITE, "The arrest time can only be from 1 - 60 minutes."); if(GetDistanceBetweenPlayers(playerid, id) <= 5.0) { ArrestTimer[playerid] = SetTimerEx("UnjailTimer", 60000, 1, "i", id); format(string, sizeof(string), "You have been arrested 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 arrested %s for %i minutes.", MaskOnOff(id), time); SendClientMessage(playerid, WHITE, string); } else return SendClientMessage(playerid, WHITE, "You must be near to that player."); } } else return SendClientMessage(playerid, WHITE, "You aren't near the Sheriff Department arresting location."); } else return SendClientMessage(playerid, WHITE, "You aren't in the correct Faction."); return 1; }
Код:
if(Player[playerid][JailTime] >= 1) { ArrestTimer[playerid] = SetTimerEx("UnjailTimer", 60000, 1, "i", playerid); } else { KillTimer(ArrestTimer[playerid]); }
Код:
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 { SetPlayerPos(playerid, 628.9576, -543.6878, 16.3694); SetPlayerInterior(playerid, 0); TogglePlayerControllable(playerid, 1); SendClientMessage(playerid, WHITE, "You have been released from prison. Be good next time!"); KillTimer(ArrestTimer[playerid]); Player[playerid][JailTime] = 0; SaveStats(playerid); } return 1; }