06.01.2012, 13:14
Hey,
I have this stock function in my script and was wondering how I would make it so that a police officer can use it to arrest the player:
how would I make a command /arrest for the police officer to arrest if there is a suspect near by?
Thanks,
-Dark
I have this stock function in my script and was wondering how I would make it so that a police officer can use it to arrest the player:
pawn Код:
stock GetClosestWantedPlayer(playerid,Float:limit)
{
new Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2;
GetPlayerPos(playerid,x1,y1,z1);
new Float:Range = 999.9;
new id = -1;
foreach(Player,i)
{
if(gTeam[i] == TEAM_CIVIL && GetPlayerWantedLevel(i))
{
if(playerid != i)
{
GetPlayerPos(i,x2,y2,z2);
new Float:Dist = GetDistanceBetweenPoints(x1,y1,z1,x2,y2,z2);
if(floatcmp(Range,Dist) == 1 && floatcmp(limit,Range) == 1)
{
Range = Dist;
id = i;
}
}
}
}
return id;
}
Thanks,
-Dark