Skip to content

entity_t

local local_player = entity_list.get_local_player()
if local_player ~= nil then
    print(local_player:get_prop("m_iHealth")))
end

Info

In all examples below, ent is an instance of entity_t

general Functions#

Info

Functions in this group can be called on all types of entities

is_valid#

returns if the entity is valid and exists

bool is_valid()


get_address#

returns the entity address for ease of use in ffi.* functions

uint get_address()

Example

print(ent:get_address())

get_class_name#

returns the entity class name (i.e. "CCSPlayer")

string get_class_name()

Example

print(ent:get_class_name())

get_class_id#

returns the entity class id

int get_class_id()

Example

print(ent:get_class_id())

get_steamids#

returns the entitiy steamID3 as a number and steamID64 as a string

int, string get_steamids()

Example

local steamID3, steamID64 = ent:get_steamids()
print(steamID3, steamID64)

get_prop#

returns specified entity prop

any get_prop(<string> prop_name, [optional] <int> array_index)
Fields Description
prop_name
string
networked prop name
array_index
int
[optional] array index to use if the prop is an array

Example

print(ent:get_prop("m_iHealth"))

set_prop#

sets a specified entity prop

void set_prop(<string> prop_name, <any> value, [optional] <int> array_index)
Fields Description
prop_name
string
networked prop name
value
any
value to set the prop to
array_index
any
[optional] array index to use if the prop is an array

Example

ent:set_prop("m_iHealth", 10000)

get_render_origin#

returns the render origin

vec3_t get_render_origin()

Example

print(ent:get_render_origin())

get_render_angles#

returns the render angles

angle_t get_render_angles()

Example

print(ent:get_render_angles())

is_dormant#

if true, new information about this player isnt being networked right now

bool is_dormant()

Example

print(pl:is_dormant())

is_player#

checks whether the entity is a player

bool is_player()

Example

print(ent:is_player())

is_weapon#

checks whether the entity is a weapon

bool is_weapon()

Example

print(ent:is_weapon())

get_name#

- for players: returns their name;
- for weapons: returns the weapon name
- for other entities: returns the class name

string get_name()

Example

print(ent:get_name())

get_index#

returns the entity index

int get_index()

Example

print(ent:get_index())

get_bounds#

returns the relative mins/maxs of the entity

vec3_t, vec3_t get_bounds()

Example

print(unpack(ent:get_bounds()))

player functions#

Warning

Functions in this group can be called only on players
In the following examples pl is a player entity

has_player_flag#

checks whether the specified player flag is set

bool has_player_flag(<e_player_flags> flag)

Example

print(pl:has_player_flag(e_player_flags.ON_GROUND))

get_active_weapon#

returns the current weapon as an entity object or nil on failure

entity_t get_active_weapon()

Example

print(pl:get_active_weapon():get_name())

is_alive#

is breathe?

bool is_alive()

Example

print(pl:is_alive())

get_eye_position#

returns the world coordinates of where your shots come from

vec3_t get_eye_position()

Example

print(pl:get_eye_position())

is_point_visible#

checks if a specified world coordinate is visible

bool is_point_visible(<vec3_t> world_coordinate)

Example

print(pl:is_point_visible(vec3_t(100, 100, 100)))

get_hitbox_pos#

HITBOX POS!!!!!!!

vec3_t get_hitbox_pos(<e_hitboxes> hitbox_id)

Example

print(pl:get_hitbox_pos(e_hitboxes.HEAD))

is_enemy#

what do u think

bool is_enemy()

Example

print(pl:is_enemy())

weapon functions#

Warning

Functions in this group can be called only on weapons
In the following examples wep is a weapon entity

get_weapon_spread#

gets the current weapon spread

float get_weapon_spread()

Example

print(wep:get_weapon_spread())

get_weapon_inaccuracy#

gets the current weapon inaccuracy

float get_weapon_inaccuracy()

Example

print(wep:get_weapon_inaccuracy())

get_weapon_data#

gets the current weapon data

weapon_data_t get_weapon_data()

Example

print(wep:get_weapon_data().console_name)