08.12.2010, 04:02
Alright to start off I am having a serious problem here everyone... Here's the story
When a cop types /arrest it sets the criminal inside LSPD Jail but the timer dosn't go down if the suspect in the jailcell types /time the Jail Time Left dosn't move it stays the same number , UNLESS THEY RELOG , If they relog.. the timer starts working going down
Now this command /jail is a admin command using the same things , jails them in LSPD etc , the suspect types /time and timer works ... So question is... What is the /arrest command not doing that the /jail command is doing ?
JAIL CODE
ARREST CODE:
When a cop types /arrest it sets the criminal inside LSPD Jail but the timer dosn't go down if the suspect in the jailcell types /time the Jail Time Left dosn't move it stays the same number , UNLESS THEY RELOG , If they relog.. the timer starts working going down
Now this command /jail is a admin command using the same things , jails them in LSPD etc , the suspect types /time and timer works ... So question is... What is the /arrest command not doing that the /jail command is doing ?
JAIL CODE
Code:
if(strcmp(cmd, "/jail", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /jail [playerid/PartOfName] [time(minutes)]"); return 1; } new rand; new playa; new money; playa = ReturnUser(tmp); tmp = strtok(cmdtext, idx); money = strval(tmp); if (PlayerInfo[playerid][pAdmin] >= 2) { if(IsPlayerConnected(playa)) { if(playa != INVALID_PLAYER_ID) { GetPlayerName(playa, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "AdmCmd: %s has sent %s to Jail for %d mins,m trf.", sendername, giveplayer, money); SendClientMessageToAll(COLOR_LIGHTRED, string); ResetPlayerWeapons(playa); WantedPoints[playa] = 0; PlayerInfo[playa][pJailed] = 1; PlayerInfo[playa][pJailTime] = money*60; rand = random(sizeof(PrisonSpawns)); SetPlayerPos(playa, PrisonSpawns[rand][0], PrisonSpawns[rand][1], PrisonSpawns[rand][2]); SetPlayerColor(playa, COLOR_PRISON); SetPlayerSkin(playa, 50); format(string, sizeof(string), "You are jailed for %d minutes. Bail: Unable.", money); SendClientMessage(playa, COLOR_LIGHTBLUE, string); } } } else { SendClientMessage(playerid, COLOR_GRAD1, " You are not authorized to use that command !"); } } return 1; }
Code:
if(strcmp(cmd, "/arrest", true) == 0) { if(IsPlayerConnected(playerid)) { if(IsALawEnforcer(playerid)) { if(OnDuty[playerid] != 1) { SendClientMessage(playerid, COLOR_GREY, " You are not on Duty!"); return 1; } if(IsAtArrestPoint(playerid) > 0) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /arrest [price] [time (minutes)] [bail (0=no 1=yes)] [bailprice]"); return 1; } moneys = strval(tmp); if(moneys < 1 || moneys > 99999) { SendClientMessage(playerid, COLOR_GREY, " Jail Price can't be below $1 or above $99,999 !"); return 1; } tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /arrest [price] [time (minutes)] [bail (0=no 1=yes)] [bailprice]"); return 1; } new time = strval(tmp); if(time < 1 || time > 20) { SendClientMessage(playerid, COLOR_GREY, " Jail Time Minutes can't be below 1 or above 20 (Take the person to prison then) !"); return 1; } tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /arrest [price] [time (minutes)] [bail (0=no 1=yes)] [bailprice]"); return 1; } new bail = strval(tmp); if(bail < 0 || bail > 1) { SendClientMessage(playerid, COLOR_GREY, " Jail Bailing can't be below 0 or above 1 !"); return 1; } tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /arrest [price] [time (minutes)] [bail (0=no 1=yes)] [bailprice]"); return 1; } new bailprice = strval(tmp); if(bailprice < 0 || bailprice > 3000000) { SendClientMessage(playerid, COLOR_GREY, " Jail Bailing can't be below $0 or above $3,000,000 !"); return 1; } new suspect = GetClosestPlayer(playerid); if(IsPlayerConnected(suspect)) { if(GetDistanceBetweenPlayers(playerid,suspect) < 5) { if(IsPlayerNPC(suspect)) { SendClientMessage(playerid, COLOR_GREY, "This command is disabled for usage against a NPC."); return 1; } GetPlayerName(suspect, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); if(WantedLevel[suspect] < 1) { SendClientMessage(playerid, COLOR_GREY, " Player must be at least Wanted Level 1 !"); return 1; } format(string, sizeof(string), "* You arrested %s !", giveplayer); SendClientMessage(playerid, COLOR_LIGHTBLUE, string); ConsumingMoney[suspect] = 1; GivePlayerMoney(suspect, -moneys); PlayerInfo[suspect][pCash] -= moneys; format(string, sizeof(string), "arrested by %s ~n~ for %s", sendername, ConvertToMoney(moneys)); GameTextForPlayer(suspect, string, 5000, 5); ResetPlayerWeapons(suspect); new price = WantedLevel[suspect] * 2000; format(string, sizeof(string), "~w~Running Suspect~r~~n~Captured~n~Bonus~g~%s", ConvertToMoney(price)); GameTextForPlayer(playerid, string, 5000, 1); ConsumingMoney[playerid] = 1; GivePlayerMoney(playerid, price / 2); PlayerInfo[playerid][pCash] += price / 2; PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0); PlayerXbust[suspect] = 0; PlayerYbust[suspect] = 0; PlayerZbust[suspect] = 0; PlayerCarbust[suspect] = 0; PlayerCuffed[suspect] = 0; TogglePlayerControllable(suspect, 1); if(PlayerInfo[playerid][pMember]==1||PlayerInfo[playerid][pLeader]==1) { format(string, sizeof(string), "<< Officer %s arrested suspect %s >>", sendername, giveplayer); OOCNews(COLOR_LIGHTRED, string); } else if(PlayerInfo[playerid][pMember]==2||PlayerInfo[playerid][pLeader]==2) { format(string, sizeof(string), "<< FBI Agent %s arrested suspect %s >>", sendername, giveplayer); OOCNews(COLOR_LIGHTRED, string); } else if(PlayerInfo[playerid][pMember]==3||PlayerInfo[playerid][pLeader]==3) { format(string, sizeof(string), "<< Soldier %s arrested suspect %s >>", sendername, giveplayer); OOCNews(COLOR_LIGHTRED, string); } if(IsAtArrestPoint(playerid)) // LSPD Jail { new rand; WantedPoints[suspect] = 0; PlayerInfo[suspect][pJailed] = 1; PlayerInfo[suspect][pJailTime] = time*60; rand = random(sizeof(PrisonSpawns)); SetPlayerPos(suspect, PrisonSpawns[rand][0], PrisonSpawns[rand][1], PrisonSpawns[rand][2]); SetPlayerColor(suspect, COLOR_PRISON); SetPlayerSkin(suspect, 50); } if(bail == 1) { JailPrice[suspect] = bailprice; format(string, sizeof(string), "You are jailed for %d seconds. Bail: %s.", PlayerInfo[suspect][pJailTime], ConvertToMoney(JailPrice[suspect])); SendClientMessage(suspect, COLOR_LIGHTBLUE, string); } else { JailPrice[suspect] = 0; format(string, sizeof(string), "You are jailed for %d seconds. Bail: Unable.", PlayerInfo[suspect][pJailTime]); SendClientMessage(suspect, COLOR_LIGHTBLUE, string); } PlayerInfo[suspect][pArrested] += 1; SetPlayerFree(suspect,playerid, "Got Arrested"); WantedPoints[suspect] = 0; WantedLevel[suspect] = 0; WantLawyer[suspect] = 1; } } else { SendClientMessage(playerid, COLOR_GREY, " No-one close enough to arrest."); return 1; } } else { SendClientMessage(playerid, COLOR_GREY, " You not at a arrest station !"); return 1; } } } return 1; }