Jump to content

Show fps


Recommended Posts

Estou criando uma hud, e não acho a variavel para mostrar o fps, podem me mandar um script?

 

dxDrawText(mostrarfpsaqui, 1122, 188, 1228, 205, tocolor(255, 255, 255, 255), 1.40, "default-bold", "left", "top", false, false, false, false, false)

 

Link to comment
        local function drawFPS()
        if not getCurrentFPS() then
        return
        dxDrawText(dxDrawText(roundedFPS, sx - dxGetTextWidth(roundedFPS), 1122, 188, 1228, 205, tocolor(255, 255, 255, 255), 1.40, "default-bold", "left", "top", false, false, false, false, false)
            local roundedFPS = math.floor(getCurrentFPS())
        end

O End não está funcionando, e seu retirar o end, ele vai pegar os dxDraw abaixo desse, na verdade, nem se eu retirar o end nada abaixo disso vai funcionar, ele buga a patir do local roundedFPS

Edited by ODutii
Link to comment
local fps = false

local function updateFPS(msSinceLastFrame)
    -- FPS are the frames per second, so count the frames rendered per milisecond using frame delta time and then convert that to frames per second.
    fps = (1 / msSinceLastFrame) * 1000
end
addEventHandler("onClientPreRender", root, updateFPS)

addEventHandler( "onClientRender", root, function()
	dxDrawText( "FPS: ".. (fps or "N/A"), 1122, 188, 1228, 205, tocolor(255, 255, 255, 255), 1.40, "default-bold", "left", "top", false, false, false, false, false)
end )

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...