Skip to main content

c_base_player

Base player class providing core player functionality including health, movement, view angles, and visibility checks. Source: game/sdk/classes/c_base_player.h:14 Inherits: c_base_combat_character

Network Variables

health
std::int32_t
Current player health (0-100, can exceed 100 with buffs)Netvar: CBasePlayer::m_iHealth
if (player->health() <= 0) {
    // Player is dead
}
life_state
std::int32_t
Life state of the player (alive, dying, dead)Netvar: CBasePlayer::m_lifeState
tick_base
std::int32_t
Current tick count for the player’s simulationNetvar: CBasePlayer::m_nTickBase
view_offset
math::vec3
Offset from origin to eye positionNetvar: CBasePlayer::m_vecViewOffset[0]
math::vec3 eye_pos = player->vector_origin() + player->view_offset();
view_punch_angle
math::vec3
View punch angles (recoil visual effect)Netvar: CBasePlayer::m_viewPunchAngle
aim_punch_angle
math::vec3
Aim punch angles (actual recoil affecting bullets)Netvar: CBasePlayer::m_aimPunchAngle
math::vec3 recoil_offset = player->aim_punch_angle() * 2.0f;
math::vec3 compensated_angle = view_angle - recoil_offset;
view_model
std::uintptr_t
Handle to the player’s first-person view modelNetvar: CBasePlayer::m_hViewModel[0]
flags
sdk::bit_flag_t<std::int32_t>
Player state flags (on ground, ducking, in water, etc.)Netvar: CBasePlayer::m_fFlags
if (player->flags() & FL_ONGROUND) {
    // Player is on the ground
}
velocity
math::vec3
Current velocity vectorNetvar: CBasePlayer::m_vecVelocity[0]
max_speed
float
Maximum movement speed for the playerNetvar: CBasePlayer::m_flMaxspeed
observer_target
std::uintptr_t
Handle to the entity being spectated (when dead)Netvar: CBasePlayer::m_hObserverTarget
duck_speed
float
Speed of the ducking animationNetvar: CBasePlayer::m_flDuckSpeed
duck_amount
float
Duck animation progress (0.0 = standing, 1.0 = fully ducked)Netvar: CBasePlayer::m_flDuckAmount
last_place_name
char
Name of the last location the player was atNetvar: CBasePlayer::m_szLastPlaceName
fall_velocity
float
Vertical velocity when fallingNetvar: CBasePlayer::m_flFallVelocity

Offsets

current_command
c_user_cmd*&
Reference to the current user command being processedOffset: 0xCD2
button_forced
sdk::int_flag_t&
Forced button flagsOffset: 0xCD1
button_disabled
sdk::int_flag_t&
Disabled button flagsOffset: 0xCD0

Methods

move_type
sdk::int_flag_t&
Returns reference to the player’s movement type flagReturns: Movement type (walk, noclip, ladder, etc.)
pre_think
void
Called before player simulation to update player stateVirtual Index: 318
player->pre_think();
post_think
void
Called after player simulation to finalize player stateVirtual Index: 319
select_item
void
Selects an item/weapon for the playerParameters:
  • item - Item name
  • sub_type - Item sub-type
Virtual Index: 330
set_prediction_random_seed
void (static)
Sets the random seed for predictionParameters:
  • command - User command containing random seed, or nullptr to clear
c_base_player::set_prediction_random_seed(cmd);
set_prediction_player
void (static)
Sets the player entity for predictionParameters:
  • entity - Entity to set as predicted player
c_base_player::set_prediction_player(local_player);
determine_simulation_ticks
int
Determines how many simulation ticks are neededReturns: Number of simulation ticks
adjust_player_timebase
void
Adjusts the player’s timebase for simulationParameters:
  • simulation_ticks - Number of ticks to adjust by
eye_position
math::vec3
Calculates the player’s eye position (camera position)Returns: World position of player’s eyes
math::vec3 camera_pos = player->eye_position();
can_see_player
bool
Performs ray trace to check if this player can see another playerParameters:
  • player - Target player to check visibility to
Returns: true if target player is visible
if (local_player->can_see_player(enemy)) {
    // Enemy is visible, can shoot
}
can_see_player_ignore_walls
bool
Checks if player can see target ignoring walls (only checks if entity is hit)Parameters:
  • player - Target player
  • hitgroup - Hitgroup to check
  • start - Start position
  • end - End position
