This is an example how to change to a specified map.
Use cvar: cm_playercount "<number>" to set when the mod should change map. Default is 16 (you can change it in the code if you want).
PHP Code:
#include <amxmodx>
#define PLUGIN "Change map at X playercount"
#define VERSION "0.1"
#define AUTHOR "RaZ_HU"
new playerCount;
public plugin_init()
{
register_plugin(PLUGIN,VERSION,AUTHOR)
playerCount = register_cvar("cm_playercount","16")
set_task(20.0, "clientnumCheck", 0, _, _, "b") // Run check every 20 seconds
return PLUGIN_CONTINUE;
}
public clientnumCheck(client)
{
new mapname[32]
get_mapname(mapname,31)
// Count how many players are on the server and check if the current map is the same as the wanted one
if(get_playersnum() >=playerCount && strcmp(mapname, "de_dust2"))
{
server_cmd( "changelevel de_dust2");
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
I wanted to add support to be able to change wanted map, but I don't know how to do that yet.