s
swagsense
lua api
главная

swagsense

lua api documentation

loading lua scripts

  1. 1

    поместите скрипт в папку

    swagsense\scripts
  2. 2

    выберите скрипт из списка и нажмите "load"

пример скрипта

-- простой hitmarker скрипт
local hits = {}
local lifetime = 2.0

function on_paint()
    if not game.is_in_game() then
        return
    end
    
    local time = game.get_time()
    local w, h = draw.get_screen_size()
    local center_x = w / 2
    local center_y = h / 2
    
    -- рисуем все активные хитмаркеры
    for i = #hits, 1, -1 do
        local hit = hits[i]
        local elapsed = time - hit.time
        
        if elapsed > lifetime then
            table.remove(hits, i)
        else
            local fade = 1.0 - (elapsed / lifetime)
            local color = draw.color(255, 255, 255, fade * 255)
            local size = 10 + elapsed * 5
            
            -- рисуем крестик
            draw.line(center_x - size, center_y - size, 
                     center_x + size, center_y + size, color, 2)
            draw.line(center_x + size, center_y - size, 
                     center_x - size, center_y + size, color, 2)
        end
    end
end

function on_player_hurt(event)
    table.insert(hits, {time = game.get_time()})
end

luajit

поддерживается luajit 2.1.1736781742

ffi tutorial

compiling lua scripts

luajit.exe -b script.lua compiled.luac