Quote:
Originally Posted by Ziverts
RaZ_HU looks good, thank you, i test this this evening ~21:00 GMT +2 
Yes, it would be stylish if script dispense players question whether they want to be changed when the map number of players are like 16
|
Your welcome, also I have forgot to set that current map should not be the same as the selected one. (tl;dr: I have forgot to put a !)
So use this corrected code:
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
}