server
CreateVehicle
FiveM server native documentation with a Lua example.
Summary
Creates a vehicle of a given model at a position. On modern FiveM, prefer creating networked vehicles server-side for proper sync and anti-cheat.
Returns
Vehicle (number) — the created vehicle handle.
Parameters
modelHashHashThe vehicle model hash (use GetHashKey or backticks).x, y, zfloatSpawn coordinates.headingfloatSpawn heading (0-360).isNetworkbooleanWhether the vehicle is networked (usually true).netMissionEntitybooleanWhether it's a mission entity.Example
-- SERVER (recommended for networked vehicles)
local hash = `adder`
local veh = CreateVehicle(hash, x, y, z, heading, true, false)Common pitfalls
- Creating vehicles from arbitrary client-sent models is an exploit risk — validate the model server-side.
- Client-side spawning requires the model to be loaded first with RequestModel/HasModelLoaded.
Related natives
Related guides
FiveM scripts done right
Optimized, dual-framework scripts for QBCore and ESX from Viper Development — escrow protected, delivered instantly to your Cfx portal.
Browse Scripts →