SA-MP Forums Archive
I need arrest command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: I need arrest command (/showthread.php?tid=402834)



I need arrest command - Hugoca - 28.12.2012

Hi.I need if player is cop to can arrest player if he is a crime.But i wanna to can arrest it if the crime player is near by cop and if the crime isn't in vehicle.Sorry for my bad english


Re: I need arrest command - Threshold - 28.12.2012

pawn Код:
CMD:ar(playerid, params[])
{
    if(!IsPlayerCop(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "You are not a cop!"); //Player must be a cop to use this command
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            new Float:pposx, Float:pposy, Float:pposz;
            GetPlayerPos(playerid, pposx, pposy, pposz);
            if(IsPlayerInRangeOfPoint(i, 5, pposx, pposy, pposz)) //If they are near the cop's position
            {
                if(GetPlayerWantedLevel(i) > 0) //If the player is wanted/a criminal
                {
                    if(!IsPlayerInAnyVehicle(i)) //If they are not in a vehicle
                    {
                        //Arrest player
                        break;
                    }
                }
            }
        }
    }
    return 1;
}
This is an example code, you must replace IsPlayerCop etc. with your own variables.


Re: I need arrest command - Hugoca - 28.12.2012

Thanks