Client · JavaScript & Lua
GTA V natives reference
Every game native LS:MP exposes to client scripts: the same global functions, with the same arguments, in both engines.
5 171
callable from scripts
1 304
blocked
93
checked by LS:MP
209
hand back outputs
Calling a native
JavaScript
const ped = playerPedId();
// a vector comes back as an { x, y, z } object
const { x, y, z } = getEntityCoords(ped, true);
// a return value AND an output: the ground height is handed back, not passed in
const [found, groundZ] = getGroundZFor3dCoord(x, y, z + 1.0, false, false);
// no return value, two outputs
const [width, height] = getActualScreenResolution();Lua
local ped = playerPedId()
-- a vector comes back as a Vector3
local pos = getEntityCoords(ped, true)
-- a return value AND an output: the ground height is handed back, not passed in
local found, groundZ = getGroundZFor3dCoord(pos.x, pos.y, pos.z + 1.0, false, false)
-- no return value, two outputs
local width, height = getActualScreenResolution()- Global functions, camelCase.
SET_ENTITY_COORDSissetEntityCoords, and a leading underscore in the game database changes nothing:getLastEntityHitByEntity. - Handles, not netIds. Natives work on the game’s own handles. Convert an LS:MP
netIdfirst, withlsmp.getEntityFromNetId. - Arguments. A vector is passed as three separate numbers, or as one vector that fills the same three slots:
{ x, y, z }or[x, y, z]in JavaScript, aVector3in Lua. A missing argument counts as0; extra ones are ignored. A hash can be given signed or unsigned;getHashKeyand every native that returns a hash give it unsigned, likelsmp.hash. - Results. A native returns its own value first, then everything the game writes through a pointer: you never pass those. In JavaScript, no result is
undefined, one result is the bare value, two or more are an array, and a vector is an{ x, y, z }object. In Lua, they come back as multiple return values. - Pointers the game reads. A few natives take a handle through a pointer and read it, like
DELETE_PED(Ped* ped). They are writtendeletePed(ped), but the value does not reach the game yet: 21 natives carry a Known issue note. - Checked natives. 93 natives validate their arguments before the game sees them. A value out of range is ignored, without an error: each one lists what it accepts, under Checked by LS:MP.
- Blocked natives. 1 304 natives cannot be called from a script, including every native with an
Any*pointer. Calling one raises an error, and nothing reaches the game. - Availability. 220 names are natives the current game build does not have. The global exists, does nothing and returns
undefinedin JavaScript,nilin Lua; they are marked Not in this build.
The full convention is on the RAGE natives page of the API reference.
Namespaces
The game sorts its natives into families. They are only a way to browse: every native is a plain global, whatever its family.
Built-in25Script VM basics: timers, maths helpers, thread control.App data17Data blocks shared with the game's companion apps.Audio280Sounds, speech, music, radio, audio scenes and scripted conversations.Script brains11Script brains attached to objects, peds and world points.Camera248Scripted cameras, the gameplay camera, shakes, cinematic and hint cameras.Clock16In-game time and date, and the real-world clock.Cutscenes56Loading, playing and controlling cutscenes.Data files57Cloud data files and their dictionary and array structures.Decorators12Typed key/value decorators attached to entities.DLC14Presence and state of downloadable content.Entity189Anything placed in the world: position, rotation, health, attachment, collision, visibility.Events13AI and shocking events: adding, blocking and suppressing them.Shop metadata49Shop items, outfits, tattoos and weapon data declared by DLC metadata.Fire19Script fires and explosions.Graphics403Drawing: markers, lines, sprites, lights, particle effects, scaleform movies, timecycles and screen effects.HUD518Text, help and notifications, blips and the minimap, pause-menu and frontend components.IIS1The initial interactive screen shown when the game starts.Interior45Interiors, rooms and entity sets.Item sets9Script-side collections of entities and other items.Landing page4The game's landing page.Lobby8Legacy lobby state of the game's own multiplayer menu.Localization3Language and region of the game.Misc345Everything without a better home: weather, ground and area checks, maths, hashing, strings, game flow.Mobile phone25The in-game phone prop: position, rotation, scale and camera.Money357The game's online economy: earn and spend records, balances.Net shopping42The game's online catalog, baskets and transactions.Network883The game's own network layer: sessions, players, network ids, entity control, cloud content.Object166Props: creation, doors, pickups, breakable and animated objects.Controls50Player input: reading and disabling control actions, vibration, look inversion.Pathfinding60Road nodes, the navigation mesh and GPS routes.Ped614Characters: creation, appearance, health, groups, relationships, ragdoll, config flags.Physics49Ropes, and the physics state of entities.Player250The local player: wanted level, abilities, targeting, control, model, invincibility.Recording17Rockstar Editor recording control.Replay6Rockstar Editor replay and clip state.Save migration8Transfer of a saved game between platforms and accounts.Script38Game script threads and script events.Security3Tamper protection of script variables.Shape tests11Raycasts and the other world probes.Social Club84Social Club inbox, profanity checks, licence plates and presence.Stats338Player statistics, leaderboards and telemetry.Streaming121Loading assets: models, animation and texture dictionaries, particle assets, IPLs, focus.Tasks313AI tasks: movement, combat, animations, driving, scenarios and sequences.Vehicle774Vehicles: creation, mods, colours, doors, damage, handling flags.Water12Water height, waves and water probes.Weapon123Weapons, ammunition, components and weapon objects.Zones9Map zones and population schedules.
Blocked natives
They fall into these families:
| Family | Natives | Why, and what to do instead |
|---|---|---|
| Rockstar accounts and commerce | 802 | Resources do not touch Rockstar accounts, Social Club data, GTA$ or the game's online shops. Keep your own economy and profiles on your server, with storage. |
| Rockstar online sessions and content | 180 | LS:MP runs its own networking: scripts do not join, host or transition Rockstar sessions, or fetch Rockstar's user content and remote files. |
| Game script threads | 34 | Resources do not start, stop or adopt the game's own compiled scripts. Your code runs as an LS:MP resource. |
| Saves and game flow | 22 | Scripts cannot save, load or restart the game. For persistent data, use storage. |
| Rockstar Editor | 23 | Recording and replay natives are not available to resources. |
| Raw memory and structures | 211 | This native reads or fills a memory structure a script has no way to provide, so it is not callable. For entity lists, use lsmp.getGamePool. For JSON, use lsmp.json. |
| Replaced by the language | 4 | This is a game-side helper your language already covers: bit operators, or number and string conversion. |
| Shared menus and input | 18 | LS:MP manages the shared frontend, text-entry dialog and input layout. Use the LS:MP page and input APIs for resource UI. |
| Managed world state | 10 | LS:MP manages shared weather and restricts direct clock changes. The checked clock setters document their accepted ranges. |
Types
What each type of the game is in JavaScript and in Lua.
| Type | In JavaScript | In Lua | Meaning |
|---|---|---|---|
int | number | integer | A whole number, sent as a 32-bit integer. A fractional part is dropped. |
float | number | number | A 32-bit floating point number. |
BOOL | boolean | boolean | true or false. As an argument, a number is accepted too (0 is false). |
string | string | string | Text (const char* in the game). A string result is never null: a native with nothing to say gives an empty string. |
Vector3 | { x: number, y: number, z: number } | Vector3 | A 3D vector. JavaScript gets a plain { x, y, z } object; Lua gets a real Vector3, with .x .y .z and arithmetic. As an argument, one vector fills three consecutive coordinates. |
Hash | number | integer | A game hash. Natives return it unsigned (0 to 4294967295), the value lsmp.hash gives. As an argument, the signed and unsigned forms of a hash are the same value. |
Entity | number | integer | Game handle of an entity: a ped, a vehicle or an object. Not an LS:MP netId. Convert one with lsmp.getEntityFromNetId. |
Ped | number | integer | Game handle of a ped. Not an LS:MP netId. Convert one with lsmp.getEntityFromNetId. |
Vehicle | number | integer | Game handle of a vehicle. Not an LS:MP netId. Convert one with lsmp.getEntityFromNetId. |
Object | number | integer | Game handle of an object (prop). Not an LS:MP netId. Convert one with lsmp.getEntityFromNetId. |
Player | number | integer | The game's own player index: a local slot, as playerId() returns it. Not an LS:MP playerId. |
Cam | number | integer | Handle of a scripted camera. |
Blip | number | integer | Handle of a map blip. |
Pickup | number | integer | Handle of a pickup. |
Interior | number | integer | Identifier of an interior. |
FireId | number | integer | Handle of a script fire. |
ScrHandle | number | integer | An opaque handle the game hands out. Pass it back unchanged. |
Any | any | any | An untyped value. Pass what the native expects: a number (sent as a 32-bit integer), a boolean or a string. |
Any* | null | nil | An untyped pointer. Scripts cannot supply one. See blocked natives. |
HeadBlend | HeadBlend | table | Fields shapeFirst, shapeSecond, shapeThird, skinFirst, skinSecond, skinThird, shapeMix, skinMix, thirdMix, and Boolean isParent. |
WeaponHudStats | WeaponHudStats | table | Integer fields damage, speed, capacity, accuracy and range. |
EntityList | number[] | integer[] | A dense list of up to 256 game handles. Lua indices start at 1. JavaScript indices start at 0. |
MpOutfit | MpOutfit | table | Arrays componentDrawables and componentTextures each have 12 entries. propDrawables and propTextures each have 9 entries. tattooOverlays contains 3 unsigned hashes. |
MpOutfitRequest | { male?: boolean, index?: number } | table | Outfit metadata request. male defaults to false and index to 0. Indices start at zero. |
ScriptedAnimSlot | ScriptedAnimSlot | table | Named fields for one priority level. See structured animations for the fields and bounds. |
MoveInitialParams | MoveInitialParams | table | Named initial parameters for a movement graph. See structured animations for the fields and defaults. |
The whole reference is also published as a self-describing file: /resources/natives.json.
