game

Methods

get_global_int

Returns the current value of the provided global

function game.get_global_int(global: int): int
-- example usage
local value = game.get_global_int(--[[global]])

set_global_int

Sets the current value of the provided global

function game.set_global_int(global: int, value: int): void
-- example usage
game.set_global_int(--[[global]], --[[value]])

get_global_float

Returns the current value of the provided global

function game.get_global_float(global: int): float
-- example usage
local value = game.get_global_float(--[[global]])

set_global_float

Sets the current value of the provided global

function game.set_global_float(global: int, value: float): void
-- example usage
game.set_global_float(--[[global]], --[[value]])

get_local_int

Returns the current value of the provided local

function game.get_local_int(script_hash: int, local: int): int
-- example usage
local value = game.get_local_int(--[[script_hash]], --[[local]])

set_local_int

Sets the current value of the provided local

function game.set_local_int(script_hash: int, local: int, value: int): void
-- example usage
game.set_local_int(--[[script_hash]], --[[local]], --[[value]])

get_local_float

Returns the current value of the provided local

function game.get_local_float(script_hash: int, local: int): float
-- example usage
local value = game.get_local_float(--[[script_hash]], --[[local]])

set_local_float

Sets the current value of the provided local

function game.set_local_float(script_hash: int, local: int, value: float): void
-- example usage
game.set_local_float(--[[script_hash]], --[[local]], --[[value]])

get_world_peds

Returns an array of world peds as script guids

function game.get_world_peds(): int[]
-- example usage
for i, ped in ipairs(game.get_world_peds()) do
    -- do something with ped
end

get_world_vehicles

Returns an array of world vehicles as script guids

function game.get_world_vehicles(): int[]
-- example usage
for i, vehicle in ipairs(game.get_world_vehicles()) do
    -- do something with vehicle
end

get_world_objects

Returns an array of world objects as script guids

function game.get_world_objects(): int[]
-- example usage
for i, object in ipairs(game.get_world_objects()) do
    -- do something with object
end

get_world_blips

Returns an array of world blips

function game.get_world_blips(): int[]
-- example usage
for i, blip in ipairs(game.get_world_blips()) do
    -- do something with blip
end

get_entity_owner

Returns the player index that owns the provided entity

function game.get_entity_owner(script_guid: int): int
-- example usage
local owner = game.get_entity_owner(--[[script_guid]])

get_gameplay_camera_coords

Returns the gameplay camera's coordinates

function game.get_gameplay_camera_coords(): vec3
-- example usage
local coords = game.get_gameplay_camera_coords()

get_gameplay_camera_up

Returns the gameplay camera's up vector

function game.get_gameplay_camera_up(): vec3
-- example usage
local up_vector = game.get_gameplay_camera_up()

get_gameplay_camera_right

Returns the gameplay camera's right vector

function game.get_gameplay_camera_right(): vec3
-- example usage
local right_vector = game.get_gameplay_camera_right()

get_gameplay_camera_forward

Returns the gameplay camera's right vector

function game.get_gameplay_camera_forward(): vec3
-- example usage
local forward_vector = game.get_gameplay_camera_forward()

world_to_screen

Returns the screen position of the provided world coordinates

function game.world_to_screen(world_coords: vec3): bool, float, float
-- example usage
local on_screen, x, y = game.world_to_screen(--[[world_coords]])