#include <amxmodx>
#define PLUGIN "Online Helper"
#define VERSION "0.2"
#define AUTHOR "Nordic Warrior"
#define MAP "de_dust2_2x2" // Карта по умолчанию
#define TIME 5 // Через сколько минут карта сменится на карту по умолчанию
new g_Timelimit
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
set_task(15.0, "check_players_1", 1,.flags="b")
set_task(1.0, "check_cvar", 5)
if(!is_map_valid(MAP)) pause("ad"), log_amx("Map %s not found.", MAP)
}
public check_players_1(id)
{
new players[32], Count, mapname[32]
get_players(players, Count, "ch")
get_mapname(mapname,31)
if(Count == 0)
{
if(equal(mapname,MAP,strlen(MAP)))
{
set_cvar_num("mp_timelimit", 0)
remove_task(1)
set_task(5.0, "check_players_2", 3,.flags="b")
}
else set_task(TIME * 60.0, "change_map", 2)
}
change_task(1, 5.0)
}
public check_players_2(id)
{
new players[32], Count
get_players(players, Count, "ch")
if(Count > 0)
{
if(task_exists(2)) remove_task(2)
server_cmd("sv_restartround 1")
set_task(1.5, "change_cvar", 4)
remove_task(3)
set_task(5.0, "check_players_1", 1,.flags="b")
}
}
public change_cvar() set_cvar_num("mp_timelimit", g_Timelimit)
public change_map() server_cmd("changelevel %s", MAP)
public check_cvar() g_Timelimit = get_cvar_num("mp_timelimit")