Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public GetClosestArrestable(playerid) {
- new Float:fX1,Float:fY1,Float:fZ1,Float:fX2,Float:fY2,Float:fZ2;
- new Float:dis,Float:dis2,pID;
- pID = -1;
- GetPlayerPos(playerid,fX1,fY1,fZ1);
- for (new i=0; i<MAX_PLAYERS; i++){
- if(IsPlayerConnected(i) && GetPlayerWantedLevel(i) >= 4 && !IsPlayerInAnyVehicle(i) && !IsPlayerNPC(i)) {
- GetPlayerPos(i,fX2,fY2,fZ2);
- fX2 = fX2-fX1;
- fY2 = fY2-fY1;
- fZ2 = fZ2-fZ1;
- dis2 = fX2*fX2+fY2*fY2+fZ2*fZ2;
- if (pID == -1 || dis > dis2){
- pID = i;
- dis = dis2;
- }
- }
- }
- return pID;
- }
Advertisement
Add Comment
Please, Sign In to add comment