A DLL that allows you to get server FPS.
You might ask “Why do you need this?”. There is a reason: on dedicated server hook Think is called exactly at tickrate, and hook Tick is called at tickrate, and FrameTime returns delay between ticks. But what about FPS? They are dropped when players spawn lagshit, and that is good sign for scripts to do something against low FPS. As for CPU usage, server may have 300fps at 99% or 10fps at 100%.
Usage is simple:
require"fps" print(game.GetFPS()) --prints FPS based on real frame time print(game.GetLastFPS()) --prints FPS in last second print(game.GetFPSA()) --prints total number of frames since server start print(game.FrameTimeReal()) --prints real frame time - not tick time
Example script that adjusts phys_timescale to keep FPS high:
require"fps" --loading module... local pfps = 150 local tn = 1 hook.Add("Think","Unlag",function() pfps = pfps + (math.Clamp(game.GetFPS()-pfps,-100,1)) --smooth fps making it more sensitive to drops if tn>=33 then --issue command each 33 ticks, otherwise possible jerky motion RunConsoleCommand("phys_timescale",tostring(math.min(pfps/150,1))) --don't let it go over 1, start lowering timescale when FPS is lower than 150 tn = 0 end tn=tn+1 if pfps < 30 then MsgN("Critically low FPS!!!") --debug spam that drops fps too, it is here only for demonstration end end)
That script kept my server FPS at maximum even when I spammed a lot of craneframes.
This won’t work on client as it uses server interfaces.