Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- FPSLimit = 70
- FPSMax = 1
- function onClientResourceStart ( resource )
- if ( guiFPSLabel == nil ) then
- FPSLimit = 255 / FPSLimit
- guiFPSLabel = guiCreateLabel ( 0.003, 0.983, 0.26, 0.1, "FPS: 0", true )
- guiSetFont (guiFPSLabel,"clear-normal")
- FPSCalc = 0
- FPSTime = getTickCount() + 1000
- addEventHandler ( "onClientRender", getRootElement (), onClientRender )
- end
- end
- addEventHandler ( "onClientResourceStart", getRootElement (), onClientResourceStart )
- function onClientRender ( )
- if ( getTickCount() < FPSTime ) then
- FPSCalc = FPSCalc + 1
- else
- if ( FPSCalc > FPSMax ) then FPSLimit = 255 / FPSCalc FPSMax = FPSCalc end
- guiSetText ( guiFPSLabel, "FPS: "..FPSCalc)
- guiLabelSetColor ( guiFPSLabel, 255 - math.ceil ( FPSCalc * FPSLimit ), math.ceil ( FPSCalc * FPSLimit ), 0 )
- FPSCalc = 0
- FPSTime = getTickCount() + 1000
- end
- end
Add Comment
Please, Sign In to add comment