PHP Code:
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "Server fps latency checker"
#define VERSION "0"
#define AUTHOR "twoj_stary"
new bool:on_off
new g_fh
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_srvcmd("check_fps", "switch_check")
}
public server_frame()
{
static Float:last_frame
if(!on_off)
return
new Float:curr_frame = get_gametime()
new tmp[16]
formatex(tmp, 15, "%f^n", curr_frame-last_frame)
fputs(g_fh, tmp)
last_frame = curr_frame
}
public switch_check()
{
static filename[128]
if(!(on_off=!on_off))
{
server_print("stopped checking, saving report file to %s", filename)
fclose(g_fh)
return
}
get_basedir(filename, 127)
format(filename, 127, "%s/logs/frame_time_%d.log", filename, get_systime())
g_fh = fopen(filename, "wt")
if(!g_fh)
{
on_off=false
server_print("failed to open log file %s", filename)
return
}
server_print("starting to check latency of each server frame")
}
public plugin_end()
{
if(g_fh)
fclose(g_fh)
}
__________________