IsPlayerInRangeOfCar ?
#1

Anyone have this stock ?

IsPlayerInRangeOfVehicle(playerid, vehicleid, 15.0)
Something like this or
GetVehicleNearPlayer(vehicleid, playerid, distance)
Reply
#2

pawn Код:
stock IsPlayerInRangeOfVehicle(playerid, vehicleid, Float:Range)
{
    new Float:Pos[3];
    GetVehiclePos(vehicleid, Pos[0], Pos[1], Pos[2]);
    return IsPlayerInRangeOfPoint(playerid, Range, Pos[0], Pos[1], Pos[2]);
}
Reply
#3

I think vehicles are synced by a player being in them. So it may not work if nobody is in the vehicle.
Reply
#4

hmmm this is tru
but thanks for the help
Reply
#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


Forum Jump:


Users browsing this thread: 1 Guest(s)