Natives
nat.NAME(...) calls any game function by its name: types, outputs and the ones that are blocked.
On the client side, nat gives access to the game's own functions (“natives”), by their uppercase name:
local yo = nat.PLAYER_PED_ID()
local p = nat.GET_ENTITY_COORDS(yo, true) -- {x, y, z}
nat.SET_ENTITY_HEADING(yo, 90.0)
The 2053 named natives of the community natives database (natives.json, CC BY 4.0) are available. A name that doesn't exist gives the error nativa desconocida: NAME.
Types
| In the game | Passed as |
|---|---|
| entity (ped, vehicle, object) | the entity object as is (ent), as returned by another native or sixm.crear_peaton |
| vector | { x = 1, y = 2, z = 3 } |
| number, boolean | as is |
| hash | number; for a name, sixm.joaat("NAME") |
| text | string |
Output pointers are not passed: they come back as extra results.
-- Lua: multiple results
local ok, valor = nat.ALGUNA_NATIVA_CON_SALIDA(arg)
// JS: a list [result, output1, ...]
const [ok, valor] = nat.ALGUNA_NATIVA_CON_SALIDA(arg);
Entities
- In Lua, an entity is an opaque value: compare it with
==and pass it to other natives. - In JS, it is a frozen object
{ id, lo, hi }; two entities are the same if they have the sameid. - GTA VI model keys are 64-bit. In JS they arrive as BigInt (
0x...n); natives accept a number or a BigInt.
Blocked
Natives for online, saved games, stats and files are blocked: they give the error nativa bloqueada por seguridad and never reach the game. A resource cannot touch the player's save data or disk.
Be careful
- Natives run in that player's game. What you change (the weather, a ped) is seen only by them, unless the server sends the same event to everyone.
- Some natives' arguments in GTA VI are not confirmed yet: try them carefully and check the log. The bundled resources (
gestos,vaciar,aparecer) leave in comments what has already been tested. - A call that takes long, or a loop without
sixm.esperar, runs into the 2 s limit. - With
nat.CLEAR_PED_TASKS,TASK_*and similar on other players' peds, the change is local: synchronize it with events (this is howgestosdoes it).