Script

Functions

running

If a script is running.

---@param name string|integer
function script.running(name): bool

globals

Creates an instance of script_global.

---@param base integer
function script.globals(base): script_global

tunables

Creates an instance of tunables.

---@param name string|integer
function script.tunables(name): tunables

locals

Creates an instance of script_local.

---@param name string|integer
---@param base integer
function script.locals(name, base): script_local

program

Script program memory address retrieved via the script name.

---@param name string|integer
function script.program(name): memory_address

host

Returns a player for the host of the given script.

---@param name string
function script.host(name): player

force_host

Force host of a script.

---@param script string|integer
function script.force_host(script): bool

call

Calls a script function via its function offset.

---@param name string|integer
---@param position integer
---@param args table
function script.call(name, position, args): memory_address

patch

Creates a script patch.

---@param name string|integer
---@param position integer
---@param offset integer
---@param bytes integer[]
function script.patch(name, position, offset, bytes): script_patch

Types

script_global

TypeName
memory_addressaddress
vec2vec2
scr_vec3vec3
integerint8
integerint16
integerint32
integerint64
integeruint8
integeruint16
integeruint32
integeruint64
numberfloat
numberdouble
boolbool
stringstr
---@param index integer
function script_global:at(index): script_global

---@param index integer
---@param size integer
function script_global:at(index, size): script_global

script_local

TypeName
memory_addressaddress
vec2vec2
scr_vec3vec3
integerint8
integerint16
integerint32
integerint64
integeruint8
integeruint16
integeruint32
integeruint64
numberfloat
numberdouble
boolbool
stringstr
---@param index integer
function script_local:at(index): script_local

---@param index integer
---@param size integer
function script_local:at(index, size): script_local

script_patch

TypeName
boolenabled
integer[]original
integer[]patch
function script_patch:enable(): nil
function script_patch:disable(): nil

tunables

TypeName
integerint8
integerint16
integerint32
integerint64
integeruint8
integeruint16
integeruint32
integeruint64
numberfloat
numberdouble
boolbool

Example

function get_owned_property(index, character)
  local result = script.call('freemode', 0xAA7B7, {index, character})
  return result and result.int32 or 0
end

script.globals(2672741):at(3694).bool = true
script.locals('am_mp_drone', 197):at(245).int32 = 0