if(Civilian[id] == 1)
{
if(Cuffed[id] == 1)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(id,X,Y,Z);
if(IsPlayerInRangeOfPoint(playerid,2.0,X,Y,Z))
{
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;
}
}
}
}
stock PlayerToPlayer(playerid,targetid,Float:distance) { new Float:x, Float:y, Float:z; GetPlayerPos(playerid,x,y,z); if(IsPlayerInRangeOfPoint(targetid,distance,x,y,z)) { return true; } return false; }
if(PlayerToPlayer(playerid, id, 8.0)
{
// Code here
}
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(PlayerToPlayer(playerid, id, 2.0))
{
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;
}
}
}
}
return 1;
}
Oh I saw your mistake.
You're never getting the ID of the other player... you just created the variable "id" but you don't assign any value into it, there for you will always be arresting id 0 |
But this is a different problem not only it dosent check if everyone are near me it also dosent work at all
can you please help me fix this ? Its my first time scripting a command that needs to check if someone i near you |