đžentity
Functions:
get
entity.get(idx: number[, by_userid: boolean]):
entity
Name | Type | Description |
---|---|---|
idx |
| Index of the entity |
by_userid |
| If |
Returns a pointer to the specified entity.
get_local_player
entity.get_local_player():
entity
Returns a pointer to the local player.
get_players
entity.get_players([enemies_only: boolean, include_dormant: boolean, callback: function]):
table
Name | Type | Description |
---|---|---|
enemies_only |
| If |
include_dormant |
| If |
callback |
| A callback with an entity pointer as the argument |
If the callback is nil, it returns the table of pointers to player entities. Otherwise the callback will be called. Access the player pointer using the arguments of the specified callback.
get_entities
entity.get_entities([class: number/string, include_dormant: boolean, callback: function]):
table
Name | Type | Description |
---|---|---|
class |
| Either a name or an ID of the needed class. Pass |
include_dormant |
| If |
callback |
| A callback with an entity pointer as the argument |
If the callback is nil, it returns the table of pointers to entities. Otherwise the callback will be called. Access the entity pointer using the arguments of the specified callback.
get_threat
entity.get_threat([ hittable: boolean ]):
entity
Name | Type | Description |
---|---|---|
hittable |
| If |
Returns a pointer to the current threat.
get_game_rules
entity.get_game_rules():
entity
Returns the pointer to the CCSGameRulesProxy instance, or nil if none exists.
get_player_resource
entity.get_player_resource():
entity
Returns the pointer to the CCSPlayerResource instance, or nil if none exists.
Netprops
Getting FFI pointer
ent[0]
:
userdata
Returns the ffi
pointer to the entity.
Getting netprop values
ent.prop_name:
any
ent.prop_name[index]:
any
ent["prop_name"]:
any
Name | Type | Description |
---|---|---|
prop_name |
| Name of the networked property |
index |
| Optional. If |
Setting netprop values
ent.prop_name = value
ent.prop_name[index] = value
ent["prop_name"] = value
Name | Type | Description |
---|---|---|
prop_name |
| Name of the networked property |
value |
| The property will be set to this value |
index |
| Optional. If |
Common
:is_player
ent:is_player():
boolean
Returns true
if the entity is a player entity.
:is_weapon
ent:is_weapon():
boolean
Returns true
if the entity is a weapon entity.
:is_dormant
ent:is_dormant():
boolean
Returns true
if the entity is dormant.
:is_bot
ent:is_bot():
boolean
Returns true
if the entity is a bot.
:is_alive
ent:is_alive():
boolean
Returns true
if the entity is alive.
:is_enemy
ent:is_enemy():
boolean
Returns true
if the entity is an enemy.
:is_visible
ent:is_visible():
boolean
Returns true
if the entity is visible.
:is_occluded
ent:is_occluded([ to_entity: entity ]):
boolean
Name | Type | Description |
---|---|---|
to_entity |
| Optional. The entity that will be checked for occlusion |
If the to_entity
is nil, the local player is checked. Returns true
if the entity is completely occluded for the current entity.
:get_index
ent:get_index():
number
Returns the index of the entity.
:get_name
ent:get_name():
string
Returns the player name, weapon name or class name if the entity is neither of those.
:get_origin
ent:get_origin():
vector
Returns the position vector of the entity.
:get_angles
ent:get_angles():
vector
Returns the absolute angles of the entity.
:get_simulation_time
ent:get_simulation_time():
table
Returns a table containing current
and old
simulation time values.
:get_classname
ent:get_classname():
string
Returns the name of the entity's class.
:get_classid
ent:get_classid():
number
Returns the ID of the entity's class.
:get_materials
ent:get_materials():
table
Returns a table containing all materials used by the entity.
:get_model_name
ent:get_model_name():
string
Returns the model name of the entity.
Players
:get_network_state
ent:get_network_state():
number
Returns the network state of the player.
ID | Description |
---|---|
0 | The entity is |
1 | The entity is dormant but the cheat has 100% info where the player is |
2 | The entity is dormant (updated by |
3 | The entity is dormant (updated by |
4 | The entity is dormant (not updated) |
5 | The entity is dormant (data is |
:get_bbox
ent:get_bbox():
table
Returns a table containing pos1
, pos2
, and alpha
values.
:get_player_info
ent:get_player_info():
table
Returns a table containing information from the player_info_t
structure of the entity.
Table values: is_hltv
, is_fake_player
, steamid
, steamid64
, userid
, and files_downloaded
:get_player_weapon
ent:get_player_weapon([all_weapons: boolean]):
entity / table
Name | Type | Description |
---|---|---|
all_weapons |
| If |
Returns a pointer to the player's weapon entity.
If all_weapons
is true
, returns a table containing pointers to every weapon entity the player is currently carrying.
:get_anim_state
ent:get_anim_state():
table
Returns a table containing information about the animation state of the player.
:get_anim_overlay
ent:get_anim_overlay([idx: number]):
table
Name | Type | Description |
---|---|---|
idx |
| Index of the animation layer |
Returns a table containing information about the specified animation layer. Pass nil
to get every animation layer.
:get_eye_position
ent:get_eye_position():
vector
Returns the eye position of the player.
:get_bone_position
ent:get_bone_position(idx: number):
vector
Name | Type | Description |
---|---|---|
idx |
| Index of the bone |
Returns the position of the specified bone.
:get_hitbox_position
ent:get_hitbox_position(idx: number):
vector
Name | Type | Description |
---|---|---|
idx |
| Index of the hitbox |
Returns the position of the specified hitbox.
:get_steam_avatar
ent:get_steam_avatar():
ImgObject
Returns a pointer to the Steam avatar image object of the specified entity.
:get_xuid
ent:get_xuid():
string
Returns the Steam ID of the player.
:get_resource
ent:get_resource():
entity
Returns the pointer to the CCSPlayerResource instance attached to the player, or nil if none exists.
:get_spectators
ent:get_spectators():
table
Returns a table of pointers to the players that are currently spectating the specified player.
:set_icon
ent:set_icon([icon: string])
Name | Type | Description |
---|---|---|
icon |
| Optional. URL to the icon or a panorama path. |
Sets an icon in the scoreboard next to the specified player's avatar. The icon will be removed if no icon was provided.
:simulate_movement
ent:simulate_movement([origin: vector, velocity: vector, flags: number]):
sim_ctx
Name | Type | Description |
---|---|---|
origin |
| Specifies the origin from which the movement should be simulated. If not provided, it uses the player's current origin. |
velocity |
| Specifies the velocity vector for the simulated movement. If not provided, the function will use the player's current velocity as the default for the simulation. |
flags |
| Specifies the m_fFlags 32-bit mask for prediction. If not provided, it uses the player's current |
This function allows you to simulate players' movement by optionally providing an origin, velocity, and flags. Returns an instance of the sim_ctx
class containing details and tools for the movement simulation.
Simulation Context
This class encapsulates the context and results of a movement simulation initiated by :simmulate_movement
.
:think
sim:think([ticks: number])
Simulates the player's movement for a specified number of ticks. If not specified, it defaults to simulating for 1 tick.
Name | Type | Description |
---|---|---|
origin |
| Position of the player after simulation. |
velocity |
| Velocity of the player after simulation. |
view_offset |
| Z axis view offset. Used to calculate the eye position. |
duck_amount |
|
|
did_hit_collision |
| Flags whether the player hit a collision during the simulation. |
obb_mins |
| Player's bounding box's minimum points. |
obb_maxs |
| Player's bounding box's maximum points. |
move |
| |
simulation_ticks |
| The number of ticks over which the simulation was conducted. |
gravity_per_apply |
| Indicates the applied gravitational force during the simulation. |
original_max_speed |
| The player's maximum speed before the simulation. |
max_speed |
| The maximum speed achieved by the player during the simulation. |
is_speed_cropped |
| |
velocity_modifier |
|
|
duck_speed |
| The simulated speed at which the player can be crouching. |
stamina |
|
|
surface_friction |
|
|
trace |
| Post-simulation trace object. |
Weapons
Access functions listed below via :get_player_weapon
function
:get_weapon_index
ent:get_weapon_index():
number
Returns the index of the weapon.
:get_weapon_icon
ent:get_weapon_icon():
ImgObject
Returns the icon of the weapon.
:get_weapon_info
ent:get_weapon_info():
userdata
Returns a pointer to the CCSWeaponInfo
struct of the weapon.
:get_weapon_owner
ent:get_weapon_owner():
entity
Returns a pointer to the weapon owner's entity.
:get_weapon_reload
ent:get_weapon_reload():
number
Returns the weapon reload percentage (0.0-1.0), -1 if not reloading.
:get_max_speed
ent:get_max_speed():
number
Returns the maximum speed the player can move with the weapon.
:get_spread
ent:get_spread():
number
Returns the spread of the weapon in radians.
:get_inaccuracy
ent:get_inaccuracy():
number
Returns the inaccuracy of the weapon in radians.
Last updated