16.07.2013, 21:45
Hello my arrest comand works just fine but there is one thing that are bugged..
The player get's arrested and placed in a cell but when the time is up he dosnt get out :S just gets stuck on 1 secound
The player get's arrested and placed in a cell but when the time is up he dosnt get out :S just gets stuck on 1 secound
Код:
CMD:arrest(playerid, params[]) { new id, time, fine, faction = PlayerInfo[playerid][pFaction]; if(faction != LSPD) return SCM(playerid, COLOR_LIGHTRED, "Invalid faction."); if(sscanf(params,"udd",id,time,fine)) return SyntaxMSG(playerid, "/arrest [playerid/PartOfName] [time(minutes)] [fine]"); if(!CopDuty{playerid}) return SCM(playerid, COLOR_LIGHTRED, "You must be on duty."); if(!PlayerToPoint(6.0, playerid, 221.5274,114.6393,999.0156)) return SCM(playerid, COLOR_LIGHTRED, "You are not near any cells."); if(!PlayerIsOn(id)) return NotConnectedMSG(playerid); if(!PlayerNearPlayer(3.0, playerid, id)) return NotNearPlayerMSG(playerid); if(fine < 0 || fine > 5000) return SCM(playerid, COLOR_GRAD2, "The fine cannot exceed $5,000 or go under $0."); if(time < 1 || time > 60) return SCM(playerid, COLOR_GRAD2, "The time cannot exceed 60 minutes or 1 minutes."); if(id == playerid) return SCM(playerid, COLOR_LIGHTRED, "You may not arrest yourself."); if(PlayerInfo[id][pJailed] == 2) return SCM(playerid, COLOR_LIGHTRED, "Player is already arrested."); GiveCash(id, -fine); FullResetPlayerWeapons(id); PlayerInfo[id][pJailTime2] = time * 60; PutPlayerInCell(id); PlayerInfo[id][pJailed] = 2; PlayerInfo[id][pArrested] += 1; format(msg, sizeof(msg), "[Arrest] %s %s has just arrested %s for %d minute(s).", GetRankName(playerid), GetNameEx(playerid), GetNameEx(id), time); SCMALL(COLOR_LIGHTRED, msg); format(msg, sizeof(msg), "You've been arrested. Time: %d minute(s), Fine: %d$", time, fine); SCM(id, COLOR_LIGHTRED, msg); SetStringVar(playerid, "ArrestLocation", "Jail"); SetLastArrest(playerid, id, time); return 1; }
Код:
//Checking jail time if(PlayerInfo[i][pJailTime] > 1 && PlayerInfo[i][pJailed] == 1) { PlayerInfo[i][pJailTime]--; format(msg,sizeof(msg),"~p~time left: ~w~%d seconds",PlayerInfo[i][pJailTime]); TextDrawSetString(jail_timeleft[i],msg); ShowTextDraw(i,jail_timeleft[i]); } else if(PlayerInfo[i][pJailTime] == 1 && PlayerInfo[i][pJailed] == 1) { PlayerInfo[i][pJailTime] = 0; PlayerInfo[i][pJailed] = 0; SetPlayerSpawn(i); GameTextForPlayer(i,"~g~Released from jail",5000,1); HideTextDraw(i,jail_timeleft[i]); } //Checking jail time //Checking jail time 2 if(PlayerInfo[i][pJailTime2] > 1) { if(PlayerInfo[i][pJailed] == 2 || PlayerInfo[i][pJailed] == 3) { PlayerInfo[i][pJailTime2]--; } } else if(PlayerInfo[i][pJailTime2] == 12) { if(PlayerInfo[i][pJailed] == 2 || PlayerInfo[i][pJailed] == 3) { PlayerInfo[i][pJailTime2] = 0; PlayerInfo[i][pJailed] = 0; SetPlayerPos(i, 1552.4921,-1675.6072,16.1953); SetInterior(i, 0); GameTextForPlayer(i,"~g~Freedom~n~~w~Try to be a better citizen",5000,1); } }