entity_list#
get_entity#
Returns entity object from an entity index or handle
| Fields | Description |
|---|---|
index_or_handleint |
entity index or handle |
Example
local first_player = entity_list.get_entity(1)
local ground_entity = entity_list.get_entity(first_player:get_prop("m_hGroundEntity"))
get_player_from_userid#
Returns entity object from a player's user id
| Fields | Description |
|---|---|
user_idint |
user id |
Example
get_local_player#
Returns local player entity object
Example
local local_player = entity_list.get_local_player()
print(local_player:get_prop("m_iHealth")) -- prints player's health
get_local_player_or_spectating#
Returns local_player if alive or currently spectated player
Example
local entity = entity_list.get_local_player_or_spectating()
print(entity:get_name()) --print's localplayer name or observer target's name
get_entities_by_classid#
Returns table of entities with the specified class id
| Fields | Description |
|---|---|
class_idint |
class id |
Example
local class_list = entity_list.get_entities_by_classid(40)
for i,v in pairs(class_list) do
print(i,v)
end
get_entities_by_name#
Returns table of entities with the specified name
| Fields | Description |
|---|---|
class_namestring |
class name |
Example
local class_list = entity_list.get_entities_by_name("CCSPlayer")
for i,v in pairs(class_list) do
print(i,v:get_name())
end
get_players#
Returns table of players
| Fields | Description |
|---|---|
enemies_onlybool |
[optional] only return enemies |
Example
local enemies_only = entity_list.get_players(true)
for _,player in pairs(enemies_only) do
print("Entity Index: ", player:get_index())
end
get_highest_entity_index#
Returns the maximum entity index