ScriptsAboutBlogToolsKnowledge BaseReviewsFAQBasketDocsSupport
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

Need protected areas on your map?

Viper Safe-Zone draws polygon safe zones in-game — no hand-edited coordinates — with weapon, combat and vehicle-speed rules per zone.

See Viper Safe-Zone →