GTA IV Native Functions Reference
In LuaModLoader, you can call any native GTA IV function directly by its name in Lua. This reference lists the most common and useful native functions, categorized by feature with copy-paste Lua examples.
π‘ How Calling Natives Works in Lua
In LuaModLoader, you don't need complicated C++ code. You simply call the native by its uppercase name:
-- Example: Get your character and set health to 200
local playerPed = GET_PLAYER_CHAR(GET_PLAYER_ID())
SET_CHAR_HEALTH(playerPed, 200)
π€ Player & Character Functions (CHAR / PED)
Player Identity & Health
| Function |
Parameters |
Description |
GET_PLAYER_ID() |
none |
Returns the local player's ID integer. |
GET_PLAYER_CHAR(playerId) |
playerId |
Returns the Ped handle of the player character. |
SET_CHAR_HEALTH(ped, health) |
ped, health (int) |
Sets health (default: 100 to 200). |
GET_CHAR_HEALTH(ped, pHealth) |
ped |
Returns current health. |
ADD_ARMOUR_TO_CHAR(ped, armour) |
ped, armour (int) |
Adds body armour points (max: 100). |
SET_CHAR_INVINCIBLE(ped, enable) |
ped, bool |
Enables or disables god mode. |
SET_CHAR_NEVER_TARGETTED(ped, enable) |
ped, bool |
Stops enemies from targeting this ped. |
Position & Movement
| Function |
Parameters |
Description |
SET_CHAR_COORDINATES(ped, x, y, z) |
ped, x, y, z |
Teleports character to 3D coordinates. |
SET_CHAR_HEADING(ped, angle) |
ped, angle (float) |
Sets character facing direction (0-360Β°). |
SET_CHAR_VELOCITY(ped, vx, vy, vz) |
ped, vx, vy, vz |
Applies physical velocity vector. |
GET_CHAR_COORDINATES(ped) |
ped |
Gets character position (use with call_native_out). |
Police & Wanted Level
| Function |
Parameters |
Description |
ALTER_WANTED_LEVEL(playerId, stars) |
playerId, stars (0-6) |
Sets police wanted level. |
APPLY_WANTED_LEVEL_CHANGE_NOW(playerId) |
playerId |
Instantly updates police behavior. |
CLEAR_CHAR_LAST_DAMAGE_ENTITY(ped) |
ped |
Resets damage state with police. |
-- Example: Full Heal & Clear Wanted Level
local ped = GET_PLAYER_CHAR(GET_PLAYER_ID())
SET_CHAR_HEALTH(ped, 200)
ADD_ARMOUR_TO_CHAR(ped, 100)
ALTER_WANTED_LEVEL(GET_PLAYER_ID(), 0)
APPLY_WANTED_LEVEL_CHANGE_NOW(GET_PLAYER_ID())
π Vehicle Functions (CAR / VEHICLE)
Spawning & Repairing
| Function |
Parameters |
Description |
CREATE_CAR(modelHash, x, y, z, createdByScript) |
hash, x, y, z, bool |
Spawns a vehicle and returns its handle. |
DELETE_CAR(veh) |
veh |
Deletes a vehicle from the game world. |
FIX_CAR(veh) |
veh |
Fully repairs visual and mechanical vehicle damage. |
SET_CAR_ENGINE_ON(veh, engineOn, silent) |
veh, bool, bool |
Starts or shuts down the vehicle engine. |
WARP_CHAR_INTO_CAR(ped, veh) |
ped, veh |
Teleports character into driver's seat. |
Speed & Handling
| Function |
Parameters |
Description |
GET_CAR_SPEED(veh) |
veh |
Returns vehicle speed in meters per second (m/s). Multiply by 3.6 for km/h. |
SET_CAR_FORWARD_SPEED(veh, speed) |
veh, speed (float) |
Sets forward speed vector in m/s. |
IS_CHAR_IN_ANY_CAR(ped) |
ped |
Returns true if character is in a vehicle. |
GET_CAR_CHAR_IS_USING(ped) |
ped |
Returns handle of vehicle character is currently in. |
-- Example: Repair and Boost Current Vehicle
local ped = GET_PLAYER_CHAR(GET_PLAYER_ID())
if IS_CHAR_IN_ANY_CAR(ped) then
local veh = GET_CAR_CHAR_IS_USING(ped)
FIX_CAR(veh)
SET_CAR_FORWARD_SPEED(veh, 50.0) -- Boost to ~180 km/h
end
π« Weapons & Inventory Functions (WEAPON)
| Function |
Parameters |
Description |
GIVE_WEAPON_TO_CHAR(ped, weaponId, ammo, show) |
ped, weaponId, ammo, bool |
Gives weapon and ammunition. |
REMOVE_ALL_CHAR_WEAPONS(ped) |
ped |
Strips all weapons from character. |
SET_CHAR_ACCURACY(ped, accuracy) |
ped, accuracy (0-100) |
Sets shooting accuracy percentage. |
SET_CHAR_AMMO(ped, weaponId, ammo) |
ped, weaponId, ammo |
Sets ammo count for specific weapon. |
-- Example: Give Desert Eagle (ID 9) and M4 (ID 15) with ammo
local ped = GET_PLAYER_CHAR(GET_PLAYER_ID())
GIVE_WEAPON_TO_CHAR(ped, 9, 100, false)
GIVE_WEAPON_TO_CHAR(ped, 15, 300, true)
π§ AI & Tasks (TASK)
| Function |
Parameters |
Description |
TASK_WANDER_STANDARD(ped) |
ped |
Makes pedestrian wander randomly on foot. |
TASK_COMBAT(ped, targetPed) |
ped, targetPed |
Makes ped attack target character. |
TASK_CAR_DRIVE_WANDER(ped, veh, speed, drivingStyle) |
ped, veh, speed, style |
Makes ped drive around randomly. |
TASK_HANDS_UP(ped, duration) |
ped, duration (ms) |
Makes ped raise hands in surrender. |
CLEAR_CHAR_TASKS(ped) |
ped |
Cancels all current AI actions. |
π World & Environment Functions
| Function |
Parameters |
Description |
SET_TIME_OF_DAY(hours, minutes) |
hours (0-23), minutes (0-59) |
Sets game world time. |
FORCE_WEATHER_NOW(weatherId) |
weatherId (0-7) |
Changes weather immediately. |
ADD_EXPLOSION(x, y, z, type, radius, sound, visual, camShake) |
x, y, z, type, radius, bool, bool, float |
Triggers an explosion in the world. |
DRAW_LIGHT_WITH_RANGE(x, y, z, r, g, b, range, intensity) |
x, y, z, r, g, b, range, intensity |
Renders dynamic point light at coordinates. |
π Blips & Map Markers (BLIP)
| Function |
Parameters |
Description |
ADD_BLIP_FOR_COORD(x, y, z) |
x, y, z |
Creates a map marker at position. |
ADD_BLIP_FOR_CHAR(ped) |
ped |
Attaches a map icon to character. |
ADD_BLIP_FOR_CAR(veh) |
veh |
Attaches a map icon to vehicle. |
CHANGE_BLIP_COLOUR(blip, colorId) |
blip, colorId (0-4) |
Changes marker color (0=White, 1=Red, 2=Green, 3=Blue, 4=Yellow). |
REMOVE_BLIP(blip) |
blip |
Removes map marker. |