Appearance
Script
Reference for the script API.
Functions
script.running
If a script is running.
lua
---@param name string|integer
function script.running(name): boolscript.globals
Creates an instance of script_global.
lua
---@param base integer
function script.globals(base): script_globalscript.tunables
Creates an instance of tunables.
lua
---@param name string|integer
function script.tunables(name): tunablesscript.locals
Creates an instance of script_local.
lua
---@param name string|integer
---@param base integer
function script.locals(name, base): script_localscript.program
Script program memory address retrieved via the script name.
lua
---@param name string|integer
function script.program(name): memory_addressscript.host
Returns a player for the host of the given script.
lua
---@param name string
function script.host(name): playerscript.force_host
Force host of a script.
lua
---@param script string|integer
function script.force_host(script): boolscript.call
Calls a script function via its function offset.
lua
---@param name string|integer
---@param position integer
---@param args table
function script.call(name, position, args): memory_addressscript.patch
Creates a script patch.
lua
---@param name string|integer
---@param position integer
---@param offset integer
---@param bytes integer[]
function script.patch(name, position, offset, bytes): script_patchscript.execute_as
Run a callback as a script.
lua
---@param name string|integer
---@param callback function
function script.execute_as(name, callback): nilTypes
script_global
| Field | Type |
|---|---|
address | memory_address |
vec2 | vec2 |
vec3 | scr_vec3 |
int8 | integer |
int16 | integer |
int32 | integer |
int64 | integer |
uint8 | integer |
uint16 | integer |
uint32 | integer |
uint64 | integer |
float | number |
double | number |
bool | bool |
str | string |
lua
---@param index integer
function script_global:at(index): script_global
---@param index integer
---@param size integer
function script_global:at(index, size): script_globalscript_local
| Field | Type |
|---|---|
address | memory_address |
vec2 | vec2 |
vec3 | scr_vec3 |
int8 | integer |
int16 | integer |
int32 | integer |
int64 | integer |
uint8 | integer |
uint16 | integer |
uint32 | integer |
uint64 | integer |
float | number |
double | number |
bool | bool |
str | string |
lua
---@param index integer
function script_local:at(index): script_local
---@param index integer
---@param size integer
function script_local:at(index, size): script_localscript_patch
| Field | Type |
|---|---|
enabled | bool |
original | integer[] |
patch | integer[] |
lua
function script_patch:enable(): nil
function script_patch:disable(): niltunables
| Field | Type |
|---|---|
int8 | integer |
int16 | integer |
int32 | integer |
int64 | integer |
uint8 | integer |
uint16 | integer |
uint32 | integer |
uint64 | integer |
float | number |
double | number |
bool | bool |
Examples
lua
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