IsPlayerInRangeOfCar ?
#5

Quote:
Originally Posted by Backwardsman97
Посмотреть сообщение
I think vehicles are synced by a player being in them. So it may not work if nobody is in the vehicle.
This changed with 0.3, so vehicles are now synced at all times.
Damn you don't play SA:MP anymore? XD

pawn Код:
stock GetClosestVehicle(playerid, &Float:dis = (Float:0x7F800000))
{
  dis = (Float:0x7F800000);
  new Float:X, Float:Y, Float:Z;
  if(GetPlayerPos(playerid, X, Y, Z)) {
    new vehicleid = INVALID_VEHICLE_ID;
    for(new v, Float:temp, Float:VX, Float:VY, Float:VZ; v != MAX_VEHICLES; v++) {
      if(GetVehiclePos(v, VX, VY, VZ)) {
        VX -= X, VY -= Y, VZ -= Z;
        temp = VX * VX + VY * VY + VZ * VZ;
        if(temp < dis) dis = temp, vehicleid = v;
      }
    }
    dis = floatpower(dis, 0.5);
    return vehicleid;
  }
  return INVALID_VEHICLE_ID;
}
I did not create this
Reply


Messages In This Thread
IsPlayerInRangeOfCar ? - by Ricop522 - 02.06.2011, 02:57
Re: IsPlayerInRangeOfCar ? - by CyNiC - 02.06.2011, 03:19
Re: IsPlayerInRangeOfCar ? - by Backwardsman97 - 02.06.2011, 03:28
Re: IsPlayerInRangeOfCar ? - by Ricop522 - 02.06.2011, 03:34
Re: IsPlayerInRangeOfCar ? - by Mike Garber - 02.06.2011, 08:16

Forum Jump:


Users browsing this thread: 1 Guest(s)