
   /* AMX Mod script.
   *
   * (c) Copyright 2002-2003, Shromilder
   * Made by Shromilder
   * http://shromy.free.fr
   *
   * Edited by Sy5tem
   * sy5tem@videotron.ca
   *
   * This file is provided as is (no warranties).
   *
   * -=[ AMX swapteams ]=-
   *
   * cya, Shromilder
   *
   * Changelog:
   *  - 1.01: added back cvars mp_limitteams 2 mp_autoteambalance 1 after
   restart. sy5tem
   *  - 1.00: first release
   *
   */
   #include <amxmod>
   #include <amxmisc>
   public restart_round(time[])
   {
       server_cmd("sv_restartround %s",time)
       return PLUGIN_CONTINUE
   }
   public swap()
   {
       new playersCT[32]
       new playersT[32]
       new nbrCT,nbrT
       get_players(playersCT,nbrCT,"e","CT")
       get_players(playersT,nbrT,"e","TERRORIST")
       for(new i = 0; i < nbrCT; i++) {
               engclient_cmd(playersCT[i], "chooseteam")
               engclient_cmd(playersCT[i], "menuselect", "1")
               if (is_user_bot(playersCT[i]))
                   engclient_cmd(playersCT[i], "menuselect", "2")
               else
                   client_cmd(playersCT[i], "slot2")
       }
       for(new i = 0; i < nbrT; i++) {
               engclient_cmd(playersT[i], "chooseteam")
               engclient_cmd(playersT[i], "menuselect", "2")
               if (is_user_bot(playersT[i]))
                   engclient_cmd(playersT[i], "menuselect", "4")
               else
                   client_cmd(playersT[i], "slot4")
       }
       return PLUGIN_CONTINUE
   }
   public swap_teams(id,level,cid)
   {
       if (!cmd_access(id,level,cid,1)) {
           return PLUGIN_HANDLED
       }
       client_print(0,print_chat,"* [AMX] Switching teams!...")
       set_cvar_string("mp_limitteams","0")
       set_cvar_string("mp_autoteambalance","0")
       restart_round("1")
       set_task(2.0,"swap")
       restart_round("2")
       set_cvar_string("mp_limitteams","2")
       set_cvar_string("mp_autoteambalance","1")
       return PLUGIN_CONTINUE
   }
   public plugin_init()
   {
       register_plugin("AMX SwapTeams","1.01","Shromilder")
       register_concmd("amx_swapteams","swap_teams",ADMIN_LEVEL_A,"- Swap
   teams")
       return PLUGIN_CONTINUE
   }
