entitylist
get_local_player_pawn
Returns local pawn wrapper or nil.
pawn:get_weapon_name
Returns active weapon name.
pawn:get_weapon_id
Returns active weapon definition index.
pawn:get_bone_position
Returns bone world position as { x = number, y = number, z = number }.
local head = pawn:get_bone_position(7)
if head then
local screen = render.world_to_screen(head.x, head.y, head.z)
end
pawn:get_hitbox_position
Returns hitbox world position as { x = number, y = number, z = number }.
pawn:get_eye_pos
Returns the pawn eye position.
local pawn = entitylist.get_local_player_pawn()
if pawn then
local eye_pos = pawn:get_eye_pos()
if eye_pos then
print(eye_pos.x, eye_pos.y, eye_pos.z)
end
end
pawn:is_scoped
Returns whether the pawn is scoped.
local pawn = entitylist.get_local_player_pawn()
if pawn and pawn:is_scoped() then
print("scoped")
end
pawn:as_ptr
Returns raw FFI pointer.
Entity methods
Every object returned by get_local_player_pawn, get_local_player_controller, get_local_weapon, get, and event:get_controller is an entity address with the methods below. The methods read the entity at that address, so they work the same for pawns, controllers, weapons, and any other entity.
The object is still an FFI pointer: pawn + offset, ffi.cast("int*", pawn + offset) and comparisons with == work as before.
Player state methods called on a controller read its pawn: get_health, get_max_health, get_armor, get_velocity, get_flags, get_eye_angles, and is_enemy. is_alive on a controller uses the controller alive state.
for _, controller in ipairs(entitylist.get("CCSPlayerController")) do
local pawn = controller:get_pawn()
if pawn and pawn:is_alive() and pawn:is_enemy() then
print(pawn:get_health(), pawn:get_armor(), pawn:get_team())
end
end
pawn:is_valid
Returns whether the address still points to a live entity in the entity list.
pawn:get_index
Returns the entity entry index.
pawn:get_handle
Returns the full engine handle.
pawn:get_class_name
Returns the schema class name, for example CCSPlayerController or C_CSPlayerPawn. This is the name accepted by entitylist.get.
pawn:get_designer_name
Returns the entity designer name, for example weapon_ak47.
pawn:get_origin
Returns the absolute origin.
pawn:get_velocity
Returns the velocity.
pawn:get_eye_angles
Returns the eye angles as pitch x, yaw y and roll z.
pawn:get_health
Returns the health.
pawn:get_max_health
Returns the maximum health.
pawn:get_armor
Returns the armor value.
pawn:get_team
Returns the team number: 2 for T, 3 for CT.
pawn:get_flags
Returns the raw entity flags.
pawn:is_alive
Returns whether the entity is alive.
pawn:is_controller
Returns whether the address is a player controller.
pawn:get_pawn
Returns the pawn of a controller. A pawn returns itself.
pawn:is_weapon
Returns whether the address is a weapon.
pawn:is_enemy
Returns whether the player is an opponent of the local player. The local player is never an enemy.
get_local_player_controller
Returns the local controller as an entity address with the entity methods, or nil.
get_local_player_name
Returns local sanitized player name.
get_local_weapon
Returns the local active weapon as an entity address with the entity methods.
get_local_weapon_name
Returns local active weapon name.
get_local_weapon_index
Returns local active weapon definition index.
get
Returns entities by schema class name, the same name pawn:get_class_name() returns, for example CCSPlayerController, C_CSPlayerPawn, C_Inferno, or C_EnvSky. Every entry has the entity methods.