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; }
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; }
PlayerInfo[suspect][pJailTime] = time*60;
new unjailtimer;
KillTimer(unjailtimer);
unjailtimer = SetTimer("SetPlayerUnjail", 1000, 1);
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(PlayerInfo[playerid][pDBanned] == 1) { SendClientMessage(playerid, COLOR_GREY, "** You are Banned From Cop 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 > 20000) { SendClientMessage(playerid, COLOR_GREY, " Jail Price can't be below $1 or above $20000!"); 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 > 5) { SendClientMessage(playerid, COLOR_GREY, " Jail Time Minutes can't be below 1 or above 5 (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 > 2000000) { SendClientMessage(playerid, COLOR_GREY, "** Jail Bailing can't be below $0 or above $2000000!"); return 1; } new suspect = GetClosestPlayer(playerid); if(IsPlayerConnected(suspect)) { if(GetDistanceBetweenPlayers(playerid,suspect) < 5) { GetPlayerName(suspect, giveplayer, sizeof(giveplayer)); 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_WHITE, string); SafeGivePlayerMoney(suspect, -moneys); format(string, sizeof(string), "arrested by %s ~n~ for $%d", sendername, moneys); GameTextForPlayer(suspect, string, 5000, 5); SafeResetPlayerWeapons(suspect); PlayerInfo[suspect][pJailed] = 1; PlayerInfo[suspect][pArrested] += 1; SetPlayerFree(suspect,playerid, "Got Arrested"); TextDrawShowForPlayer(suspect, Textdraw1[suspect]); WantedPoints[suspect] = 0; WantedLevel[suspect] = 0; WantLawyer[suspect] = 1; PlayerCuffed[suspect] = 0; GaveUp[suspect] = 0; new y, m, d; new h,mi,s; getdate(y,m,d); gettime(h,mi,s); format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s Has Arrested %s for %s Seconds. Bail: $%d, Price: $%d",d,m,y,h,mi,s,sendername,giveplayer, PlayerInfo[suspect][pJailTime],JailPrice[suspect],moneys); JailLog(string); KillTimer(cufftimer[suspect]); }//distance }//not connected } } else { SendClientMessage(playerid, COLOR_GREY, "** You are not COP!"); return 1; } }//not connected return 1; }
if(strcmp(cmd, "/time", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pWatch] == 0) return SendClientMessage(playerid,COLOR_GREY," You don`t have a watch you can buy one in the 24/7");
new mtext[20];
new year, month,day;
getdate(year, month, day);
if(month == 1) { mtext = "January"; }
else if(month == 2) { mtext = "February"; }
else if(month == 3) { mtext = "March"; }
else if(month == 4) { mtext = "April"; }
else if(month == 5) { mtext = "May"; }
else if(month == 6) { mtext = "June"; }
else if(month == 7) { mtext = "Juli"; }
else if(month == 8) { mtext = "August"; }
else if(month == 9) { mtext = "September"; }
else if(month == 10) { mtext = "October"; }
else if(month == 11) { mtext = "November"; }
else if(month == 12) { mtext = "December"; }
new hour,minuite,second;
gettime(hour,minuite,second);
FixHour(hour);
hour = shifthour;
if (minuite < 10)
{
if (PlayerInfo[playerid][pJailTime] > 0)
{
format(string, sizeof(string), "~y~%d %s~n~~g~|~w~%d:0%d~g~|~n~~w~Jail Time Left: %d sec", day, mtext, hour, minuite, PlayerInfo[playerid][pJailTime]-10);
}
else
{
format(string, sizeof(string), "~y~%d %s~n~~g~|~w~%d:0%d~g~|", day, mtext, hour, minuite);
}
}
else
{
if (PlayerInfo[playerid][pJailTime] > 0)
{
format(string, sizeof(string), "~y~%d %s~n~~g~|~w~%d:%d~g~|~n~~w~Jail Time Left: %d sec", day, mtext, hour, minuite, PlayerInfo[playerid][pJailTime]-10);
}
else
{
format(string, sizeof(string), "~y~%d %s~n~~g~|~w~%d:%d~g~|", day, mtext, hour, minuite);
}
}
GameTextForPlayer(playerid, string, 5000, 1);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s raises up his hand and looks at his clock.", sendername);
ProxDetector(10.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
if(!IsPlayerInAnyVehicle(playerid))
{
ApplyAnimation(playerid,"COP_AMBIENT","Coplook_watch",4.1,0,0,0,0,0);
}
}
return 1;
}
if(strcmp(cmd, "/time", true) == 0) { if(IsPlayerConnected(playerid)) { new mtext[20]; if(month == 1) { mtext = "January"; } else if(month == 2) { mtext = "February"; } else if(month == 3) { mtext = "March"; } else if(month == 4) { mtext = "April"; } else if(month == 5) { mtext = "May"; } else if(month == 6) { mtext = "June"; } else if(month == 7) { mtext = "July"; } else if(month == 8) { mtext = "August"; } else if(month == 9) { mtext = "September"; } else if(month == 10) { mtext = "October"; } else if(month == 11) { mtext = "November"; } else if(month == 12) { mtext = "December"; } new hour,minuite,second; gettime(hour,minuite,second); if (minuite < 10) { if (PlayerInfo[playerid][pJailTime] > 0) { format(string, sizeof(string), "~y~%d %s~n~~g~|~w~%d:0%d~g~|~n~~w~Jail Time Left: %d sec", day, mtext, hour, minuite, PlayerInfo[playerid][pJailTime]-10); } else { format(string, sizeof(string), "~y~%d %s~n~~g~|~w~%d:0%d~g~|", day, mtext, hour, minuite); } } else { if (PlayerInfo[playerid][pJailTime] > 0) { format(string, sizeof(string), "~y~%d %s~n~~g~|~w~%d:%d~g~|~n~~w~Jail Time Left: %d sec", day, mtext, hour, minuite, PlayerInfo[playerid][pJailTime]-10); } else { format(string, sizeof(string), "~y~%d %s~n~~g~|~w~%d:%d~g~|", day, mtext, hour, minuite); } } GameTextForPlayer(playerid, string, 5000, 1); } return 1; }
Code:
if(strcmp(cmd, "/time", true) == 0) { if(IsPlayerConnected(playerid)) { new mtext[20]; if(month == 1) { mtext = "January"; } else if(month == 2) { mtext = "February"; } else if(month == 3) { mtext = "March"; } else if(month == 4) { mtext = "April"; } else if(month == 5) { mtext = "May"; } else if(month == 6) { mtext = "June"; } else if(month == 7) { mtext = "July"; } else if(month == 8) { mtext = "August"; } else if(month == 9) { mtext = "September"; } else if(month == 10) { mtext = "October"; } else if(month == 11) { mtext = "November"; } else if(month == 12) { mtext = "December"; } new hour,minuite,second; gettime(hour,minuite,second); if (minuite < 10) { if (PlayerInfo[playerid][pJailTime] > 0) { format(string, sizeof(string), "~y~%d %s~n~~g~|~w~%d:0%d~g~|~n~~w~Jail Time Left: %d sec", day, mtext, hour, minuite, PlayerInfo[playerid][pJailTime]-10); } else { format(string, sizeof(string), "~y~%d %s~n~~g~|~w~%d:0%d~g~|", day, mtext, hour, minuite); } } else { if (PlayerInfo[playerid][pJailTime] > 0) { format(string, sizeof(string), "~y~%d %s~n~~g~|~w~%d:%d~g~|~n~~w~Jail Time Left: %d sec", day, mtext, hour, minuite, PlayerInfo[playerid][pJailTime]-10); } else { format(string, sizeof(string), "~y~%d %s~n~~g~|~w~%d:%d~g~|", day, mtext, hour, minuite); } } GameTextForPlayer(playerid, string, 5000, 1); } return 1; } also I check his code , Looks the same just a differant format.. Still same error occurs.... Officer sends the suspect to prison for 1 min... suspect does /time right when he gets in prison it says " Jail Time Left : 50 seconds " And it stays like that.. I have no idea what is causing this problem... , But if the suspect relogs while in jail , once it says "Incomplete Jail Sentenced , Returned to jail " The timer starts working and the time goes down until the suspect is free from jail |
When a officer jails the guy he can do /time and it should show him how much jailtime he has left and then drop down til 0 til his released. The problem here is that when the officer jails him and he does /time the timer will freeze on a special number witch means he needs to relog to get the timer to start working again and he can get released.
|
When a officer jails the guy he can do /time and it should show him how much jailtime he has left and then drop down til 0 til his released. The problem here is that when the officer jails him and he does /time the timer will freeze on a special number witch means he needs to relog to get the timer to start working again and he can get released.
|