data
Copies of what the overlay has read from the game: the local player, the players of the teams whose ESP is on, the bomb, dropped items and grenades.
data.snapshot() is always available and returns copies, never addresses or pointers. It returns one table per frame, the same table for every call in that frame, so calling it twice is free. Treat it as read-only.
Two things to know:
- Players are only those of the teams whose ESP is switched on in the overlay's menu, and per-player flags (scoped, flashed, defusing, ...) are
trueonly when the ESP has read them, which depends on its settings. If you see no players, check the ESP. - The local player's table is called
local, which is a Lua keyword, so read it assnap["local"], notsnap.local.
items and projectiles come from the world scanner and are absent when empty, so test for them before looping.
Reference#
data.snapshot#since 1.0
data.snapshot(): SnapshotThe game state as the overlay has it this frame.
| Returns | Description |
|---|---|
Snapshot | The frame's snapshot, see Snapshot. |
local snap = data.snapshot()
if snap.in_game and snap["local"] then
log.info("health " .. snap["local"].health .. " on " .. snap.map)
end
for _, p in ipairs(snap.players) do
if not p.teammate then log.info(p.name .. " " .. p.distance .. " m") end
enddata.world_to_screen#since 1.0
data.world_to_screen(x: number, y: number, z: number): number | nil, numberProjects a world position to screen pixels with this frame's view matrix. Use it with a player's x, y, z.
| Parameter | Type | Description |
|---|---|---|
x | number | World x. |
y | number | World y. |
z | number | World z. |
| Returns | Description |
|---|---|
number | nil | Screen x, or nil when the point is behind the camera. |
number | Screen y. |
events.on("draw", function()
for _, p in ipairs(data.snapshot().players) do
local sx, sy = data.world_to_screen(p.x, p.y, p.z + 72)
if sx then draw.text(sx, sy, 0xFFFFFFFF, p.name, { align = "center" }) end
end
end)Snapshot#
What data.snapshot() returns.
| Field | Type | Description |
|---|---|---|
frame | integer | Frame number. |
time | number | Script time in seconds. |
in_game | boolean | A match is loaded. |
map | string | Map name, empty outside a match. |
menu_open | boolean | The overlay menu is open. |
fps | number | Overlay frames per second. |
frame_ms | number | Milliseconds the last frame took. |
screen | {w, h} | Overlay size in pixels. |
local | table | nil | {team, health, x, y, z, pitch, yaw} of the local player; absent when there is none. Read it as snap["local"]. |
players | Player[] | See Player. |
bomb | table | {planted, seconds, defusing, site, length, defuse_remaining, defuse_length}. |
items | DroppedItem[] | nil | Dropped weapons and items: {x, y, z, kind, name, clip, reserve}. |
projectiles | Projectile[] | nil | Grenades: {x, y, z, type, detonated}; type is he, flash, smoke, molotov, incendiary or decoy. |
Player#
One entry of snapshot.players. Positions are world units; distance is in metres.
| Field | Type | Description |
|---|---|---|
index | integer | Entity index. |
name | string | Player name. |
weapon | string | Weapon name. |
team | integer | Team number. |
health | integer | Health. |
armor | integer | Armour. |
money | integer | Money. |
clip | integer | Rounds in the magazine (-1 when unknown). |
max_clip | integer | Magazine size. |
local | boolean | This is the local player. |
teammate | boolean | Same team as the local player. |
visible | boolean | Whether the overlay considers the player visible to the local player (the ESP's visibility result). |
x | number | World x. |
y | number | World y. |
z | number | World z (feet). |
yaw | number | View yaw in degrees. |
pitch | number | View pitch in degrees. |
speed | number | Horizontal speed. |
distance | number | Distance from the local player in metres. |
scoped | boolean | Scoped in. |
defusing | boolean | Defusing the bomb. |
flashed | boolean | Blinded by a flashbang. |
reloading | boolean | Reloading. |
helmet | boolean | Has a helmet. |
kit | boolean | Has a defuse kit. |
has_bomb | boolean | Carries the bomb. |
ducked | boolean | Crouching. |
on_ground | boolean | Standing on the ground. |