VERGELua API

client

Client state, view angles, convars, chat, world-to-screen.

client

client.GetLocalPlayer():Entity

The local player entity.

client.GetScreenSize():number, number

Screen width and height.

client.IsInGame():boolean

True when a game is running.

client.IsConnected():boolean

True when connected to a server.

client.GetMaxClients():number

Maximum number of players the server supports.

client.GetViewAngles():Vector3

Current view angles.

client.SetViewAngles(angles:Vector3)

Set the view angles.

client.WorldToScreen(origin:Vector3, viewSetup?:table):number, number

Project world position to screen (x, y), nil when off-screen.

client.IsKeyDown(key:number):boolean

True while the Windows VK key is held (VK code, not a Source KEY_* button code).

client.GetConVar(name:string):number|string

ConVar value as a number or string, nil if not found.

client.SetConVar(name:string, value:number|string|boolean)

Set a ConVar from a number, string or boolean.

client.Localize(key:string):string

Localized string for a key, nil if none.

client.GetLocalPlayerIndex():number

Index of the local player entity.

client.Command(cmd:string, unrestrict:boolean)

Execute a console command, optionally unrestricted.

client.ChatSay(msg:string)

Send a chat message.

client.ChatTeamSay(msg:string)

Send a team-only chat message.

client.ChatPrintf(msg:string):boolean

Send a chat message with color codes, always true.

client.GetPlayerNameByIndex(index:number):string

Player name by index, empty if invalid.

client.GetPlayerNameByUserID(userID:number):string

Player name by user ID, empty if invalid.

client.GetPlayerInfo(index:number):table

Player info table with Name, UserID, SteamID, IsBot, IsHLTV.

client.GetPlayerView():ViewSetup

The local player's view setup, synthesized from eye state and screen size.

client.GetViewSetup():ViewSetup

A view setup synthesized from eye position, angles, and screen size.

client.IsFreeTrialAccount():boolean

True when the local player has a free-trial account.

client.HasCompetitiveAccess():boolean

True when the current match is in competitive mode.

client.IsInCoachesList():boolean

True when the local player is in the coaches list.

clientstate

clientstate.ForceFullUpdate()

Force a full server update.

clientstate.GetClientSignonState():number

Current client signon state.

clientstate.GetDeltaTick():number

Current delta tick count.

clientstate.GetLastOutgoingCommand():number

Number of the last outgoing command.

clientstate.GetChokedCommands():number

Number of choked commands.

clientstate.GetLastCommandAck():number

Number of the last acknowledged command.

clientstate.GetNetChannel():NetChannel

The active net channel, nil if none.

Examples

Live status HUD

Your health, class and view angles, drawn in the corner every frame.

callbacks.Register("Draw", function()
    local me = client.GetLocalPlayer()
    if not me:IsValid() then return end

    local ang = client.GetViewAngles()
    draw.Color(255, 255, 255, 255)
    draw.Text(10, 10, string.format("HP %d/%d  %s", me:GetHealth(), me:GetMaxHealth(), me:GetClass()))
    draw.Text(10, 26, string.format("Pitch %.1f  Yaw %.1f", ang.x, ang.y))
end)