Ещу

karsss

Участник
Автор темы
12
1
Версия MoonLoader
.027.0-preview
Показатель фпс именно с открытым кодом
 
Решение
Lua:
local font = renderCreateFont("Arial", 15, 5)
local resX, resY = getScreenResolution()

function main()
    while not isSampAvailable() do wait(0) end
    while true do
        wait(0)
        renderFontDrawText(font, ("%.0f"):format(require'memory'.getfloat(0xB7CB50, true)), 15, resY - 30 , 0xFFFF0000)
    end
end

chapo

🫡 В армии с 17.10.2023. В ЛС НЕ ОТВЕЧАЮ
Друг
8,776
11,234
Lua:
local font = renderCreateFont("Arial", 15, 5)
local resX, resY = getScreenResolution()

function main()
    while not isSampAvailable() do wait(0) end
    while true do
        wait(0)
        renderFontDrawText(font, ("%.0f"):format(require'memory'.getfloat(0xB7CB50, true)), 15, resY - 30 , 0xFFFF0000)
    end
end
 
  • Нравится
Реакции: Kareli

Kareli

Участник
76
6
Lua:
local font = renderCreateFont("Arial", 15, 5)
local resX, resY = getScreenResolution()

function main()
    while not isSampAvailable() do wait(0) end
    while true do
        wait(0)
        renderFontDrawText(font, ("%.0f"):format(require'memory'.getfloat(0xB7CB50, true)), 15, resY - 30 , 0xFFFF0000)
    end
end
А как сделать выключение через else
 

chapo

🫡 В армии с 17.10.2023. В ЛС НЕ ОТВЕЧАЮ
Друг
8,776
11,234
А как сделать выключение через else
текст рендерится в цикле, поэтому else не нужно
Lua:
local font = renderCreateFont("Arial", 15, 5)
local resX, resY = getScreenResolution()

local active = true

function main()
    while not isSampAvailable() do wait(0) end
    sampRegisterChatCommand('fps', function()
        active = not active
        sampAddChatMessage(active and 'Fps: on' or 'Fps: off', -1)
    end)
    while true do
        wait(0)
        if active then
            renderFontDrawText(font, ("%.0f"):format(require'memory'.getfloat(0xB7CB50, true)), 15, resY - 30 , 0xFFFF0000)
        end
    end
end
 
  • Нравится
Реакции: Kareli

Kareli

Участник
76
6
текст рендерится в цикле, поэтому else не нужно
Lua:
local font = renderCreateFont("Arial", 15, 5)
local resX, resY = getScreenResolution()

local active = true

function main()
    while not isSampAvailable() do wait(0) end
    sampRegisterChatCommand('fps', function()
        active = not active
        sampAddChatMessage(active and 'Fps: on' or 'Fps: off', -1)
    end)
    while true do
        wait(0)
        if active then
            renderFontDrawText(font, ("%.0f"):format(require'memory'.getfloat(0xB7CB50, true)), 15, resY - 30 , 0xFFFF0000)
        end
    end
end
Lua:
function main()
    while not isSampAvailable() do wait(0) end
    sampRegisterChatCommand('fps', function()
        active = not active
        sampAddChatMessage(active and 'Fps: on' or 'Fps: off', -1)
    end)
    while true do
        wait(0)
    if elements.checkboxes.nst.v then
            renderFontDrawText(font, ("%.0f"):format(require'memory'.getfloat(0xB7CB50, true)), 15, resY - 30 , 0xFFFF0000)
        end
    end
end
ТАк?
 

chapo

🫡 В армии с 17.10.2023. В ЛС НЕ ОТВЕЧАЮ
Друг
8,776
11,234
Lua:
function main()
    while not isSampAvailable() do wait(0) end
    sampRegisterChatCommand('fps', function()
        active = not active
        sampAddChatMessage(active and 'Fps: on' or 'Fps: off', -1)
    end)
    while true do
        wait(0)
    if elements.checkboxes.nst.v then
            renderFontDrawText(font, ("%.0f"):format(require'memory'.getfloat(0xB7CB50, true)), 15, resY - 30 , 0xFFFF0000)
        end
    end
end
ТАк?
da
 

Kareli

Участник
76
6
скрипт крашится? если да то кинь мунлог
[23:01:37.069642] (system) Loading script "D:\!GTA\moonloader\proc ozu1.8.lua"... (id:5)
[23:01:37.072642] (script) hack: Requested packages: copas
[23:01:37.092643] (debug) hack: Installed check took 0.020s.
[23:01:37.242880] (system) hack: Loaded successfully. лог
Ну тут все норм дело в том что меню все запускается все работает нажимаю на fps show и нечего не происходит
 

Vintik

Через тернии к звёздам
Проверенный
1,494
961
Lua:
local font = renderCreateFont('Arial', 15, 5)
local resX, _ = getScreenResolution()

local showPerSecond = 10 -- количество раз, когда обновлять FPS на экране
local active = true

function main()
    while not isSampAvailable() do wait(0) end
    sampRegisterChatCommand('fps', function()
        active = not active
        sampAddChatMessage(active and 'Fps: on' or 'Fps: off', -1)
    end)
    local prevTime = os.clock()
    local prevFps = os.clock() - 1 / showPerSecond
    local FPS
    while true do
        wait(0)
        Time = os.clock()
        if active then
            if Time - prevFps >= 1 / showPerSecond then
                FPS = 1 / (Time - prevTime)
                prevFps = Time
            end
            renderFontDrawText(font, tostring(math.ceil(FPS)), resX - 40, 12, 0xFFFFFFFF)
        end
        prevTime = Time
    end
end
sa-mp-578.png
Можно еще вот так.
 
Последнее редактирование:

Kareli

Участник
76
6
Lua:
local font = renderCreateFont("Arial", 15, 5)
local resX, resY = getScreenResolution()

local active = true

function main()
    while not isSampAvailable() do wait(0) end
    sampRegisterChatCommand('fps', function()
        active = not active
        sampAddChatMessage(active and 'Fps: on' or 'Fps: off', -1)
    end)
    local prevTime = os.clock()
    while true do
        wait(0)
        Time = os.clock()
        if active then
            FPS = 1 / (Time - prevTime)
            renderFontDrawText(font, tostring(FPS), 15, resY - 30 , 0xFFFF0000)
        end
        prevTime = Time
    end
end
Можно еще вот так.
 

Kareli

Участник
76
6
Попробуй новый код, я изменил сообщение. Должно быть справа сверху, чекай скриншот, у меня все работает. Мб у тебя 2 main()?

Код:
    if elements.checkboxes.nst.v then
    while true do
        wait(0)
            renderFontDrawText(font, ("%.0f"):format(require'memory'.getfloat(0xB7CB50, true)), 15, resY - 30 , 0xFFFF0000)
        end
    end
Вот так работает не не выключается