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