Code:
// amx_autorestart 1/0, Enables and disables the function
// amx_autorestartrounds 1-10, Sets the amount of restarts before loading config
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#define RESROUNDS 2 //Default restarts before executing config
new g_restarted,g_dorestart,cvar_dorestart,cvar_dorestartrounds
public plugin_init( )
{
register_plugin( "Execute Cfg After Restart", "1.0", "xPaw" );
cvar_dorestart = register_cvar("amx_autorestart", "0")
cvar_dorestartrounds = register_cvar("amx_autorestartrounds", "2")
register_event( "TextMsg", "EventRoundRestart", "a", "2=#Game_will_restart_in" );
}
public EventRoundRestart( )
{
g_dorestart = get_pcvar_num(cvar_dorestart)
g_restarted = get_pcvar_num(cvar_dorestartrounds)
if(g_dorestart > 0)
{
if(g_restarted == 0)
{
server_cmd( "exec yourconfig.cfg" );
client_print(0,print_chat,"Autorestarting.")
set_cvar_num("amx_autorestart", 0)
set_cvar_num("amx_autorestartrounds", RESROUNDS)
}
else
{
g_restarted--
set_cvar_num("amx_autorestartrounds", g_restarted)
client_print(0,print_chat,"%d restarts to autorestart.",g_restarted)
}
}
}
This will not load the config 2 rounds after sv_restartround, but it will load it after 2 restarts.
If you still want it to do it after 2 played rounds, just change
EventRoundRestart into the New-round event trigger and hook the clients sv_restartround and link it to the currently named "EventRoundRestart" function.
This is just briefly made to give you an idea about how to do it yourself. Hope it works.