08.12.2010, 04:49
edit this code
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(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; }