14.03.2014, 03:18
So i made a arrest command and i made it that you dont have to use /ar id to arrest someone but just using /ar so the problem is that it always shows that i am too far from the player when i am near him here is my code
pawn Код:
CMD:ar(playerid,params[])
{
new id, string[128], pwl = GetPlayerWantedLevel(id);
if(GetPlayerTeam(playerid) != Cops)
{
SendClientMessage(playerid, COLOR_RED,"Only law enforcement can arrest wanted suspects.");
return 1;
}
if(!IsPlayerConnected(id))
{
format(string,sizeof(string),"The player ID (%d) is not connected to the server. You cannot arrest them.",id);
SendClientMessage(playerid, COLOR_RED,string);
return 1;
}
if(Jailed[id] == 1)
{
SendClientMessage(playerid, COLOR_RED, "You cannot arrest players that are already jailed.");
return 1;
}
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER || GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
{
SendClientMessage(playerid,COLOR_RED,"You cannot arrest a suspect while in a vehicle. Exit the vehicle first.");
return 1;
}
if(GetPlayerState(id) == PLAYER_STATE_DRIVER || GetPlayerState(id) == PLAYER_STATE_PASSENGER)
{
SendClientMessage(playerid,COLOR_RED,"You cannot arrest a suspect they are in a vehicle. Get them to exit the vehicle first.");
return 1;
}
if(Civilian[id] == 1)
{
if(Cuffed[id] == 1)
{
if(GetDistanceBetweenPlayers(playerid, id) <= 2)
{
if(pwl >= 4)
{
GivePlayerMoney(playerid, 3000);
IncreaseScore(playerid, 1);
IncreaseCoprank(playerid, 1);
Jailed[id] = 1;
JailTime[id] = 60;
Cuffed[id] = 0;
SetPlayerInterior(id, 6);
SetPlayerPos(id, 264.29999, 77.4, 1001);
SendClientMessage(id, COLOR_LIGHTBLUE, "**LOS SANTOS PRISON**");
SendClientMessage(id, COLOR_LIGHTBLUE, "[PRISON] You have been sent to prison, you will be out of prison in 60 seconds");
SetPlayerWantedLevel(id, 0);
SetPlayerHealth(id,99999);
SetPlayerSpecialAction(id,SPECIAL_ACTION_NONE);
ResetPlayerWeapons(id);
format(string,sizeof(string),"Police Officer %s(%d) Has arrested wanted suspect %s(%d) and was given $3000 for arresting him.",GetName(playerid),playerid,GetName(id),id);
SendClientMessageToAll(COLOR_ORANGE,string);
return 1;
}
}
else return SendClientMessage(playerid,COLOR_RED,"There is no player near you that you can arrest, please search for cuffed players and make sure to be near them to be able to arrest them.");
}
}
return 1;
}
pawn Код:
else return SendClientMessage(playerid,COLOR_RED,"There is no player near you that you can arrest, please search for cuffed players and make sure to be near them to be able to arrest them.");