Skip to content

EngineClient

Functions


ExecuteCmd()

Parameters

Parameter Type Description
command string Command to be executed in the console
Example

1
2
EngineClient:ExecuteCmd("clear")
EngineClient:ExecuteCmd("echo hello from lua")
This script will run only once. It's going to execute 'clear' which will clear the csgo console and then it will print 'hello from lua'.


GetLocalPlayer()

Return value

Name Type Description
index int The entity index of the local player entity
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
This piece of code will run only once and will print local's health in the game console.


IsInGame()

Return value

Name Type Description
state bool Returns true if the local player is in game
Example
1
2
3
4
5
6
Cheat.RegisterCallback("render",function()

  if EngineClient:IsInGame() then
    Renderer:DrawText(100,100,"Currently in-game")

end)

IsConnected()

Return value

Name Type Description
state bool Returns true if the local player is connected
Example
1
2
3
4
5
6
Cheat.RegisterCallback("render",function()

  if EngineClient:IsConnected() then
    Renderer:DrawText(100,100,"Currently connected to a server")

end)

GetMaxClients()

Return value

Name Type Description
player_count int Returns the max player count
Example

1
2
3
4
5
6
7
8
9
Cheat.RegisterCallback("create_move",function()

  for i = 0, EngineClient:GetMaxClients(), 1
  do
    EngineClient:ExecuteCmd("echo " .. tostring(i))
  end


end)
This code will loop through all the player entities in the server


IsTakingScreenshot()

Return value

Name Type Description
taking_ss bool Returns true if the local client is taking a screenshot
Example

1
2
3
4
5
6
7
8
Cheat.RegisterCallback("render",function()

  if EngineClient:IsTakingScreenshot() then
    EngineClient:ExecuteCmd("echo just took a screenshot" )
  end


end)
This code will print in the game console the following message if we are currently taking a screenshot


GetViewAngles()

Return value

Name Type Description
angles QAngle Returns a structure containing local player's view angles ( pitch, yaw, roll )
Example

1
2
3
4
5
6
7
Cheat.RegisterCallback("create_move",function()


  EngineClient:ExecuteCmd("echo current yaw:  " .. tostring(EngineClient:GetViewAngles().yaw))


end)
This code will print the yaw angle in the game console


SetViewAngles(QAngle angles)

Parameters

Parameter Type Description
angles QAngle Target angle to set local view angles to
Example

1
2
3
4
5
6
7
Cheat.RegisterCallback("create_move",function()


  EngineClient:SetViewAngles(QAngle(85,0,0))


end)
This will force set the local player view angles to the set view angles