Jump to content

onClientRender checker [HELP]


MitnickP56

Recommended Posts

Hi, I tried to make fps checker. smth like Nick his fps = (fps) . but with fps<=35

I wanna change 10.0001 to 10

Nick fps; 30.00333

->

Nick fps: 30

with timer 1 sec

Code:

local fps = false 
function getCurrentFPS() -- Setup the useful function 
    return fps 
end 
setTimer(getCurrentFPS, 1000, 0)  
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 
     for _, v in ipairs(getElementsByType("player")) do 
    local state = getElementData (v, "state") 
        if state == "alive" then 
    local pokazfps = getCurrentFPS() 
    if (pokazfps <= 35) then 
    outputChatBox(getPlayerName(v).." #fffffffps"..pokazfps, 213, 255, 255, true) 
end 
end 
end 
end 
addEventHandler("onClientPreRender", root, updateFPS) 

This code show:

24839017539105893929.png

Link to comment

The for-part doesn't make sense.

getCurrentFPS only gives the FPS of the local player.

Also don't use ipairs in a code like that!

I see that s*it everywhere ... guys, ipairs is SLOW.

Use for i=1, #players (fastest) or pairs instead, but don't use ipairs when the order doesn't matter (and here it clearly doesn't matter)

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...