engine
get_local_player
engine.get_local_player() -> number
Returns the local player's entity index.
Usage
local index = engine.get_local_player();
get_player_for_user_id
engine.get_player_for_user_id(user_id: number) -> number
Returns the entity index of a player.
Parameters
| Name | Type | Description |
|---|---|---|
user_id |
number | Player's user_id |
Usage
engine.get_player_for_user_id(event:get_int('userid'));
get_player_info
engine.get_player_info(index: number) -> player_info
Returns a player's player_info.
Parameters
| Name | Type | Description |
|---|---|---|
index |
number | Entity index |
Usage
local player_info = engine.get_player_info(engine.get_local_player());
print(player_info.steam_id);
get_view_angles
engine.get_view_angles() -> number, number, number
Returns local player's visual view angle.
Usage
local x, y, z = engine.get_view_angles();
set_view_angles
engine.set_view_angles(pitch: number, yaw: number)
Sets local player's visual view angle.
Parameters
| Name | Type | Description |
|---|---|---|
pitch |
number | Pitch value |
yaw |
number | Yaw value |
Usage
engine.set_view_angles(13, 37);
is_in_game
engine.is_in_game() -> bool
Returns true if you are currently in game.
Usage
if engine.is_in_game() then
-- do stuff
end
exec
engine.exec(cmd: string)
Executes a given console command.
Warning
This function checks if a command is unsafe to execute. Enable SCRIPTS > General > Allow insecure to allow execution of some blocked commands.
Parameters
| Name | Type | Description |
|---|---|---|
cmd |
string | Command(s) to execute |
Usage
engine.exec('say hello from engine cmd');