cengine_client
An instance of this type provides a way to interface with Source 2's Engine-to-Client service.
get_last_timestamp
Method
Returns last timestamp, in seconds.
Arguments
None.
Returns
float
Timestamp, in seconds.
Example
local last_time = game.engine:get_last_timestamp();get_last_server_tick
Method
Returns last server tick number.
Arguments
None.
Returns
int
Server tick number.
Example
local server_tick = game.engine:get_last_server_tick();in_game
Method
Returns whether the client is currently in game.
Arguments
None.
Returns
bool
In-game status.
Example
if game.engine:in_game() then
print("I'm in game!");
endis_connected
Method
Returns whether the client is currently connected to a game server.
Arguments
None.
Returns
bool
true if connected.
Example
if game.engine:is_connected() then
print("I'm connected!");
endget_netchan
Method
Returns the Network Channel used for network communication.
Arguments
None.
Returns
Network channel, or nil if does not exist.
Example
local chan = game.engine:get_netchan();client_cmd
Method
Executes a client-sided console command.
Arguments
cmd
string
Command to execute.
bool
unrestricted
Whether should the execution preserve any restrictions. Defaults to false.
Returns
Nothing.
Example
game.engine:client_cmd('say Hello!');get_screen_size
Method
Returns client window screen size.
Arguments
None.
Returns
int
Width.
int
Height.
Example
local w, h = game.engine:get_screen_size();Last updated