sm-plugins/Status/scripting/include/serverfps.inc
Obuss 4037006f98 Misc improvements to certain plugins
Fixed bug in SprayManager.sp
Added sm_setscore and sm_setteamscore to ExtraCommands.sp
Misc improvements to Status.sp (serverfps.inc made by GoD-Tony, I just
updated win sig)
Logging and misc improvements to Teleport.sp
2016-11-30 13:40:59 -06:00

51 lines
886 B
SourcePawn

#if defined _serverfps_included
#endinput
#endif
#define _serverfps_included
#include <sourcemod>
#include <sdktools>
stock float GetServerFPS()
{
return 1.0 / view_as<float>(LoadFromAddress(GetHostTimeFrame(), NumberType_Int32));
}
/*
* Internal Functions
*/
stock Handle GetServerFPSConf()
{
static Handle hGameConf = null;
if (hGameConf == null)
{
hGameConf = LoadGameConfigFile("serverfps.games");
if (hGameConf == null)
{
SetFailState("Couldn't find \"serverfps.games\" configuration file");
}
}
return hGameConf;
}
stock Address GetHostTimeFrame()
{
static Address pHostTimeFrame = Address_Null;
if (pHostTimeFrame == Address_Null)
{
pHostTimeFrame = GameConfGetAddress(GetServerFPSConf(), "HostTimeFrame");
if (pHostTimeFrame == Address_Null)
{
SetFailState("Failed to find time frame address");
}
}
return pHostTimeFrame;
}