NOTE: That was made by ColdMurda I believe so I don't take any credit for it.
// This will be the vehicle that will be spawned. Check /inc/consts.h line 618 for vehicle model's.
uint vehicle_model = MODEL_AIRTUG ;
// The coords the vehicle will spawn in.
// For this example it will spawn it +10 away from the current player coords.
float spawn_x, spawn_y, spawn_z;
GET_CHAR_COORDINATES(GetPlayerPed(), &spawn_x, &spawn_y, &spawn_z);
// Wait for the requested model to load. Otherwise it will crash if we try to use CREATE_CAR on the model.
while (!HAS_MODEL_LOADED(vehicle_model)) WAIT(0);
// This makes so the car won't spawn in traffic but it may still spawn parked.
// Actually create the car. Store it in v_spawn.
// The last parameter sets if we want to use collision detection.
// Use false if you want to spawn it exactly where you want it to.
CREATE_CAR(vehicle_model, spawn_x, spawn_y, spawn_z, &v_spawn, true);
SET_CAR_ENGINE_ON(v_spawn, 0, true);
// Sets the vehicle heading
// Not needed for this example as we use usng collision detection to auto place the car.
// Saves the car so it will not disappear.
SET_CAR_VISIBLE(v_spawn, false); // change too true so you may see the car Anon
// First & Second Color
CHANGE_CAR_COLOUR(v_spawn, 135, 0);
// Specular Color
SET_EXTRA_CAR_COLOURS(v_spawn, 135, 0);
// Clean the vehicle.
Ped Pped = GetPlayerPed();
//add an object hash in the first parameter
//X: Pos X, Y: Pos Hieght, Z: Pos Width, Last 3 X Y Z's are Rotation Measurments