fivemnativesluagta5engine
FiveM Natives Guide — Run GTA V Engine Directly
March 22, 2026
2 min read
5 views
FiveM Natives Guide
Natives are functions that Rockstar has written in the GTA V engine FiveM to expose for developers to use via Lua, JavaScript or C#.
Search Natives
Main website: https://natives.cfx.re
- Search by name
- see namespace, parameters, return type
- There are some examples.
Main Namespace
| Namespace | used for |
|---|---|
| ENTITY | every entity (ped, vehicle, object) |
| PED | Character / NPC |
| VEHICLE | Cars |
| PLAYER | Player |
| CAM | Camera |
| GAMEPLAY | Game system |
| WEAPON | Weapons |
| AUDIO | sound |
| GRAPHICS | visual effects |
Ped Natives
local ped = PlayerPedId() -- Player character
-- Position
local coords = GetEntityCoords(ped)
SetEntityCoords(ped, x, y, z, false, false, false, false)
-- Animation
RequestAnimDict('mp_player_intdrink')
while not HasAnimDictLoaded('mp_player_intdrink') do Citizen.Wait(10) end
TaskPlayAnim(ped, 'mp_player_intdrink', 'loop_bottle', 8.0, -8.0, -1, 1, 0, false, false, false)
-- Health
local hp = GetEntityHealth(ped) -- 100 = dead, 200 = full
SetEntityHealth(ped, 200)
-- Freeze
FreezeEntityPosition(ped, true)
FreezeEntityPosition(ped, false)
-- Visibility
SetEntityVisible(ped, false, false) -- hide
SetEntityVisible(ped, true, false) -- show
-- Invincible
SetEntityInvincible(ped, true)
Vehicle Natives
local vehicle = GetVehiclePedIsIn(ped, false)
-- Speed
local speed = GetEntitySpeed(vehicle) -- m/s
SetVehicleForwardSpeed(vehicle, 30.0) -- eject vehicle
-- Engine
SetVehicleEngineOn(vehicle, true, true, false)
-- Damage
local health = GetVehicleBodyHealth(vehicle) -- 0-1000
SetVehicleBodyHealth(vehicle, 1000.0) -- Body repair
SetVehicleFixed(vehicle) -- Fix everything.
-- Fuel (if using fuel script)
local fuel = GetVehicleFuelLevel(vehicle)
SetVehicleFuelLevel(vehicle, 100.0)
-- Plate
local plate = GetVehicleNumberPlateText(vehicle)
SetVehicleNumberPlateText(vehicle, 'MDEV001')
-- Spawn vehicle
local model = GetHashKey('adder')
RequestModel(model)
while not HasModelLoaded(model) do Citizen.Wait(10) end
local newVeh = CreateVehicle(model, x, y, z, heading, true, false)
SetModelAsNoLongerNeeded(model)
Control Natives (Input)
-- IsControlJustReleased(pad, control)
-- pad: 0 = keyboard/mouse, 2 = gamepad
-- Common controls
-- 38 = E
-- 47 = G
-- 74 = H
-- 23 = F (enter vehicle)
-- 24 = Sprint (Left Shift)
-- 22 = Jump (Space)
if IsControlJustReleased(0, 38) then -- E pressed
-- do something
end
if IsControlPressed(0, 24) then -- Shift held
-- sprinting
end
Drawing Natives
-- Draw text on screen
function DrawText3D(x, y, z, text)
local onScreen, _x, _y = World3dToScreen2d(x, y, z)
if onScreen then
SetTextScale(0.35, 0.35)
SetTextFont(4)
SetTextColour(255, 255, 255, 215)
SetTextOutline()
BeginTextCommandDisplayText('STRING')
AddTextComponentSubstringPlayerName(text)
EndTextCommandDisplayText(_x, _y)
end
end
-- Draw marker
DrawMarker(
1, -- type (1 = arrow down)
x, y, z, -- position
0, 0, 0, -- direction
0, 0, 0, -- rotation
1.0, 1.0, 1.0, -- scale
255, 165, 0, 100, -- RGBA
false, false, 2, false, nil, nil, false
)
Blip Natives
-- create blip
local blip = AddBlipForCoord(x, y, z)
SetBlipSprite(blip, 1)
SetBlipColour(blip, 2)
SetBlipScale(blip, 0.8)
SetBlipAsShortRange(blip, true)
BeginTextCommandSetBlipName('STRING')
AddTextComponentSubstringPlayerName('Blip Name')
EndTextCommandSetBlipName(blip)
-- delete blip
RemoveBlip(blip)
Summary
Natives are the real power of FiveM development. The more you know about natives, the more you can create. Bookmark natives.cfx.re.
Related Articles
Breaking: GTA Online อัพเดท "Money Fronts" — FiveM Server Owners ต้องทำอะไร?
Rockstar ปล่อย GTA Online อัพเดท Money Fronts มีผลกระทบต่อ FiveM servers บางส่วน นี่คือสิ่งที่ต้องทำทันทีหลังอัพเดท
Community Spotlight: Script และ Projects ที่น่าสนใจจาก FiveM Community
รวม scripts, tools และ projects ที่โดดเด่นจาก FiveM community ในช่วงที่ผ่านมา ตั้งแต่ free resources ถึง open-source projects
txAdmin อัพเดทใหม่ — Dashboard, Diagnostics และ Ban System ที่ดีขึ้น
txAdmin ซึ่งตอนนี้เป็นส่วนหนึ่งของ Cfx.re อย่างเป็นทางการ ได้รับการอัพเดทครั้งใหญ่ มี features ใหม่ที่ทำให้ Server Management ง่ายขึ้นมาก