Script Examples & Recipes
Working Lua script examples demonstrating common features.
1. Health Bar ESP Over Enemies
Section titled β1. Health Bar ESP Over EnemiesβDraws a vertical health bar next to enemy bounding boxes:
local group = ui.groupbox("Visuals", "Health bars")local enabled = group:checkbox("Enabled", true)local tint = group:color_picker("Bar Color", color(120, 220, 90, 255))
client.add_callback("render", function() if not enabled:get() or not globals.is_in_game then return end
for i = 1, globals.max_players do local player = entity.get(i) if player and player:is_player() and player:is_alive() and player:is_enemy() and not player:is_dormant() then
local mins, maxs = player:get_bounding_box() if mins.x ~= 0 or maxs.x ~= 0 then local health = math.min(player.m_iHealth, 100) / 100 local height = maxs.y - mins.y local x = mins.x - 6
-- Background render.rect(vector(x, mins.y), vector(x + 3, maxs.y), color(0, 0, 0, 160))
-- Health Fill render.rect(vector(x, maxs.y - height * health), vector(x + 3, maxs.y), tint:get()) end end endend)2. Bunnyhop on Keybind
Section titled β2. Bunnyhop on KeybindβReleases the jump key while airborne to maintain bhop velocity:
local group = ui.groupbox("Misc", "Bunny hop")local hotkey = group:keybind("Hold to hop")
local IN_JUMP = bit32.lshift(1, 1)
client.add_callback("createmove", function(cmd) if not hotkey:get() then return end
local player = entity.get_local_player() if not player or not player:is_alive() then return end
-- Check FL_ONGROUND flag (0x1) local on_ground = bit32.band(player.m_fFlags, 1) ~= 0 if not on_ground then cmd.buttons = bit32.band(cmd.buttons, bit32.bnot(IN_JUMP)) endend)3. Static Anti-Aim on Keybind
Section titled β3. Static Anti-Aim on KeybindβForces pitch, yaw offset, and desync when a hotkey is active:
local group = ui.groupbox("Anti aim", "Other")local hotkey = group:keybind("Force Backwards")
client.add_callback("antiaim", function(ctx) if not hotkey:get() then return end
ctx:pitch(89) ctx:yaw_offset(180) ctx:desync(true)end)4. Ragebot Miss Logger
Section titled β4. Ragebot Miss LoggerβLogs missed shots with damage, hitchance, and miss reason:
client.add_callback("aim_ack", function(shot) if shot.damage > 0 then return end -- Registered hit
local reason = shot.miss_reason if not reason or reason == "" then reason = "unknown" end
print(string.format("[Ragebot] Missed shot! Wanted: %d dmg | Hitchance: %d%% | Reason: %s", shot.wanted_damage, shot.hitchance, reason ))end)5. JSON State Persistence
Section titled β5. JSON State PersistenceβSaves and restores script state across game sessions using files and json:
local STATE_PATH = "aimsense/scripts/data/my_stats.json"
-- Load state on startuplocal state = { total_launches = 0, last_map = "none" }if files.exists(STATE_PATH) then local content = files.read(STATE_PATH) if content and #content > 0 then state = json.parse(content) endend
state.total_launches = (state.total_launches or 0) + 1state.last_map = common.get_map_shortname()
print(string.format("Launch count: %d (Map: %s)", state.total_launches, state.last_map))
-- Save on unloadclient.add_callback("unload", function() files.write(STATE_PATH, json.stringify(state, 4))end)