Here you go. Use amx_swapteams to swap teams.
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#define PLUGIN "Swap Teams"
#define VERSION "1.0"
#define AUTHOR "Alka"
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_concmd("amx_swapteams", "concmd_SwapTeams", ADMIN_KICK);
}
public concmd_SwapTeams(id, level, cid)
{
if(!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED;
SwapTeams();
server_cmd("sv_restart 1");
return PLUGIN_HANDLED;
}
SwapTeams()
{
static iMaxPlayers;
if(!iMaxPlayers)
iMaxPlayers = get_maxplayers();
for(new id = 1 ; id <= iMaxPlayers ; id++)
{
if(!is_user_connected(id))
continue;
if(0 < get_user_team(id) < 3)
cs_set_user_team(id, _:(3 - get_user_team(id)));
}
}
__________________