Skip to content

entitylist table

Functions

get_highest_entity_index(): number

Returns the highest entity index

1
local idx = entitylist.get_highest_entity_index()

get_local_player(): entity_t

Returns the local player object

1
local localplayer = entitylist.get_local_player()

get_entity_by_index(index): entity_t

Type Name Description
number index Entity index

Returns the entity_t object by index

1
local lp = entitylist.get_entity_by_index(entitylist.get_local_player())

get_entity_from_handle(handle): entity_t

Type Name Description
number handle Entity handle

Returns the entity_t object by handle

1
2
3
4
5
local m_hActiveWeapon = se.get_netvar("DT_BaseCombatCharacter", "m_hActiveWeapon")

-- getting local weapon
local active_weapon_handle = local_player:get_prop_int(m_hActiveWeapon)
local active_weapon = entitylist.get_entity_from_handle(active_weapon_handle)

get_players(type): entity_t array

Type Name Description
number type Type

Returns the players array

0 - enemies only

1 - teammates only

2 - all players

1
2
3
4
  local players = entitylist.get_players(0)
  for i = 1, #players do
      local player = players[i]
  end

get_entities_by_class(classname): entity_t array

Type Name Description
string classname Class name

Returns the entities array by class name

1
  local entities = entitylist.get_entities_by_class("CFogController")

get_entities_by_class_id(classid): entity_t array

Type Name Description
number classid Class id

Returns the entities array by class id

1
  local entities = entitylist.get_entities_by_class_id(78)