Skip to main content

i_client_entity_list

Provides access to all client-side entities in the game world. Source: game/sdk/classes/i_client_entity_list.h:13

Virtual Methods

get_client_networkable
sdk::i_client_networkable
Gets the networkable interface for an entity by indexParameters:
  • index - Entity index (1-64 for players, 0+ for all entities)
Returns: Networkable interfaceVirtual Index: 0
get_client_networkable_from_handle
sdk::i_client_networkable
Gets the networkable interface from an entity handleParameters:
  • handle - Entity handle
Returns: Networkable interfaceVirtual Index: 1
get_client_unknown_from_handle
sdk::i_client_unknown
Gets the unknown interface from an entity handleParameters:
  • handle - Entity handle
Returns: Unknown interfaceVirtual Index: 2
number_of_entities
int
Gets the total number of entitiesParameters:
  • include_non_networkable - Whether to include non-networked entities
Returns: Entity countVirtual Index: 6
int entity_count = g_interfaces.entity_list->number_of_entities(true);
get_highest_entity_index
int
Gets the highest valid entity indexReturns: Maximum entity index in useVirtual Index: 7
int max_index = g_interfaces.entity_list->get_highest_entity_index();
for (int i = 0; i <= max_index; i++) {
    // Iterate entities
}

Template Methods

get_client_entity<T>
T
Gets an entity by index and casts it to the specified typeTemplate Parameter: T - Entity type to cast toParameters:
  • index - Entity index
Returns: Entity pointer of type T
auto player = g_interfaces.entity_list->get_client_entity<c_cs_player*>(5);
if (player && player->is_alive()) {
    // Process player
}
This is a templated wrapper around the private private_get_client_entity method that provides type-safe casting.
get_client_entity_from_handle<T>
T
Gets an entity from a handle and casts it to the specified typeTemplate Parameter: T - Entity type to cast toParameters:
  • handle - Entity handle
Returns: Entity pointer of type T
auto weapon_handle = player->active_weapon();
auto weapon = g_interfaces.entity_list->get_client_entity_from_handle<c_base_combat_weapon*>(weapon_handle);

i_engine_trace

Provides ray tracing and collision detection functionality. Source: game/sdk/classes/i_engine_trace.h:197

Classes and Structures

ray_t

Represents a ray for collision tracing. Source: game/sdk/classes/i_engine_trace.h:11
start
math::vec3
Starting position of the ray (16-byte aligned)
delta
math::vec3
Direction and distance vector (16-byte aligned)
start_offset
math::vec3
Offset from start position (16-byte aligned)
extents
math::vec3
Half-size of bounding box for swept box traces (16-byte aligned)
is_ray
bool
true if this is a ray, false if it’s a swept box
is_swept
bool
true if the ray has non-zero length
Methods:
init
void
Initialize a ray trace from start to endParameters:
  • m_start - Start position
  • m_end - End position
ray_t ray;
ray.init(start_pos, end_pos);

c_game_trace

Contains results from a trace operation. Source: game/sdk/classes/i_engine_trace.h:87 Inherits: c_base_trace
fraction
float
Fraction of trace completed (0.0 to 1.0, where 1.0 = no hit)
fraction_left_solid
float
Fraction when leaving solid space
surface
surface_t
Surface properties of what was hit
hit_group
int
Hitgroup that was hit (head, chest, etc.)
entity
c_base_player*
Entity that was hit
hitbox
int
Hitbox index that was hit
Methods:
did_hit
bool
Checks if the trace hit anythingReturns: true if trace hit something (fraction < 1 or started in solid)
if (trace.did_hit()) {
    // Ray hit something
}
dit_hit_world
bool
Checks if trace hit the world (static geometry)Returns: true if world was hit
did_hit_non_world_entity
bool
Checks if trace hit an entity (not world)Returns: true if entity was hit
is_visible
bool
Checks if trace endpoint is visible (fraction > 0.97)Returns: true if mostly visible

Trace Filters

c_trace_filter Basic trace filter that skips a single entity.
c_trace_filter filter;
filter.skip = local_player;
g_interfaces.engine_trace->trace_ray(ray, MASK_PLAYERSOLID, &filter, &trace);
c_trace_filter_skip_two_entities Skips two entities during trace.
c_trace_filter_skip_two_entities filter(player1, player2);
c_trace_filter_skip_grenades Skips grenade entities during trace. c_trace_filter_whitelist Only hits a specific whitelisted entity.
c_trace_filter_whitelist filter;
filter.whitelist = target_player;

Virtual Methods

get_point_contents
int
Gets the contents mask at a pointParameters:
  • vec_abs_pos - World position to check
  • content_mask - Contents mask filter (default: MASK_ALL)
  • entity - Optional pointer to receive entity at point
Returns: Contents flagsVirtual Index: 0
trace_ray
void
Performs a ray traceParameters:
  • ray - Ray to trace
  • fmask - Contents mask (MASK_PLAYERSOLID, MASK_SHOT, etc.)
  • trace_filter - Filter to skip entities
  • trace - Output trace results
Virtual Index: 5
ray_t ray;
ray.init(start, end);