Returns: true if ray hits the target player

c_cs_player

CS:GO-specific player class with Counter-Strike gameplay features. Source: game/sdk/classes/c_cs_player.h:12 Inherits: c_base_player

Template Methods

get<T>
T&
Generic getter for offset-based valuesParameters:
  • offset - Memory offset from player base
Returns: Reference to value at offset
float& some_value = player->get<float>(0x1234);
set<T>
void
Generic setter for offset-based valuesParameters:
  • offset - Memory offset from player base
  • val - Value to set
player->set<float>(0x1234, 1.0f);

Network Variables

has_defuser
bool
Whether the player has a defuse kitNetvar: CCSPlayer::m_bHasDefuser
gun_game_immunity
bool
Gun game spawn immunity statusNetvar: CCSPlayer::m_bGunGameImmunity
shots_fired
std::int32_t
Number of consecutive shots fired (resets when stopped firing)Netvar: CCSPlayer::m_iShotsFired
int recoil_index = player->shots_fired();
// Use for recoil compensation pattern lookup
eye_angles
math::vec3
Player’s eye angles (where they’re actually looking)Netvar: CCSPlayer::m_angEyeAngles
armor_value
int
Current armor points (0-100)Netvar: CCSPlayer::m_ArmorValue
has_heavy_armor
bool
Whether player has heavy armor equippedNetvar: CCSPlayer::m_bHasHeavyArmor
has_helmet
bool
Whether player has a helmetNetvar: CCSPlayer::m_bHasHelmet
is_scoped
bool
Whether player is scoped with a sniper rifleNetvar: CCSPlayer::m_bIsScoped
lower_body_yaw_target
float
Target yaw for the lower body animationNetvar: CCSPlayer::m_flLowerBodyYawTarget
flash_max_alpha
float
Maximum alpha value for flashbang effectNetvar: CCSPlayer::m_flFlashMaxAlpha
if (player->flash_max_alpha() > 200.0f) {
    // Player is heavily flashed
}
account
std::int32_t
Player’s money/account balanceNetvar: CCSPlayer::m_iAccount
flash_duration
float
Duration of current flashbang effectNetvar: CCSPlayer::m_flFlashDuration
stamina
float
Player stamina levelNetvar: CCSPlayer::m_flStamina

Methods

is_enemy
bool
Checks if another player is an enemyParameters:
  • player - Player to check
Returns: true if the player is an enemy
if (local_player->is_enemy(other_player)) {
    // Other player is on opposite team
}
is_alive
bool
Checks if the player is aliveReturns: true if player is alive
if (!player->is_alive()) {
    continue; // Skip dead players
}
name
std::string
Gets the player’s nameReturns: Player name as string
std::string player_name = player->name();
update_client_side_animation
void
Updates client-side animations for the player
player->update_client_side_animation();
set_local_view_angles
void
Sets the local view angles for the playerParameters:
  • view_angles - New view angles to set
player->set_local_view_angles(math::vec3{0.0f, 90.0f, 0.0f});

Usage Examples

Check player visibility

auto local = g_interfaces.entity_list->get_client_entity<c_cs_player*>(g_interfaces.engine->get_local_player());

for (int i = 1; i <= g_interfaces.engine->get_max_clients(); i++) {
    auto player = g_interfaces.entity_list->get_client_entity<c_cs_player*>(i);
    
    if (!player || !player->is_alive() || player == local)
        continue;
        
    if (!local->is_enemy(player))
        continue;
        
    if (local->can_see_player(player, sdk::hitgroup::HITGROUP_HEAD)) {
        // Can see enemy head
    }
}

Recoil compensation

auto local = /* get local player */;
math::vec3 aim_angle = /* current aim angle */;

math::vec3 punch = local->aim_punch_angle();
math::vec3 compensated = aim_angle - (punch * 2.0f);

local->set_local_view_angles(compensated);

Movement state detection

auto player = /* get player */;

bool on_ground = player->flags() & FL_ONGROUND;
bool ducking = player->flags() & FL_DUCKING;

float speed = player->velocity().length_2d();

if (on_ground && speed < 5.0f && !ducking) {
    // Player is standing still
}
The inheritance chain c_cs_playerc_base_playerc_base_combat_characterc_base_animatingc_base_entity means that c_cs_player has access to all methods and properties from parent classes.

Build docs developers (and LLMs) love