11.07.2018, 00:50
Quote:
Use sscanf to assign targetid to whatever the user is typing in. Make sure you understand this, also you have a grammar issue in the script in your timer but I haven't changed it.
PHP код:
|
PHP код:
error 017: undefined symbol "IsPlayerNearPlayer"
if (targetid == INVALID_PLAYER_ID || !IsPlayerNearPlayer(playerid, targetid, 6.0))
Quote:
No because it's nothing from the command itself, You should do something like.. An array defined globally that stores the ID of the player getting arrested, so you can use this array instead of "targetid".. Example:
You can create either an array or an enum.. PHP код:
PHP код:
PHP код:
PHP код:
|
PHP код:
CMD:ar(playerid, params[])
{
if(!PoliceTeam(GetPlayerSkin(playerid)) && !SWAT(GetPlayerSkin(playerid)) && !Army(GetPlayerSkin(playerid)) && !FBII(GetPlayerSkin(playerid)) && !CIA(GetPlayerSkin(playerid))) return SendClientMessage(playerid, 0xE74C3CFF, "{FF0000}Error: {FFFFFF}Only Law Enforcement may use this command.");
new pName[MAX_PLAYER_NAME],tName[MAX_PLAYER_NAME],targetid,string[128];
new Float:targetidpos[3];
if(GetPlayerInterior(targetid) > 0) return SendClientMessage(playerid, red, "ERROR: You can't arrest players inside an interior.");
if(sscanf(params, "ui", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /ar <playerid> / <PlayerName>");
if(GetPVarInt(playerid,"ArTime")>GetTickCount())return SendClientMessage(playerid,0xFF0000FF,"Please wait 5 seconds before arresting a suspect again.");
if(PlayerInfo[targetid][pJailed] == 1) return SendClientMessage(playerid, red, "This player is already in jail,you can't arrest him.");
if(IsPlayerInAnyVehicle(targetid)) return SendClientMessage(playerid,red,"You can't arrest players if they're in a vehicle.");
if(GetPlayerWantedLevel(targetid) <= 3) return SendClientMessage(playerid, red, "ERROR: You can't arrest players with wanted level lower than 4.Use /tk to issue a ticket,or press 2.");
if(GetPlayerWantedLevel(targetid) == 0) return SendClientMessage(playerid, red, "This player is not wanted,you can't arrest him");
if(playerid == targetid) return SendClientMessage(playerid,red, "You can't arrest yourself,you stupid or what?");
GetPlayerPos(playerid, targetidpos[0], targetidpos[1], targetidpos[2]);
if (!IsPlayerInRangeOfPoint(playerid, 5.0, targetidpos[0], targetidpos[1], targetidpos[2])) return SendClientMessage(playerid, -1, "Nobody close enough to arrest.");
GetPlayerName(playerid, pName, sizeof(pName));
GetPlayerName(targetid, tName, sizeof(tName));
if(IsPlayerConnected(targetid))
{
if(GetPlayerWantedLevel(targetid) >= 4)
{
SecdonsToJail[targetid] = SetTimerEx("JailPlayer",5000,0,"i",targetid);
TryingArrested[targetid] = 1;
format(string, sizeof(string), "{0080FF}[BEING ARRESTED]: {FFFFFF}S.W.A.T %s(%d) has put {ADFF2F}Handcuffs {FFFFFF}on you.", pName, playerid);
SendClientMessage(targetid, red, string);
ShowDescriptionText(targetid, string);
SetPlayerAttachedObject(targetid, 9, 19418, 6, -0.011000, 0.028000, -0.022000, -15.600012, -33.699977, -81.700035, 0.891999, 1.000000, 1.168000);
SetPlayerSpecialAction(targetid, SPECIAL_ACTION_CUFFED);
format(string, sizeof(string), "~W~AN ~B~F.B.I %s(%d) ~W~HAS CUFFED YOU!!~n~~b~PRESS [/BC] TO ESCAPE FROM THE ~Y~ARREST", pName, playerid);
GameTextForPlayer(targetid, string, 4000, 5);
format(string, sizeof(string), "{33B5FF}[BEGIN ARRESTED!!!] S.W.A.T %s(%d) trying to arrest you!! {33B5FF}Use /BC for escape from this arrested!!", pName, playerid);
SendClientMessage(targetid, red, string);
ShowDescriptionText(playerid, string);
format(string, sizeof(string), "{ffffff}You have placed {0080FF}%s(%d) {FFFFFF}in Handcuffs for an Arrest. Use {0080FF}/search (id) {FFFFFF}to search Him for illegal Drugs.", tName, targetid);
SendClientMessage(playerid, red, string);
ShowDescriptionText(playerid, string);
SetPVarInt(playerid,"ArTime",GetTickCount()+5000);
}
}
return 1;
}