Skip to content

CBaseEntity

Functions


GetPropInt()

Parameters

Parameter Type Description
table string Table name
netvar string Netvar name

Return value

Name Type Description
value int Returns the specified netvar value as an int
Example
1
2
3
4
local localEnt = EntityList:GetEntity(EngineClient:GetLocalPlayer())
if localEnt ~= nil then
  EngineClient:ExecuteCmd("echo local player HP: " .. tostring(localEnt:GetPropInt("DT_BasePlayer","m_iHealth")))
end

GetPropFloat()

Parameters

Parameter Type Description
table string Table name
netvar string Netvar name

Return value

Name Type Description
value float Returns the specified netvar value as a float
Example
1
2
3
4
local localEnt = EntityList:GetEntity(EngineClient:GetLocalPlayer())
if localEnt ~= nil then
  EngineClient:ExecuteCmd("echo local player simulation time: " .. tostring(localEnt:GetPropFloat("DT_BaseEntity","m_flSimulationTime")))
end

GetPropBool()

Parameters

Parameter Type Description
table string Table name
netvar string Netvar name

Return value

Name Type Description
value bool Returns the specified netvar value as a bool
Example
1
2
3
4
local localEnt = EntityList:GetEntity(EngineClient:GetLocalPlayer())
if localEnt ~= nil then
  EngineClient:ExecuteCmd("echo local player has defuser: " .. tostring(localEnt:GetPropBool("DT_CSPlayer","m_bHasDefuser")))
end

GetPropVector()


Parameters

Parameter Type Description
table string Table name
netvar string Netvar name

Return value

Name Type Description
value Vector Returns the specified netvar value as a Vector
Example
1
2
3
4
local localEnt = EntityList:GetEntity(EngineClient:GetLocalPlayer())
if localEnt ~= nil then
  EngineClient:ExecuteCmd("echo local player position x:  " .. tostring(localEnt:GetPropVector("DT_BaseEntity","m_vecOrigin"):x))
end

IsAlive()

Return value

Name Type Description
state bool Returns true if the entity is alive
Example
1
2
3
4
local localEnt = EntityList:GetEntity(EngineClient:GetLocalPlayer())
if localEnt ~= nil then
  EngineClient:ExecuteCmd("echo is local alive: " .. tostring(localEnt:IsAlive()))
end

IsPlayer()

Return value

Name Type Description
state bool Returns true if the entity is a player
Example
1
2
3
4
local localEnt = EntityList:GetEntity(EngineClient:GetLocalPlayer())
if localEnt ~= nil then
  EngineClient:ExecuteCmd("echo is player: " .. tostring(localEnt:IsPlayer()))
end

EntIndex()

Return value

Name Type Description
index int Returns the entity index of the entity
Example
1
2
3
4
local localEnt = EntityList:GetEntity(EngineClient:GetLocalPlayer())
if localEnt ~= nil then
  EngineClient:ExecuteCmd("echo entity index: " .. tostring(localEnt:EntIndex()))
end

IsEnemy()

Return value

Name Type Description
state bool Returns true if the entity is an enemy
Example
1
2
3
4
  local localEnt = EntityList:GetEntity(EngineClient:GetLocalPlayer())
  if localEnt ~= nil then
    EngineClient:ExecuteCmd("echo entity is enemy: " .. tostring(localEnt:IsEnemy()))
  end

GetName()

Return value

Name Type Description
name string Returns the name of the player
Example
1
2
3
4
  local localEnt = EntityList:GetEntity(EngineClient:GetLocalPlayer())
  if localEnt ~= nil then
    EngineClient:ExecuteCmd("echo name:  " .. tostring(localEnt:GetName()))
  end

GetClassId()

Return value

Name Type Description
class_id int Returns the class id of the entity
Example
1
2
3
4
5
6
7
8
9
  Cheat.RegisterCallback("render", function()
    for i = 1, EntityList:GetHighestEntityIndex(), 1 do
    local entity = EntityList:GetEntity(i)
      if entity:GetClassId() == 36 then
        -- This will only execute for CChicken entities
      end
    end

  end)