cengine_client

Usage: game.engine:{method}

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

Type
Description

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

Type
Description

int

Server tick number.

Example


in_game

Method

Returns whether the client is currently in game.

Arguments

None.

Returns

Type
Description

bool

In-game status.

Example


is_connected

Method

Returns whether the client is currently connected to a game server.

Arguments

None.

Returns

Type
Description

bool

true if connected.

Example


get_netchan

Method

Returns the Network Channel used for network communication.

Arguments

None.

Returns

Type
Description

Network channel, or nil if does not exist.

Example


client_cmd

Method

Executes a client-sided console command.

Arguments

Name
Type
Description

cmd

string

Command to execute.

bool

unrestricted

Whether should the execution preserve any restrictions. Defaults to false.

Returns

Nothing.

Example


get_screen_size

Method

Returns client window screen size.

Arguments

None.

Returns

Type
Description

int

Width.

int

Height.

Example

Last updated