Try this:
PHP Code:
#include <amxmodx>
#define NEW_MAP_DELAY 300
#define TRIGGER_DELAY 120
#define CHECK_TIME 30
new g_bMap_dust
new g_bMap_dust2
new g_iUpperDelay, g_iLowerDelay
public plugin_init()
{
register_plugin("Player-Based Map Cycler", "1.0", "")
new szMap[32]
get_mapname(szMap, charsmax(szMap))
g_bMap_dust = equal(szMap, "de_dust")
g_bMap_dust2 = equal(szMap, "de_dust2")
set_task(float(NEW_MAP_DELAY), "startChecking")
}
public startChecking()
{
set_task(float(CHECK_TIME), "checkCondition", .flags="b")
}
public checkCondition()
{
new iPlayersNum = get_playersnum()
g_iUpperDelay = iPlayersNum > 24 ? g_iUpperDelay + CHECK_TIME : 0
g_iLowerDelay = iPlayersNum < 16 ? g_iLowerDelay + CHECK_TIME : 0
if( g_iUpperDelay > TRIGGER_DELAY && !g_bMap_dust2 )
{
server_cmd("changelevel de_dust2")
}
else if( g_iLowerDelay > TRIGGER_DELAY && !g_bMap_dust )
{
server_cmd("changelevel de_dust")
}
}
You can configure the timing parameters in the #defines toward the top. It's currently set to start checking after 300 seconds after the map start and will then check every 30 seconds. The map will change only if it has met the threshold for 120 continuous seconds.
__________________