#include #include int map_switches_count = -1; char g_cMaps[800][256]; int g_i_rotate_time = 1; //---------------------------------------------------------------------------------------------------- // Purpose: //---------------------------------------------------------------------------------------------------- public Plugin myinfo = { name = "spam map restarts and counting each time", author = "jenz", description = "spam map restarts", version = "2.0.0", url = "www.unloze.com" }; public void Cvar_rotate_time(ConVar convar, const char[] oldValue, const char[] newValue) { g_i_rotate_time = convar.IntValue; } //---------------------------------------------------------------------------------------------------- // Purpose: //---------------------------------------------------------------------------------------------------- public void OnPluginStart() { ConVar cvar; HookConVarChange((cvar = CreateConVar("sm_map_rotating_time", "5", "time in seconds for map rotation")), Cvar_rotate_time); g_i_rotate_time = cvar.IntValue; delete cvar; RegAdminCmd("sm_restartmaps_test", cmd_restart_the_map, ADMFLAG_GENERIC); new Handle:fileHandle = OpenFile("wtf.txt", "r" ); char lineBuffer[256]; int count = 0; while( !IsEndOfFile( fileHandle ) && ReadFileLine( fileHandle, lineBuffer, sizeof( lineBuffer ) ) ) { TrimString( lineBuffer ); Format(g_cMaps[count], sizeof(g_cMaps[]), lineBuffer); count++; } CloseHandle( fileHandle ); map_switches_count = -1; } public Action cmd_restart_the_map(int client, int args) { map_switches_count = 0; OnMapStart(); return Plugin_Handled; } public void OnMapStart() { if (map_switches_count != -1 && map_switches_count < 500) { CreateTimer(float(g_i_rotate_time), time_query_activity); } } public Action time_query_activity(Handle timer, any data) { int local = map_switches_count; map_switches_count++; LogError("restart count reached: %i. nextmap: %s", map_switches_count, g_cMaps[local]); ForceChangeLevel(g_cMaps[local], ""); return Plugin_Handled; }