entity

Functions for getting and setting entities and entity data.

Functions:

entity.get_all

entity.get_all([classname: string]): table (entindex)

Returns an array of entity indices. Pass no arguments for all entities.

entity.get_bounding_box

entity.get_bounding_box(player: number): number, number, number, number, number

Returns x1, y1, x2, y2, alpha_multiplier. The contents of x1, y1, x2, y2 must be ignored when alpha_multiplier is zero, which indicates that the bounding box is invalid and should not be drawn.

entity.get_classname

entity.get_classname(ent: number): string

Returns the name of the entity's class, or nil on failure.

entity.get_esp_data

entity.get_esp_data(player: number): table

Returns a table containing alpha, health, and weapon_id, or nil on failure.

entity.get_game_rules

entity.get_game_rules(): number (entindex)

Returns entity index of CCSGameRulesProxy instance, or nil if none exists.

entity.get_local_player

entity.get_local_player(): number (entindex)

Returns the entity index for the local player, or nil on failure.

entity.get_origin

entity.get_origin(ent: number): number, number, number

Returns the x, y, z coordinates of the entity. Only works for non-dormant entities, except for players, where it will return the dormant esp origin

entity.get_player_name

entity.get_player_name(ent: number): string

Returns the player's name, or the string "unknown" on failure.

entity.get_player_resource

entity.get_player_resource(): number (entindex)

Returns entity index of CCSPlayerResource instance, or nil if none exists.

entity.get_player_weapon

entity.get_player_weapon(ent: number): number (entindex)

Returns the entity index of the player's active weapon, or nil if the player is not alive, dormant, etc.

entity.get_players

entity.get_players([enemies_only: boolean]): table (entindex)

Returns an array of player entity indices. Dormant and dead players will not be added to the list.

entity.get_prop

entity.get_prop(ent: number, propname: string[, array_index: number]): any

Returns the value of the property, or nil on failure. For vectors or angles, this returns three values.

entity.get_steam64

entity.get_steam64(player: number): string

Returns steamID3, or nil on failure.

entity.hitbox_position

entity.hitbox_position(player: number, hitbox: number): number, number, number

Returns world coordinates x, y, z, or nil on failure.

entity.is_alive

entity.is_alive(ent: number): boolean

Returns true if the player is not dead.

entity.is_dormant

entity.is_dormant(ent: number): boolean

Returns true if the entity is dormant.

entity.is_enemy

entity.is_enemy(ent: number): boolean

Returns true if the entity is on the other team.

entity.set_prop

entity.set_prop(ent: number, propname: string, value: any[, array_index: number])

Sets the value of the property. For vectors or angles, pass three values.

Last updated