Hello everyone, i made this plugin by bothering pieces from other plugins.
baiscally what i want the plugin to do is to check the player count and the map that are on the server and change the map if there is less/more than a certain amount of players based on the map
example: if is de_dust2x2 and more than 15 players online change map to de_dust2, if is de_dust2 and less than 15 players online change to de_dust2x2.
my problem is, the plugin change the map but enter in a loop and change it continously
baiscally what i want the plugin to do is to check the player count and the map that are on the server and change the map if there is less/more than a certain amount of players based on the map
example: if is de_dust2x2 and more than 15 players online change map to de_dust2, if is de_dust2 and less than 15 players online change to de_dust2x2.
my problem is, the plugin change the map but enter in a loop and change it continously
Код:
#include <amxmodx>
#include <amxmisc>
public plugin_init()
{
set_task(5.0,"check_online_count",8757,_,_,"b",0);
}
public check_online_count()
{
new iPlayers[32], iNum, player,count;
get_players(iPlayers,iNum);
for(new i=0;i<iNum;i++)
{
player = iPlayers[i];
if(is_user_connected(player) && !is_user_hltv(player))
{
count++;
}
}
new mapname[32];
get_mapname(mapname,31);
if(count==0 && !equal(mapname, "de_dust2"))
{
server_cmd("amx_map de_dust2x2");
}
else if(count<14 && !equal(mapname, "de_mirage"))
{
server_cmd("amx_map de_dust2x2");
}
else if(count<14 && !equal(mapname, "de_train"))
{
server_cmd("amx_map de_dust2x2");
}
else if(count<14 && !equal(mapname, "de_nuke"))
{
server_cmd("amx_map de_dust2x2");
}
else if(count==1 && !equal(mapname, "de_dust2x2"))
{
server_cmd("amx_map de_dust2");
}
}