Skip to content

entity_list

Methods

[index]: entity

Type Name Description Default
number index Index of entity to get none

Finds an entity by index. If no entity found, returns nil. An alias to get_entity

1
local first_ent = entity_list[1]

get_entity(index): entity

Type Name Description Default
number index Index of entity to get none

Finds an entity by index. If no entity found, returns nil

1
local me_ent = entity_list.get_entity(engine_client.get_local_player())

get_entity_from_handle(handle): entity

Type Name Description Default
number handle Handle of entity to get none

Finds an entity by handle. If no entity found, returns nil

1
local spectating = entity_list.get_entity_from_handle(me:get_prop_int('m_hObserverTarget'))

get_all(classname): { entity, ... }

Type Name Description Default
string classname Name of class to get all entities by none

Returns all entities found on server by given classname

1
local players = entity_list.get_all('CCSPlayer')

get_enemies(): { entity, ... }

Returns all enemies (both dead and alive)

1
2
for i, enemy in ipairs(entity_list.get_enemies()) do
end

get_highest_index(): number

Returns highest entity index on server

1
2
for i = 1, entity_list.get_highest_index() do
end

number_of_entities(): number

Returns number of entities on server

1
local num = entity_list.number_of_entities()