Jump to content

how to receive fps


IIYAMA

Recommended Posts

  • Moderators
Posted

How can I receive fps data of a player?

I can't find any functions about the fps. Only " setFPSLimit".

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted

You must make a function to get FPS by yourself.

"[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007

Posted
  
local iFPS = 0 
local iFrames = 0 
  
function GetFPS( ) 
    return iFPS 
end 
  
addEventHandler( 'onClientRender', root, 
    function() 
        iFrames = iFrames + 1 
    end 
) 
  
  
setTimer( function() iFPS = iFrames; iFrames = 0 end, 1000, 0 ) 
  

Updated

So you need just call function GetFPS. Also you should modify this code for yourself.

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

  • Moderators
Posted

ah this is how it works. :D

Thx Kenix

I never thought about client render.

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted
No problem.

Instead of using laggy timers, you can also use getTickCount() in the onClientRender function itself.

edit:

local iFPS = 0 
local iFrames = 0 
  
function GetFPS( ) 
    return iFPS 
end 
  
addEventHandler( 'onClientRender', root, 
    function() 
        iFrames = iFrames + 1 
        if getTickCount () %800 < 15 then 
            iFPS = iFrames; iFrames = 0 
        end 
    end 
) 

I know you bitches hatin'... I'm in the new Aston; the one Swizz created.

Posted
  
local iFPS = 0 
local iFrames = 0 
local iStartTick = getTickCount() 
  
function GetFPS( ) 
    return iFPS 
end 
  
addEventHandler( 'onClientRender', root, 
    function() 
        iFrames = iFrames + 1 
        if getTickCount() - iStartTick >= 1000 then 
            iFPS = iFrames 
            iFrames = 0 
            iStartTick = getTickCount() 
        end 
    end 
) 

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

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