Native referenceRedMserver

CREATE_VEHICLE_SERVER_SETTER

0x6AE51D4B CFX
FUNCTION SIGNATURE
Vehicle CREATE_VEHICLE_SERVER_SETTER(Hash modelHash, char* type, float x, float y, float z, float heading);
Property Value
Native Name CREATE_VEHICLE_SERVER_SETTER
Hash 0x6AE51D4B
Return Type Vehicle
API Set server
Parameters modelHash (Hash), type (char*), x (float), y (float), z (float), heading (float)

Description: Equivalent to CREATE_VEHICLE, but it uses 'server setter' logic (like the former CREATE_AUTOMOBILE) as a workaround for reliability concerns regarding entity creation RPC.

Unlike CREATE_AUTOMOBILE, this supports other vehicle types as well.

Parameters

  • modelHash (Hash) — The model of vehicle to spawn.
  • type (char*) — The appropriate vehicle type for the model info. Can be one of automobile, bike, boat, heli, plane, submarine, trailer, and (potentially), train. This should be the same type as the type field in vehicles.meta.
  • x (float) — Spawn coordinate X component.
  • y (float) — Spawn coordinate Y component.
  • z (float) — Spawn coordinate Z component.
  • heading (float) — Heading to face towards, in degrees.

Examples

local heli = CreateVehicleServerSetter(`seasparrow`, 'heli', GetEntityCoords(GetPlayerPed(GetPlayers()[1])) + vector3(0, 0, 15), 0.0)
print(GetEntityCoords(heli)) -- should return correct coordinates
Back to CFX