I'm amazed by the thing I said in new plugins and people posting when they have no clue at all what they're talking about.
Code:
/* Kick all clients by eRik */
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "Kick All Clients"
#define VERSION "0.1"
#define AUTHOR "eRik"
#define REASON "Mapchanging..."
new g_pMap
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_concmd("amx_kickall","kick_all",ADMIN_KICK,"Kick all clients")
g_pMap = register_cvar("mapname","de_dust2")
}
// must be public if you call it like this
public kick_all(reason[])
{
// because it can only be used once, might as well make it new
new iPlayers[32],iPlayersnum
get_players(iPlayers,iPlayersnum)
for(new iCount;iCount < iPlayersnum;iCount++)
server_cmd("kick #%d %s",get_user_userid(iPlayers[iCount]),REASON)
changemap()
// you don't need to return PLUGIN_HANDLED everywhere, in fact in most cases it might
// screw up your script
}
// doesn't have to be public, it's called internally (wtf was up with the set_task?)
changemap()
{
new szMap[33]
get_pcvar_string(g_pMap,szMap,32)
if(is_map_valid(szMap))
server_cmd("changelevel %s",szMap)
else
{
log_amx("Error: map specified not valid, defaulting to de_dust2")
server_cmd("changelevel de_dust2")
}
}
__________________