c_game_trace trace;
c_trace_filter filter;
filter.skip = local_player;

g_interfaces.engine_trace->trace_ray(ray, sdk::MASK_PLAYERSOLID, &filter, &trace);

if (trace.did_hit()) {
    // Process hit
}
clip_ray_to_entity
void
Traces a ray against a specific entityParameters:
  • ray - Ray to trace
  • fmask - Contents mask
  • entity - Specific entity to trace against
  • trace - Output trace results
Virtual Index: 3

iv_engine_client

Main engine client interface providing access to game state, player info, and engine functions. Source: game/sdk/classes/iv_engine_client.h:8

Methods

get_screen_size
void
Gets the screen dimensionsParameters:
  • w - Output width
  • h - Output height
Virtual Index: 5
int width, height;
g_interfaces.engine->get_screen_size(width, height);
get_player_info
bool
Gets player information by indexParameters:
  • index - Player index
  • info - Output player info structure
Returns: true if player info was retrievedVirtual Index: 8
sdk::player_info_t info;
if (g_interfaces.engine->get_player_info(i, &info)) {
    std::string name = info.name;
}
get_local_player
int
Gets the local player’s entity indexReturns: Local player indexVirtual Index: 12
int local_index = g_interfaces.engine->get_local_player();
auto local = g_interfaces.entity_list->get_client_entity<c_cs_player*>(local_index);
get_view_angles
math::vec3&
Gets the current view anglesReturns: Reference to view anglesVirtual Index: 18
set_view_angles
void
Sets the view anglesParameters:
  • ang - New view angles
Virtual Index: 19
math::vec3 angles{0.0f, 90.0f, 0.0f};
g_interfaces.engine->set_view_angles(angles);
get_max_clients
int
Gets the maximum number of clients/playersReturns: Max client count (typically 64)Virtual Index: 20
is_in_game
bool
Checks if currently in a gameReturns: true if in gameVirtual Index: 26
is_connected
bool
Checks if connected to a serverReturns: true if connectedVirtual Index: 27
is_fully_connected
bool
Checks if fully connected (connected, in game, not watching demo)Returns: true if fully connected
if (!g_interfaces.engine->is_fully_connected())
    return;
world_to_screen_matrix
const math::matrix_4x4&
Gets the world-to-screen transformation matrixReturns: 4x4 transformation matrixVirtual Index: 37
const auto& matrix = g_interfaces.engine->world_to_screen_matrix();
// Use for world-to-screen conversions
get_level_name
const char*
Gets the current map name (full path)Returns: Map name stringVirtual Index: 52
get_level_name_short
const char*
Gets the current map name (short version)Returns: Short map nameVirtual Index: 53
execute_client_cmd
void
Executes a client commandParameters:
  • st - Command string
Virtual Index: 108
g_interfaces.engine->execute_client_cmd("say Hello");
client_cmd_unrestricted
void
Executes an unrestricted client command (bypasses some restrictions)Parameters:
  • st - Command string
  • from_console_or_keybind - Whether command is from console/keybind
Virtual Index: 114

i_material_system

Material system interface for texture and material management. Source: game/sdk/classes/i_material_system.h:9

Methods

find_material
sdk::i_material*
Finds a material by nameParameters:
  • name - Material name
  • group_name - Material group (optional)
  • complain - Log error if not found (default: true)
  • complain_prefix - Error message prefix (optional)
Returns: Material pointer or nullptrVirtual Index: 84
auto material = g_interfaces.material_system->find_material("models/player", nullptr);
find_texture
sdk::i_texture*
Finds a texture by nameParameters:
  • name - Texture name
  • group_name - Texture group
  • complain - Log error if not found (default: true)
  • unk - Unknown parameter (default: 1)
Returns: Texture pointer or nullptrVirtual Index: 91
get_render_context
sdk::i_mat_render_ctx*
Gets the material render context for rendering operationsReturns: Render context pointerVirtual Index: 115

Usage Examples

Entity iteration

int max_clients = g_interfaces.engine->get_max_clients();

for (int i = 1; i <= max_clients; i++) {
    auto player = g_interfaces.entity_list->get_client_entity<c_cs_player*>(i);
    
    if (!player || !player->is_alive())
        continue;
        
    // Process player
}

Ray tracing for visibility

ray_t ray;
ray.init(local_player->eye_position(), enemy->eye_position());

c_game_trace trace;
c_trace_filter filter;
filter.skip = local_player;

g_interfaces.engine_trace->trace_ray(ray, sdk::MASK_PLAYERSOLID, &filter, &trace);

if (trace.did_hit() && trace.entity == enemy) {
    // Direct line of sight to enemy
}

Getting player information

int max_clients = g_interfaces.engine->get_max_clients();

for (int i = 1; i <= max_clients; i++) {
    sdk::player_info_t info;
    if (!g_interfaces.engine->get_player_info(i, &info))
        continue;
        
    std::string name = info.name;
    // Use player info
}
Always validate entity pointers before use. Entity indices can be invalid or point to deleted entities.

Build docs developers (and LLMs) love