Mai jos vă voi lăsa un plugin, care crează un fișier al său, prin care vă arată detalii despre „crash”-uri.
Spoiler
#include <amxmodx>
#define PLUGIN "Crash Counter"
#define VERSION "1.0"
#define AUTHOR "stupok"
#define DIR_CRASHLOG "addons\amxmodx\logs\CrashLog"
#define FILE_CRASHMAP "addons\amxmodx\logs\CrashLog\crash_map.txt"
#define FILE_LOG "CrashLog.log" // will be found in addons\amxmodx\logs
new cvar_Crashed
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
cvar_Crashed = register_cvar("server_crashed", "1", FCVAR_SPONLY) // do not let players edit this cvar
if(!dir_exists(DIR_CRASHLOG)) mkdir(DIR_CRASHLOG) // make addons\amxmodx\logs\CrashLog
if(!file_exists(FILE_CRASHMAP)) write_file(FILE_CRASHMAP, "-- Do not edit --", -1) // make crash_map.txt
new szMapName[32]
new iLineLen
read_file(FILE_CRASHMAP, 2, szMapName, charsmax(szMapName), iLineLen) // read previous map from file
if(get_pcvar_num(cvar_Crashed)) // check if server just started, 1 = start, 0 = restart/mapchange
{
if(szMapName[0]) // do we have a map from crash_map.txt?
{
log_to_file(FILE_LOG, "The server exited or crashed on '%s' before this recorded time.", szMapName)
}
set_pcvar_num(cvar_Crashed, 0) // this will be set to 1 again when the server has a "fresh" start (not restart)
}
get_mapname(szMapName, charsmax(szMapName)) // get the name of the current map
write_file(FILE_CRASHMAP, szMapName, 2) // write it to crash_map.txt
}