Lua · Variables · Game state
game
The match and a quick list of players.
Players come from the same data the ESP already reads, once a frame, so calling these often costs nothing extra. Only living players are listed. For bones, velocity and more, use entity.
| Function | What it does |
|---|---|
game.local_player() | You, as a player table. nil when you are dead or not in a match. |
game.players() | All living players, you included. |
game.map() | The map name, for example de_mirage. Empty until it is known. |
game.mode() | The game mode: Competitive, Premier, Casual, Wingman, Deathmatch, Arms Race, or Community - … on community servers. Empty until known. |
game.in_match() | True while you are in a match (not in the main menu or loading). |
game.time() | Seconds since the current round started. 0 until the first round start is seen. |
game.round() | The current round number, starting at 1. |
#game.local_player
game.local_player()You, as a player table. nil when you are dead or not in a match.
Returns
player | nil
See the player table below.
Example
local me = game.local_player()
if me then print(me.health, me.weapon) end#game.players
game.players()All living players, you included.
Returns
player[]
An array of player tables.
Example
for _, p in ipairs(game.players()) do
if p.enemy then print(p.name, p.health) end
end#game.map
game.map()The map name, for example de_mirage. Empty until it is known.
Returns
string
Map name.
#game.mode
game.mode()The game mode: Competitive, Premier, Casual, Wingman, Deathmatch, Arms Race, or Community - … on community servers. Empty until known.
Returns
string
Mode name.
#game.in_match
game.in_match()True while you are in a match (not in the main menu or loading).
Returns
boolean
-
#game.time
game.time()Seconds since the current round started. 0 until the first round start is seen.
Returns
number
Seconds.
#game.round
game.round()The current round number, starting at 1.
Returns
integer
Round.
Player table
| Field | Type | Meaning |
|---|---|---|
slot | integer | Player slot. Use it with entity.get and esp.add_text. |
name | string | Nickname. |
team | integer | 2 = T, 3 = CT. |
health | integer | 1 to 100. |
alive | boolean | Always true in these lists (only living players are listed). |
enemy | boolean | On the other team. With Deathmatch mode on in Misc, everyone but you. |
is_local | boolean | This is you. |
weapon | string | Held weapon without the prefix: ak47, awp, knife, hegrenade. NULL when nothing is held. |
pos | vector | Feet position in game units. |
head | vector | About head height (pos + 64 units). entity.* gives the real head bone. |
armor | integer | Armour, 0 to 100. 0 until the scoreboard data arrives. |
money | integer | Money. 0 until the scoreboard data arrives. |
steamid | string | SteamID64 as text. Empty until known; bots show 0. |