Guest User

Untitled

a guest
Oct 25th, 2010
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. public GetClosestArrestable(playerid) {
  2. new Float:fX1,Float:fY1,Float:fZ1,Float:fX2,Float:fY2,Float:fZ2;
  3. new Float:dis,Float:dis2,pID;
  4.  
  5. pID = -1;
  6.  
  7. GetPlayerPos(playerid,fX1,fY1,fZ1);
  8. for (new i=0; i<MAX_PLAYERS; i++){
  9. if(IsPlayerConnected(i) && GetPlayerWantedLevel(i) >= 4 && !IsPlayerInAnyVehicle(i) && !IsPlayerNPC(i)) {
  10. GetPlayerPos(i,fX2,fY2,fZ2);
  11. fX2 = fX2-fX1;
  12. fY2 = fY2-fY1;
  13. fZ2 = fZ2-fZ1;
  14. dis2 = fX2*fX2+fY2*fY2+fZ2*fZ2;
  15. if (pID == -1 || dis > dis2){
  16. pID = i;
  17. dis = dis2;
  18. }
  19. }
  20. }
  21. return pID;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment