Advertisement
Guest User

Untitled

a guest
Oct 8th, 2011
406
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. stock GetClosestVehicle(playerid, Float: fRadius) // by RyDeR`
  2. {
  3. new
  4. iClosestID = INVALID_VEHICLE_ID,
  5. Float: fFinalDistance,
  6. Float: fDistance,
  7. Float: fX,
  8. Float: fY,
  9. Float: fZ;
  10. GetPlayerPos(playerid, fX, fY, fZ);
  11. fFinalDistance = fRadius;
  12.  
  13. for(new i; i != MAX_VEHICLES; i++)
  14. {
  15. if((fDistance = GetVehicleDistanceFromPoint(i, fX, fY, fZ)) < fFinalDistance)
  16. {
  17. fFinalDistance = fDistance;
  18. iClosestID = i;
  19. }
  20. }
  21. return iClosestID;
  22. }
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement