EntityList
Fields
This class has no fields.
Functions
GetClientEntity
Name |
Type |
Description |
ent |
int |
Entity number |
Return value
local localplayer = EntityList.GetClientEntity(EngineClient.GetLocalPlayer())
NumberOfEntities
Name |
Type |
Description |
bIncludeNonNetworkable |
bool |
Include non-networkable entities |
Return value
Name |
Type |
Description |
value |
int |
Number of entities currently in use |
local num_ents = EntityList.NumberOfEntities(false)
print(num_ents)
GetHighestEntityIndex
This function has no parameters.
Return value
Name |
Type |
Description |
value |
int |
Highest entity index |
local highest_index = EntityList.GetHighestEntityIndex()
print(highest_index)
GetClientEntityFromHandle
Return value
local localplayer = EntityList.GetClientEntity(EngineClient.GetLocalPlayer())
local weapon_handle = localplayer:GetProp("CBaseCombatCharacter", "m_hActiveWeapon")
local weapon = EntityList.GetClientEntityFromHandle(weapon_handle)
GetPlayerResource
This function has no parameters.
Return value
local player_resource = EntityList.GetPlayerResource()
local clan_tags = player_resource:m_szClan()
for key, value in pairs(clan_tags) do
print(key, value)
end
GetGameRules
This function has no parameters.
Return value
local game_rules = EntityList.GetGameRules()
local is_valve = game_rules:m_bIsValveDS()
print(is_valve)
GetEntitiesByClassID
Name |
Type |
Description |
class_id |
int |
Class ID |
Return value
Name |
Type |
Description |
entities |
table |
Table with entities (C_BaseEntity*) |
local entities = EntityList.GetEntitiesByClassID(129) -- CPlantedC4
print("Found " .. tostring(#entities) .. " entities with id 129")
GetEntitiesByClassName
Name |
Type |
Description |
class_name |
string |
Class name |
Return value
Name |
Type |
Description |
entities |
table |
Table with entities (C_BaseEntity*) |
local entities = EntityList.GetEntitiesByClassName("CPlantedC4")
print("Found " .. tostring(#entities) .. " entities with name CPlantedC4")
FindEntityByClassID
Name |
Type |
Description |
class_id |
int |
Class ID |
Return value
Name |
Type |
Description |
entity |
C_BaseEntity* |
Pointer to found entity |
local entity = EntityList.FindEntityByClassID(129)
FindEntityByClassName
Name |
Type |
Description |
class_name |
string |
Class name |
Return value
Name |
Type |
Description |
entity |
C_BaseEntity* |
Pointer to found entity |
local entity = EntityList.FindEntityByClassName("CPlantedC4")
GetLocalPlayer
This function has no parameters.
Return value
Name |
Type |
Description |
ent |
C_CSPlayer* |
Pointer to local player |
local local_player = EntityList.GetLocalPlayer()
GetWeapon
Name |
Type |
Description |
index |
int |
Weapon entity index |
Return value
local weapon = EntityLister.GetWeapon(65)
GetPlayer
Name |
Type |
Description |
index |
int |
Player entity index |
ent |
C_CSPlayer* |
Pointer to player |
local player = EntityLister.GetPlayer(1)
GetPlayerFromHandle
Return value
Name |
Type |
Description |
ent |
C_CSPlayer* |
Pointer to player |
local player = EntityLister.GetPlayerFromHandle(handle)
GetWeaponFromHandle
Return value
local local_player = EntityLister.GetLocalPlayer()
local weapon_handle = local_player:GetProp("CBaseCombatCharacter", "m_hActiveWeapon")
local weapon = EntityList.GetWeaponFromHandle(weapon_handle)
GetPlayers
This function has no parameters.
Return value
Name |
Type |
Description |
players |
table |
Table with players (C_CSPlayer*) |
Cheat.RegisterCallback("create_move", function(cmd, local_player)
local players = EntityList.GetPlayers()
for table_index, player_pointer in pairs(players) do
if player_pointer == local_player then goto skip end
local player_name = player_pointer:GetPlayerName()
print("Name:", player_name)
::skip::
end
end)
GetPlayerForUserID
Name |
Type |
Description |
value |
int |
User ID |
Return value
Name |
Type |
Description |
ent |
C_CSPLayer* |
Pointer to player |
GameEventManager.AddEventListener("player_hurt", function(event)
local target_player = EntityList.GetPlayerForUserID(event:GetInt("userid"))
-- here is your code
end)