CreateVehicleServerSetter
Docslocal retval = CreateVehicleServerSetter(modelHash, type, x, y, z, heading)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
| Name | Type | Description |
|---|---|---|
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. |
Quick Snippet: Get Coordinatesxyzheading
xyzheadingAdd this command to your client script to retrieve precise locations in-game.
-- Add this to your client.lua. Type /pos in-game to copy coords.
RegisterCommand('pos', function()
local ped = PlayerPedId()
local coords = GetEntityCoords(ped)
local heading = GetEntityHeading(ped)
local output = string.format("vector4(%.2f, %.2f, %.2f, %.2f)", coords.x, coords.y, coords.z, heading)
print(output)
TriggerEvent('chat:addMessage', { args = { '^4[COORD]^0', output } })
end)Quick Snippet: Get Vehicle→ Vehicle
→ VehicleVehicle Models

adder
alpha
blade
ardent
asea
cogcabrioReturns
VehicleReturns a vehicle handle.
Examples
Official
local heli = CreateVehicleServerSetter(`seasparrow`, 'heli', GetEntityCoords(GetPlayerPed(GetPlayers()[1])) + vector3(0, 0, 15), 0.0)
print(GetEntityCoords(heli)) -- should return correct coordinates
