Game

AddAdvancedMarker

Adds a marker to the world at the given coords. Can be customized a bit more than Game.AddMarker.

Game.AddAdvancedMarker(id, coords, r, g, b, a, rotation)
  • id: number
  • coords: vec3 | vec4
  • r: number
  • g: number
  • b: number
  • a: number

This function has to be called every tick.

example:

while true do
    Wait(0)
    Game.AddAdvancedMarker(1, vec3(10.0, 245.0, 130.0), 255, 255, 255, 255, vec3(0.0, 0.0, 180.0))
end

AddBlip

Creates a new blip and returns its id.

local blip = Game.AddBlip(x, y, z, id, scale, color, enableWaypoint, blipLabel, shortRange)
  • x: number | vec3 | vec4
  • y: number
  • z: number
  • id: number
  • scale: number
  • color: number
  • enableWaypoint: boolean
  • blipLabel: string | nil
  • shortRange: boolean | nil

example:

TODO

AddMarker

Adds a simple GTA:O Marker to the world at the given coords.

Game.AddMarker(x, y, z)
  • x: number | vec3 | vec4
  • y: number | nil
  • z: number | nil

This function has to be called every tick.

example:

TODO

AddRadiusBlip

Creates a new radius blip and returns its id.

Game.AddRadiusBlip(x, y, z, id, scale, color, enableWaypoint, blipLabel, shortRange)
  • x: number
  • y: number
  • z: number
  • id: number
  • scale: number
  • color: number
  • enableWaypoint: boolean
  • blipLabel: string
  • shortRange: boolean

example:

TODO

DeleteVehicle

Checks if the passed entity is a vehicle and deletes it if true.

Game.DeleteVehicle(vehicle)
  • vehicle: number

example:

local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
Game.DeleteVehicle(vehicle)

GetAdvancedForwardField

Calculates the foward field of an entity and with an multiplier.

Game.GetAdvancedForwardField(entity, multiplier)
  • entity: number
  • multiplier: number
⚠️

This function will soon be rewritten. Avoid using it.

GetAdvancedSideFieldFromHeading

Calculates the side field based on a givin heading and returns it with an optional multiplier.

Game.GetAdvancedSideFieldFromHeading(h, side, multiplier)
  • h: number
  • side: string<'left' | 'right'>
  • multiplier: number

example:

local ped = PlayerPedId()
local coords = GetEntityCoords(ped)
 
local sideField = Game.GetAdvancedSideField(GetEntityHeading(ped), 'left', 2)
 
print(coords + vec3(sideField.x, sideField.y, 0))

IsNearCoords

Returns if the given ped is near the target coords based on the rquired distance.

Game.IsNearCoords(ped, targetCoords, distance, reverse)
  • ped: number
  • targetCoords: number
  • distance: number
  • reverse: boolean

example:

if Game.IsNearCoords(PlayerPedId(), vec3(230.0, 345.01, 50.2), 4, false) then
    print('Player is near target coords.')
end

IsNearWater Credits (opens in a new tab)

Checks of the ped is near a water source.

Game.IsNearWater(ped)
  • ped: number
local isNearWater, waterCoords = Game.IsNearWater(PlayerPedId())

PlayAnimation

Plays an animation to the player ped.

Game.PlayAnimation(animDict, animName, flag)
  • animDic: string
  • animName: string
  • flag: number
Game.PlayAnimation('missheistdocksprep1hold_cellphone', 'static', 48)

SpawnObjectAtCoords

Spawns a new object and returns it entity id.

Game.SpawnObjectAtCoords(modelHash, x, y, z, h, isNetwork)
  • modelHash: hash
  • x: number
  • y: number
  • z: number
  • h: number
  • isNetwork: boolean
local object <const> = Game.SpawnObjectAtCoords('prop_security_case_01', GetEntityCoords(PlayerPedId()), true)

SpawnPed

Spawns a new ped and returns its entity id.

Game.SpawnPed(ped, x, y, z, h, freeze, isNetwork)
  • ped: number
  • x: number
  • y: number
  • z: number
  • h: number
  • freeze: boolean
  • isNetwork: boolean
local newPed = Game.SpawnPed('s_m_m_armoured_01', vec3(234.23, 645.1, 23.6), true, false)

SpawnVehicle

Creates a new vehicle and returns its entity id.

Game.SpawnVehicle(name, inVeh, coords)
  • name: string
  • inVeh: boolean
  • coords: vec3 | vec4
Game.SpawnVehicle('stockade', true, vec3(234.1, 544.4, 40.2))