Skip to content

engine_client

Methods

is_connected(): bool

Returns if you are connected to a server or not

1
2
if engine_client.is_connected() then
end

is_ingame(): bool

Returns if you are in game or not

1
2
if engine_client.is_ingame() then
end

exec(cmd)

Type Name Description Default
string cmd Command to execute none

Executes console command. If command is a cheat and sv_cheats is set to 0, command won't be executed

1
engine_client.exec('buy scar20; buy ssg08')

get_local_player(): number

Returns local player's entity index or -1 if not connected

1
local me = engine_client.get_local_player()

get_view_angles(): vec3

Returns current view angles

1
local ang = engine_client.get_view_angles()

get_player_for_userid(uid): number

Type Name Description Default
number uid User ID none

Returns entity index for desired uid or -1 if failed

1
local ent = engine_client.get_player_for_userid(event:get_int('userid'))

get_player_info(index): player_info

Type Name Description Default
number index Player index none

Returns player_info of a player or nil if failed

1
local name = engine_client.get_player_info(1).name

run_trace(skip, origin, end): entity, number

Type Name Description Default
number skip Entity ID to skip if hit none
vec3 origin Trace start point none
vec3 end Trace end point none

Performs a ray trace from origin to end and returns entity (if none hit or skip is invalid then nil) and fraction (< 1.0 = hit something, 1.0 = hit nothing)

1
local ent, frac = engine_client.run_trace(engine_client.get_local_player(), point_a, point_b)