Advertisement
Johurt

[FNC] GetVehicleAroundCoords

Jan 23rd, 2013
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.55 KB | None | 0 0
  1. /*
  2.         Author: Johurt(ES.^, Edgar).
  3.         Date: 23-01-2013.
  4. */
  5. stock GetVehicleAroundCoords(Float:x, Float:y, Float:z, Float:distance = 8.0)
  6. {
  7.     new Float:vDistance = INVALID_PLAYER_ID, Float:nvDistance, vehicleid;
  8.     for(new v; v < MAX_VEHICLES; v++)
  9.     {
  10.         if(GetVehicleModel(v) < 400) continue;
  11.         nvDistance = GetVehicleDistanceFromPoint(v, x, y, z);
  12.         if(nvDistance > distance) continue;
  13.         if(vDistance == INVALID_PLAYER_ID) vDistance = nvDistance;
  14.         if(vDistance > nvDistance) vDistance = nvDistance, vehicleid = v;
  15.     }
  16.     return vehicleid;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement