Lua · Examples

ESP

Draw over players, or add lines to the built-in ESP.

Each snippet runs as-is: copy it, press From Clipboard on the Lua page, turn it on. Quick start

#Names above heads

The bundled hello_esp in a few lines.

esp_1.lua
local col = color(255, 110, 110)

function on_frame()
    for _, p in ipairs(game.players()) do
        if p.enemy then
            local x, y, ok = draw.world_to_screen(p.head.x, p.head.y, p.head.z + 14)
            if ok then
                local tw = draw.text_size(p.name, 13)
                draw.text_outline(x - tw / 2, y - 16, p.name, col, 13)
            end
        end
    end
end

#Lines under the ESP box

esp.add_text adds up to 4 lines a player, every frame.

esp_2.lua
function on_frame()
    for _, p in ipairs(game.players()) do
        if p.enemy then
            esp.add_text(p.slot, p.weapon, color(200, 200, 200))
            if p.health <= 20 then esp.add_text(p.slot, "LOW", color(255, 80, 80)) end
        end
    end
end

#Skeleton from bones

entity.players() has bone positions.

esp_3.lua
local pairs_ = { {"head","neck"}, {"neck","chest"}, {"chest","pelvis"}, {"neck","shoulder_l"}, {"shoulder_l","elbow_l"}, {"elbow_l","hand_l"}, {"neck","shoulder_r"}, {"shoulder_r","elbow_r"}, {"elbow_r","hand_r"}, {"pelvis","hip_l"}, {"hip_l","knee_l"}, {"knee_l","ankle_l"}, {"pelvis","hip_r"}, {"hip_r","knee_r"}, {"knee_r","ankle_r"} }
local col = color(255, 255, 255, 200)

function on_frame()
    for _, p in ipairs(entity.players()) do
        if p.enemy and p.bones then
            for _, b in ipairs(pairs_) do
                local a, c = p.bones[b[1]], p.bones[b[2]]
                if a and c then draw.line3d(a, c, col, 1.5) end
            end
        end
    end
end

#Open line of sight

map.visible uses the baked map, not the game.

esp_4.lua
function on_frame()
    local me = entity.local_player()
    if not me or not me.bones or not map.ready() then return end
    for _, p in ipairs(entity.players()) do
        if p.enemy and p.bones and map.visible(me.bones.head, p.bones.head) then
            esp.add_text(p.slot, "OPEN", color(255, 220, 90))
        end
    end
end

#Wallbang damage

map.penetrate returns a table. Defaults are an AK-47.

esp_5.lua
function on_frame()
    local me = entity.local_player()
    if not me or not me.bones or not map.ready() then return end
    for _, p in ipairs(entity.players()) do
        if p.enemy and p.bones then
            local r = map.penetrate(me.bones.head, p.bones.chest, { armored = p.armor > 0 })
            if r.reachable and r.surfaces > 0 and r.damage >= 1 then
                esp.add_text(p.slot, math.floor(r.damage) .. " through " .. r.surfaces, color(255, 160, 60))
            end
        end
    end
end

Full scripts

Complete scripts with a header and settings, ready to use or change.