FiveM Natives Explorer
FiveM natives documented the way they should be — real Lua examples, return values, and the pitfalls that actually trip people up.
68 of 68
GetPlayerPedReturns the ped handle for a given player index. Use PlayerPedId() for the local player instead — it's faster …
GetEntityCoordsReturns the world coordinates (vector3) of any entity — ped, vehicle, or object.
TriggerServerEventFires a registered event on the server from the client. The primary way the client asks the server to do somet…
TriggerClientEventFires a registered event on a client (or all clients) from the server. The server's way to tell clients what h…
RegisterNetEventRegisters an event that can be triggered across the network (client↔server). Required for any event triggered …
PlayerPedIdReturns the ped handle for the local player. The fastest, simplest way to reference the current player's chara…
SetEntityCoordsMoves an entity (ped, vehicle, or object) to specific world coordinates. The standard native for teleporting p…
RegisterCommandRegisters a chat or console command with a handler function. Works on client or server. The standard way to ad…
GetHashKeyConverts a string (model name, weapon name, etc.) into its integer hash, which most natives require. In modern…
CreateVehicleCreates a vehicle of a given model at a position. On modern FiveM, prefer creating networked vehicles server-s…
RequestModelRequests a model to be loaded into memory before you can spawn or use it. Pair with HasModelLoaded in a wait l…
GetEntityHealthReturns the current health of an entity (ped, vehicle). For peds, 0 is dead and ~200 is full by default.
SetEntityHealthSets an entity's health. Common for healing or damaging peds. Use GetEntityMaxHealth to fully heal.
GiveWeaponToPedGives a weapon to a ped, optionally with ammo. Used for loadouts, admin tools, and job equipment.
GetPlayerNameReturns the display name of a player by their ID. On the server, pass the source/player ID.
GetPlayerIdentifiersReturns a table of a player's identifiers (license, steam, discord, ip, etc.). The reliable way to identify a …
GetVehiclePedIsInReturns the vehicle a ped is currently in (or the last vehicle). Returns 0 if none.
DrawText / BeginTextCommandDisplayTextDraws 2D text on screen. Must be called every frame while visible. Modern FiveM uses the BeginTextCommandDispl…
SetVehicleNumberPlateTextSets the license plate text on a vehicle. Used by car shops, garages, and admin tools to give vehicles custom …
TaskWarpPedIntoVehicleInstantly places a ped into a vehicle seat (no walking animation). Common right after spawning a vehicle in ca…
SetPedIntoVehiclePlaces a ped into a vehicle seat. Similar to TaskWarpPedIntoVehicle but as a direct set rather than a task.
GetClosestVehicleFinds the closest vehicle to a set of coordinates within a radius. Used by garages, mechanics, and interaction…
SetEntityInvincibleToggles invincibility (god mode) for an entity. Used for admin tools, safe zones, and cutscenes.
SetPedComponentVariationChanges a ped's clothing/appearance component (torso, legs, etc.). The core native behind clothing and charact…
NetworkGetEntityFromNetworkIdConverts a network ID into a local entity handle, so a networked entity (like a spawned vehicle) can be refere…
DrawMarkerDraws a 3D marker (cylinder, arrow, ring, etc.) in the world. Must be called every frame. The standard way to …
DoesEntityExistChecks whether an entity handle still refers to a real, existing entity. Essential before using any handle tha…
IsControlJustReleasedReturns true on the single frame a control (key/button) is released. The standard way to detect a keypress for…
CreateThread / Citizen.CreateThreadStarts a new coroutine (thread) so code can loop and yield with Wait() without blocking the rest of the resour…
AddEventHandlerAttaches a handler to an event. For LOCAL events (like onResourceStart) use it alone; for NETWORKED events you…
GetCurrentResourceNameReturns the name of the resource the code is running in. Used to filter resource events and to reference your …
SetVehicleModApplies a modification (spoiler, exhaust, wheels, etc.) to a vehicle. The core native behind tuner/mod menus a…
SetEntityHeadingSets which direction an entity faces (0-360 degrees). Used after teleporting or spawning to orient peds and ve…
FreezeEntityPositionFreezes or unfreezes an entity in place. Common during loading, cutscenes, or character creation to stop the p…
RequestAnimDictLoads an animation dictionary so you can play its animations. Pair with HasAnimDictLoaded in a wait loop befor…
TaskPlayAnimPlays an animation on a ped from a loaded dictionary. The core native behind emotes, job actions, and immersio…
ClearPedTasksStops a ped's current tasks/animations, returning them to normal control. Used to cancel emotes and scripted a…
IsPedInAnyVehicleReturns whether a ped is currently in any vehicle. A quick boolean check used constantly in vehicle logic.
GetVehicleClassReturns the class of a vehicle (compacts, SUVs, super, motorcycles, etc.) as a number. Used for class-based ru…
SetVehicleEngineOnTurns a vehicle engine on or off instantly. Used for keys systems, engine toggles, and immobilizing vehicles.
GetDistanceBetweenCoordsReturns the distance between two 3D points. Useful, though #(vec1 - vec2) is cheaper for simple distance check…
StartScreenEffectStarts a screen post-FX effect (drunk, death, focus, etc.). Used for status effects like intoxication, damage,…
AddBlipForCoordAdds a map blip at coordinates. The core native for marking shops, jobs, and points of interest on the map/min…
AddBlipForEntityAttaches a blip to a moving entity (ped/vehicle) so it tracks on the map. Used for dispatch, tracking targets,…
SetNotificationTextEntry / DrawNotificationShows a native GTA notification (the top-left phone-style message). A no-dependency way to notify players, tho…
IsEntityDeadReturns whether an entity (usually a ped) is dead. Used for death/revive systems and validity checks.
SetPedArmourSets a ped's armor value (0-100 by default). Used by armor items, shops, and job loadouts.
GiveWeaponComponentToPedAttaches a component (suppressor, scope, extended mag, tint) to a weapon a ped holds. The native behind weapon…
SetBlipSpriteSets the icon (sprite) used for a blip. Determines whether a blip looks like a shop, garage, gun, etc.
TriggerLatentServerEventLike TriggerServerEvent but sends large data at a rate limit (bytes/sec) to avoid flooding the network. Used f…
SetNuiFocusGives or removes keyboard/mouse focus for a NUI (HTML UI). Essential for any interactive menu built in NUI — w…
SendNUIMessageSends data from Lua to your NUI (HTML/JS) as a JSON message. The main way Lua tells the UI what to show.
RegisterNUICallbackRegisters a Lua handler the NUI (JS) can call via fetch. The way the UI sends actions back to the game (button…
GetGameTimerReturns the milliseconds since the game/server started. Used for cooldowns, timing, and measuring durations.
vector3 / vector4Native vector types for positions (vector3) and positions+heading (vector4). Enable cheap distance math with t…
GetActivePlayers / GetPlayersReturns the list of players — GetActivePlayers on the client (nearby players), GetPlayers on the server (all c…
CancelEventCancels the currently handled event where cancellation is supported (e.g. some game events, entity creation). …
GetEntityModelReturns the model hash of an entity. Used to check what kind of vehicle/ped/object something is.
DeleteEntityRemoves an entity from the world. Used to clean up spawned vehicles, objects, and peds. On networked entities,…
SetRelationshipBetweenGroupsSets how two ped relationship groups treat each other (friendly, hate, etc.). Used to make NPC guards, gangs, …
TaskGoToCoordAnyMeansTells a ped to walk/drive to coordinates by any means. Used for NPC movement in missions and immersion scripts…
SetPedAsNoLongerNeeded / SetEntityAsNoLongerNeededTells the engine it can clean up an entity you no longer control, preventing leaks of spawned peds/vehicles/ob…
GetEntitySpeedReturns an entity's current speed in meters per second. Used for speedometers, speed limits, and speed-based l…
SetPedPropIndexSets a ped prop (hats, glasses, ears, watches). Complements SetPedComponentVariation for accessories.
NetworkGetNetworkIdFromEntityConverts a local entity handle to a network ID that can be sent to the server/other clients. Pairs with Networ…
PlaySoundFrontendPlays a UI/frontend sound (button clicks, alerts, confirmations). Adds audio feedback to menus and interaction…
GetPlayerServerIdReturns the server ID for a local player index. The server ID is the stable number you use in events and serve…
RegisterKeyMappingBinds a command to a key the player can rebind in FiveM settings. The correct, rebindable way to add keybinds …