How to get near car id?
#2

So what you want to do is... loop through all vehicles to check if the position of said vehicle is in the area of the player, and if it is, set the z-coordinate to +2.00?

PHP код:
#define VEHICLE_MARGINATION            (5)
#define VEHICLE_MARGINATION_DEPTH (2)
enum COORDINATIONS {
  
COORDINATE_BREADTH,
  
COORDINATE_HEIGTH,
  
COORDINATE_DEPTH
}
execution(playerid) {
  new 
virtualWorld GetPlayerVirtualWorld(playerid);
  for(new 
index 0maxIndex GetVehiclePoolSize(); index <= maxIndexindex++) {
    if(
IsValidVehicle(index) && (GetVehicleVirtualWorld(index) == virtualWorld)) {
      
      new 
Float:vehiclePosition[COORDINATIONS];
      
GetVehiclePos(indexvehiclePosition[COORDINATE_BREADTH], vehiclePosition[COORDINATE_HEIGTH], vehiclePosition[COORDINATE_DEPTH]);
      if(
IsPlayerInRangeOfPoint(playeridfloat(VEHICLE_MARGINATION), vehiclePosition[COORDINATE_BREADTH], vehiclePosition[COORDINATE_HEIGTH], vehiclePosition[COORDINATE_DEPTH])) {
        
        new 
Float:pedPosition[COORDINATIONS];
        
GetPlayerPos(playeridpedPosition[COORDINATE_BREADTH], pedPosition[COORDINATE_HEIGTH], pedPosition[COORDINATE_DEPTH]),
        
SetPlayerPos(playeridpedPosition[COORDINATE_BREADTH], pedPosition[COORDINATE_HEIGTH], floatadd(pedPosition[COORDINATE_DEPTH], float(VEHICLE_MARGINATION_DEPTH)));
        
        break;
      }
    }
  }


i'm too lazy to write a description to what's happening, you should be able to figure it out.
Reply


Messages In This Thread
How to get near car id? - by R3SpaWn0 - 03.08.2018, 17:15
Re: How to get near car id? - by DBZdabIt3Bro7 - 03.08.2018, 17:26
Re: How to get near car id? - by R3SpaWn0 - 03.08.2018, 17:28
Re: How to get near car id? - by DBZdabIt3Bro7 - 03.08.2018, 17:29
Re: How to get near car id? - by R3SpaWn0 - 03.08.2018, 19:12

Forum Jump:


Users browsing this thread: 1 Guest(s)