Moderators IIYAMA Posted September 11, 2012 Moderators Share Posted September 11, 2012 How can I receive fps data of a player? I can't find any functions about the fps. Only " setFPSLimit". Link to comment
Anderl Posted September 11, 2012 Share Posted September 11, 2012 You must make a function to get FPS by yourself. Link to comment
Kenix Posted September 11, 2012 Share Posted September 11, 2012 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. Link to comment
Moderators IIYAMA Posted September 11, 2012 Author Moderators Share Posted September 11, 2012 ah this is how it works. Thx Kenix I never thought about client render. Link to comment
Fresku Posted September 12, 2012 Share Posted September 12, 2012 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 ) Link to comment
Kenix Posted September 12, 2012 Share Posted September 12, 2012 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 ) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now