
   /*
   Super Defusion! v0.1.1
   Copyleft jghg 2003
   http://amxmod.net/forums/viewtopic.php?p=131427
   VERSIONS
   ========
   0.1            First version
   0.1.1        Minor tweak
   Super Defusion!
   ===============
   Spawn points for CT and T team are switched on all de maps.
   Time for mp_c4timer is set to maximum, 90 seconds.
   Terrorists: Plant the bomb quickly, and guard it!
   Counter-terrorists: RUUUUUUUUUUUUUUUN!!!!!!!!!!
   USAGE
   =====
   amx_superdefusion
   - Command admin uses to enable/disable Super Defusion! on
   defusion type maps. Does not work on other maps, naturally.
   INSTALLATION
   ============
   1. Compile sma to super_de.amx
   2. Move super_de.amx into amx/plugins
   3. Add a line at the end of amx/plugins/plugins.ini to say:
      super_de.amx
   4. Done
         - Johnny got his gun
   */
   #include <amxmod>
   #include <amxmisc>
   #include <xtrafun>
   #include <vexd_utilities>
   #define TEAM_T 1
   #define TEAM_CT 2
   #define SUPERDEC4TIMER 90
   // Global vars below
   new bool:super_de = false
   new defaultc4timer
   // Global vars above
   public toggle(id,level,cid) {
       if (!cmd_access(id,level,cid,1))
           return PLUGIN_CONTINUE
       if (!super_de) {
           super_de = true
           activate()
           client_print(id,print_console,"Super  Defusion!  is  activated
   for next round!^nC4 timer set to %d seconds!",SUPERDEC4TIMER)
           console_print(0,"Super   Defusion!   is   activated  for  next
   round!^nC4 timer set to %d seconds!",SUPERDEC4TIMER)
           set_hudmessage(0,  100,  0,  -1.0,  0.65, 2, 0.02, 10.0, 0.01,
   0.1, 2)
           show_hudmessage(0,"Super   Defusion!  is  activated  for  next
   round!^nC4 timer set to %d seconds!",SUPERDEC4TIMER)
       }
       else {
           super_de = false
           deactivate()
           client_print(id,print_console,"Disabling Super Defusion!...")
           console_print(0,"Disabling Super Defusion!...")
           set_hudmessage(0,  100,  0,  -1.0,  0.65, 2, 0.02, 10.0, 0.01,
   0.1, 2)
           show_hudmessage(0,"Disabling Super Defusion!...")
       }
       return PLUGIN_HANDLED
   }
   activate() {
       defaultc4timer = get_cvar_num("mp_c4timer")
       set_cvar_num("mp_c4timer",SUPERDEC4TIMER)
       new ent = 0
       do {
           ent = find_entity(ent,classname,"info_player_start")
           if (ent > 0)
               Entvars_Set_String(ent,EV_SZ_classname,"info_player_temp")
       }
       while (ent)
       ent = 0
       new newCtSpawns = 0
       do {
           ent = find_entity(ent,classname,"info_player_deathmatch")
           if (ent > 0) {
               newCtSpawns++
               Entvars_Set_String(ent,EV_SZ_classname,"info_player_start"
   )
           }
       }
       while (ent)
       ent = 0
       do {
           ent = find_entity(ent,classname,"info_player_temp")
           if (ent > 0)
               Entvars_Set_String(ent,EV_SZ_classname,"info_player_deathm
   atch")
       }
       while (ent)
       // Flip buyzones
       ent = 0
       new team
       do {
           ent = find_entity(ent,classname,"func_buyzone")
           if (ent > 0) {
               team = Entvars_Get_Int(ent,EV_INT_team)
               if (team == TEAM_CT)
                   Entvars_Set_Int(ent,EV_INT_team,TEAM_T)
               else if (team == TEAM_T)
                   Entvars_Set_Int(ent,EV_INT_team,TEAM_CT)
           }
       }
       while (ent)
   }
   deactivate() {
       set_cvar_num("mp_c4timer",defaultc4timer)
       new ent = 0
       do {
           ent = find_entity(ent,classname,"info_player_start")
           if (ent > 0)
               Entvars_Set_String(ent,EV_SZ_classname,"info_player_temp")
       }
       while (ent)
       ent = 0
       do {
           ent = find_entity(ent,classname,"info_player_deathmatch")
           if (ent > 0)
               Entvars_Set_String(ent,EV_SZ_classname,"info_player_start"
   )
       }
       while (ent)
       ent = 0
       do {
           ent = find_entity(ent,classname,"info_player_temp")
           if (ent > 0)
               Entvars_Set_String(ent,EV_SZ_classname,"info_player_deathm
   atch")
       }
       while (ent)
       // Flip buyzones
       ent = 0
       new team
       do {
           ent = find_entity(ent,classname,"func_buyzone")
           if (ent > 0) {
               team = Entvars_Get_Int(ent,EV_INT_team)
               if (team == TEAM_CT)
                   Entvars_Set_Int(ent,EV_INT_team,TEAM_T)
               else if (team == TEAM_T)
                   Entvars_Set_Int(ent,EV_INT_team,TEAM_CT)
           }
       }
       while (ent)
   }
   public plugin_init() {
       register_plugin("Super Defusion!","0.1.1","jghg")
       // Make sure this is a de type map, by looking for bomb targets.
       // It seems to exist two different target classnames...
       if    (find_entity(0,classname,"info_bomb_target")    <    1    &&
   find_entity(0,classname,"func_bomb_target") < 1) {
           pause("a")
           return
       }
       register_concmd("amx_superdefusion","toggle",ADMIN_CFG,"-  toggles
   map to be Super Defusion!")
   }
