đ§°utils
Last updated
Last updated
utils.console_exec(cmd: string[, ...])
Name | Type | Description |
---|---|---|
Executes a console command. Multiple commands can be combined with ';'. Be careful when passing user input (including usernames) to it.
utils.execute_after(delay: number, callback: function[, ...])
Name | Type | Description |
---|---|---|
Executes the callback after delay seconds, passing the arguments to it.
utils.net_channel():
NetChannel
Returns the NetChannel
struct.
utils.trace_line(from: vector, to: vector[, skip: entity/table/function, mask: number, type: number]):
trace
đ The
skip
argument can either be anentity
object, a table withentity
objects, or a function, like the ShouldHitEntity callback. If you use it as a callback, you can access theentity
andcontents_mask
by adding them to the function arguments. Inside the callback, return true if tracing should not skip the entity, otherwise return false.
Returns a trace
struct containing all the information.
utils.trace_hull(from: vector, to: vector, mins: vector, maxs: vector[, skip: entity/table/function, mask: number, type: number]):
trace
đ The
skip
argument can either be anentity
object, a table withentity
objects, or a function, like the ShouldHitEntity callback. If you use it as a callback, you can access theentity
andcontents_mask
by adding them to the function arguments. Inside the callback, return true if tracing should not skip the entity, otherwise return false.
Returns a trace
struct containing all the information.
utils.trace_bullet(from_entity: entity, from: vector, to: vector[, skip: entity/table/function]):
number
, trace
đ The
skip
argument can either be anentity
object, a table withentity
objects, or a function, like the ShouldHitEntity callback. If you use it as a callback, you can access theentity
andcontents_mask
by adding them to the function arguments. Inside the callback, return true if tracing should not skip the entity, otherwise return false.
Returns the damage
, trace
arguments.
trace
utils.opcode_scan(module: string, signature: string[, offset: number]):
userdata
Returns a pointer to the specified pattern if it was found. Otherwise returns nil
.
utils.create_interface(module: string, interface: string):
userdata
Returns a pointer to the specified interface if it was found. Otherwise returns nil
.
utils.get_netvar_offset(table: string, prop: string):
number
Returns the offset of the specified prop. Can be used to manually navigate to the net prop.
utils.get_vfunc(index: number, ...):
function
Creates and returns a wrapper function that calls a virtual table function on the specified index.
utils.get_vfunc(module: string, interface: string, index: number, ...):
function
Creates and returns a wrapper function that calls a virtual table function from the specified interface on the specified index.
utils.random_int(min: number, max: number):
number
Returns a random integer value.
utils.random_float(min: number, max: number):
number
Returns a random float value.
utils.random_seed(seed: number)
Sets the new random seed.
NetChannel
Access the struct via .net_channel
function
FLOW:
OUTGOING
= 0
FLOW:
INCOMING
= 1
net.time
:
number
Current network time.
net.time_connected
:
number
Connection time in seconds.
net.time_since_last_received
:
number
Time since last received packet in seconds.
net.is_loopback
:
boolean
Returns true
if server is a loopback (local server).
net.is_playback
:
boolean
Returns true
if demo is being played.
net.is_timing_out
:
boolean
Returns true
if client is timing out.
flow
]net.sequence_nr[0]
:
number
net.sequence_nr[1]
:
number
Last sent sequence number.
flow
]net.latency[0]
:
number
net.latency[1]
:
number
Current latency (RTT), more accurate but jittering.
flow
]net.avg_latency[0]
:
number
net.avg_latency[1]
:
number
Average latency in seconds.
flow
]net.loss[0]
:
number
net.loss[1]
:
number
Percentage in the range [0.0, 1.0] of the current packet loss.
flow
]net.choke[0]
:
number
net.choke[1]
:
number
Percentage in the range [0.0, 1.0] of the current packet choke.
flow
]net.packets[0]
:
number
net.packets[1]
:
number
Average amount of packets/sec.
flow
]net.data[0]
:
number
net.data[1]
:
number
Data flow in bytes/sec.
flow
]net.total_packets[0]
:
number
net.total_packets[1]
:
number
Total amount of packets/sec.
flow
]net.total_data[0]
:
number
net.total_data[1]
:
number
Total data flow in bytes/sec.
net:get_server_info():
table
Returns a table containing rate
, name
, address
, frame_time
, and deviation
(or nil on failure).
net:is_valid_packet(flow: number, frame: number):
number
Returns true
if the packet is valid.
net:get_packet_time(flow: number, frame: number):
number
Returns the time when the packet was sent.
net:get_packet_bytes(flow: number, frame: number, group: number):
number
Returns the group size of this packet.
net:get_packet_response_latency(flow: number, frame: number):
number
, number
Returns latency_msecs
, choke
of this packet.
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
cmd
string
The console command(s) to execute
...
Comma-separated arguments to concatenate with cmd
delay
number
Time in seconds to wait before calling callback
callback
function
The Lua function that will be called after the delay
...
Arguments that will be passed to the callback
from
vector
Vector to start tracing from
to
vector
Vector to trace to
skip
entity
, table
, function
Optional. Entity skipping options
mask
number
Optional. Trace mask
type
number
Optional. Trace type [0-3]
0
: Trace everything [Default]
1
: Trace world only
2
: Trace entities only
3
: Trace everything filter props
from
vector
Vector to start tracing from
to
vector
Vector to trace to
mins
vector
Hull mins
maxs
vector
Hull maxs
skip
entity
, table
, function
Optional. Entity skipping options
mask
number
Optional. Trace mask
type
number
Optional. Trace type [0-3]
0
: Trace everything [Default]
1
: Trace world only
2
: Trace entities only
3
: Trace everything filter props
from_entity
entity
Player whose weapon will be used for this trace
from
vector
Vector to start tracing from
to
vector
Vector to trace to
skip
entity
, table
, function
Optional. Entity skipping options. If not passed, the skip entity will be from_entity
start_pos
vector
Start position
end_pos
vector
Final position
plane
table
Surface normal at impact. Contains normal
, dist
, type
, and signbits
values
fraction
number
Percentage in the range [0.0, 1.0]. How far the trace went before hitting something. 1.0
- didn't hit anything
contents
number
Contents on other side of surface hit
disp_flags
number
Displacement flags for marking surfaces with data
all_solid
boolean
Returns true
if the plane is invalid
start_solid
boolean
Returns true
if the initial point was in a solid area
fraction_left_solid
number
Percentage in the range [0.0, 1.0]. How far the trace went before leaving solid. Only valid if we started in solid
surface
table
Surface hit (impact surface). Contains name
, props
, and flags
values
hitgroup
number
0
- generic, non-zero is specific body part
physics_bone
number
Physics bone that was hit by the trace
world_surface_index
number
Index of the msurface2_t, if applicable
entity
entity
Entity that was hit by the trace
hitbox
number
Box that was hit by the trace
did_hit
function
Returns true
if there was any kind of impact at all
did_hit_world
function
Returns true
if the entity
points at the world entity
did_hit_non_world
function
Returns true
if the trace hit something and it wasn't the world
is_visible
function
Returns true
if the final position is visible
module
string
Module name, in which the signature will be scanned.
signature
string
IDA style signature, the wildcard is "?
"
offset
number
Optional offset to apply to the pointer address.
module
string
Module name containing the interface.
interface
string
Interface name.
table
string
Datatable name
prop
string
Prop name
index
number
Virtual table index of the function.
...
FFI C Type definition.
module
string
Module name containing the interface.
interface
string
Interface name.
index
number
Virtual table index of the function.
...
FFI C Type definition.
min
number
Minimum boundary for the random value, included
max
number
Maximum boundary for the random value, included
min
number
Minimum boundary for the random value, included
max
number
Maximum boundary for the random value, included
seed
number
New random seed value
flow
number
Channel (Flow)
frame
number
Sequence number
flow
number
Channel (Flow)
frame
number
Sequence number
flow
number
Channel (Flow)
frame
number
Sequence number
group
number
Group of this packet
flow
number
Channel (Flow)
frame
number
Sequence number