27.08.2009, 23:13
ok my /arrest used to work and now it stopped and i can't figer out why keeps saying
No-one close enough to arrest.
No-one close enough to arrest.
Код:
if(strcmp(cmd, "/arrest", true) == 0) { if(IsPlayerConnected(playerid)) { if(gTeam[playerid] == 2 || IsACop(playerid)) { if(OnDuty[playerid] != 1 && PlayerInfo[playerid][pMember] == 1) { SendClientMessage(playerid, COLOR_GREY, " You are not on Duty!"); return 1; } if(PlayerToPoint(6.0, playerid, 1564.8,-1699.4,28.5) || PlayerToPoint(6.0, playerid, 1561.8,-1652.1,28.5) || PlayerToPoint(6.0, playerid, -1599.9663,676.5963,-5.2422) || PlayerToPoint(6.0, playerid, 618.6803,-543.0460,16.4655) ) { new tmpcar = GetPlayerVehicleID(playerid); if (!IsACopCar(tmpcar) && GetPlayerInterior(playerid) == 0) { SendClientMessage(playerid, COLOR_GREY, " You are not in a cop car!"); 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; } moneys = strvalEx(tmp); if(moneys < 1 || moneys > 99999) { SendClientMessage(playerid, COLOR_GREY, "Jail Price can't be below $1 or above $99999 !"); 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 = strvalEx(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 = strvalEx(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 = strvalEx(tmp); if(bailprice < 0 || bailprice > 3000000) { SendClientMessage(playerid, COLOR_GREY, "Jail Bailing can't be below $0 or above $3000000 !"); return 1; } new suspect = GetClosestPlayer(playerid); if(IsPlayerConnected(suspect)) { if(GetDistanceBetweenPlayers(playerid,suspect) < 5) { 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); GivePlayerMoneyKrayzie(suspect, -moneys); format(string, sizeof(string), "arrested by %s ~n~ for $%d", sendername, moneys); GameTextForPlayer(suspect, string, 5000, 5); ResetPlayerWeapons(suspect); 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), "<< Officer %s arrested suspect %s >>", sendername, giveplayer); OOCNews(COLOR_LIGHTRED, string); } SetPlayerInterior(suspect, 0); SetPlayerVirtualWorld(suspect,0); if (PlayerToCell == 1) // CELL 1 SetPlayerPos(suspect,197.5908,174.7256,1003.0234); else if (PlayerToCell == 2) // CELL 2 SetPlayerPos(suspect,193.0112,176.1760,1003.0234); else if (PlayerToCell == 3) // CELL 3 SetPlayerPos(suspect,199.2090,161.4199,1003.0300); else if (PlayerToCell == 4) { PlayerToCell = 1; // MORE THAN 3 PEOPLE IN JAIL SetPlayerPos(suspect,197.5908,174.7256,1003.0234); // CELL 1 } PlayerToCell++; PlayerInfo[suspect][pJailTime] = time * 60; if(bail == 1) { JailPrice[suspect] = bailprice; format(string, sizeof(string), "You are jailed for %d seconds. Bail: $%d", PlayerInfo[suspect][pJailTime], 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][pJailed] = 1; PlayerInfo[suspect][pArrested] += 1; SetPlayerFree(suspect,playerid, "Busted!"); TogglePlayerControllable(suspect, 1); PlayerCuffed[suspect] = 0; WantedPoints[suspect] = 0; WantedLevel[suspect] = 0; WantLawyer[suspect] = 1; PlayerDragged[suspect] = 0; PlayerDraggedBy[suspect] = 255; SetPlayerToTeamColor(suspect); SetPlayerVirtualWorld(suspect,20); }//distance }//not connected } else { SendClientMessage(playerid, COLOR_GREY, " No-one close enough to arrest."); return 1; } } else { SendClientMessage(playerid, COLOR_GREY, " You are not a Cop / FBI / National Guard !"); return 1; } }//not connected return 1; }