SA:MP как получить количество кадров (луа/pawn)?

насильник42

Новичок
2
0
Пример кода через getTimeStepValue:
local font = renderCreateFont('Arial', 10, 0)
local fps = 0.0

function main()
    while true do
        wait(0)

        local step = getTimeStepValue()
        if step > 0 then
            local current_fps = 50.0 / step
            fps = fps == 0.0 and current_fps or fps * 0.9 + current_fps * 0.1
        end

        local text = string.format('FPS: %d', math.floor(fps + 0.5))
        local screen_x, screen_y = getScreenResolution()
        local text_width = renderGetFontDrawTextLength(font, text)

        renderFontDrawText(
            font,
            text,
            screen_x - text_width - 10,
            10,
            0xFFFFFFFF
        )
    end
end