
   new const PLUGINNAME[] = "AMX Map Bug Fixer"
   new const VERSION[] = "1.1"
   new const AUTHOR[] = "jghg"
   /*
   Copyleft 2003
   http://amxmod.net/forums/viewtopic.php?t=19198
   AMX Map Bug Fixer
   =================
   This plugin should be used in combination with JustinHoMi's Custom Map
   Configs, get it here: http://amxmod.net/forums/viewtopic.php?t=3815
   The  spawn  points of the CT:s in the awp_map.bsp are rotated a little
   unfair, so you spawn facing the wall.
   With  this  plugin  and  the  Custom  Map  Configs plugin you can have
   problems  like  this  permantently fixed on any map, without having to
   change the mapfile itself.
   Just  add  a short line (like "amx_spawnangle ct = 180") to the config
   file of the map you want to fix, and you're set.
   You  can  also use the same command to turn the spawns in-game, should
   you ever need to. (ADMIN_CFG access required)
   Requires Vexd utilities module.
   /jghg
   USAGE
   =====
   amx_spawnangle  <team  (ct,  t,  or  vip)>  <mode  (=,  - or +)> <# of
   degrees>
   Example uses:
       amx_spawnangle  t  +  180    (this TURNS all terrorists spawns 180
   degrees counter-clockwise if seen from above)
       amx_spawnangle ct = 45    (this SETS all counter-terrorists spawns
   to exactly 45 degrees)
       amx_spawnangle  vip  + 4    (you can TURN and SET vip's spawn too,
   if you want...)
   Some suggested fixes for a few maps:
   he_tennis.bsp:    amx_spawnangle ct = 180
   awp_map.bsp:    amx_spawnangle ct = 180
   3rooms.bsp:        amx_spawnangle t = 180
   VERSIONS
   ========
   1.1,  031227  Removed  use  of isdigit function, which means this will
   probably work on older amx versions (?).
   1.0,  031205  Complete change of everything. :-) We now rely on Custom
   Map Configs, and use amx_spawnangle to set the angles...
   0.3, 031204    Removed to only use vexd and not xtrafun.
               Fixed 3rooms.bsp
               Changed  plugin  name  because  of  more  support for more
   maps...
   0.2, ??????    Same problem with he_tennis, added support :-)
   0.1, ??????    First version
   */
   #include <amxmod>
   #include <amxmisc>
   #include <vexd_utilities>
   public spawnangle_cmd(id, level, cid) {
       if (!cmd_access(id,level,cid,4)) {
           console_print(id,    "Example    use:  amx_spawnangle   ct   +
   180  (adds 180 degrees to all CTs' spawnangles)")
           return PLUGIN_HANDLED
       }

       // Get parameters
       new arguments[100]
       read_args(arguments, 99)
       new team[4]
       new mode[2]
       new degrees[10]
       if (parse(arguments, team, 3, mode, 1, degrees, 9) != 3) {
           console_print(id, "[AMX] Error - couldn't read parse line!")
           server_print("[AMX] Error - couldn't read parse line!")
           return PLUGIN_HANDLED
       }
       // Check team
       // info_vip_start = vip spawn
       // info_player_start = ct spawn
       // info_player_deathmatch = t spawn
       new spawnentity[30]
       if (equali(team, "ct"))
           spawnentity = "info_player_start"
       else if (equali(team, "t"))
           spawnentity = "info_player_deathmatch"
       else if (equali(team, "vip"))
           spawnentity = "info_vip_start"
       else {
           console_print(id,  "[AMX]  Error  - ^"%s^" is not a valid team
   (use ct, t, or vip)", team)
           return PLUGIN_HANDLED
       }

       // Check mode
       if (!equal(mode, "+") && !equal(mode, "-") && !equal(mode, "=")) {
           console_print(id,  "[AMX]  Error  - ^"%s^" is not a valid mode
   (use +, - or =)", mode)
           return PLUGIN_HANDLED
       }

       // Check degrees
       for (new i = 0;i < strlen(degrees);i++) {
           //if (!isdigit(degrees[i])) {
           if (degrees[i] < '0' || degrees[i] > '9') {
               console_print(id,  "[AMX]  Error  -  ^"%s^"  is  not valid
   degrees (use only numbers)", degrees)
               return PLUGIN_HANDLED
           }
       }

       new Float:degreesvalue = floatstr(degrees)
       // Do it... the rotation of spawns, that is :-)
       new ent = 1, Float:angles[3], counter = 0
       server_print("[AMX] Turning all %s spawn points...", team)
       do {
           ent = FindEntity(ent, spawnentity)
           if (ent != -1) {
               Entvars_Get_Vector(ent,EV_VEC_angles,angles)

               if (equal(mode, "+"))
                   angles[1] += degreesvalue
               else if (equal(mode, "-"))
                   angles[1] -= degreesvalue
               else
                   angles[1] = degreesvalue
               Entvars_Set_Vector(ent,EV_VEC_angles,angles)
               counter++
           }
       }
       while (ent != -1)

       console_print(id, "[AMX] Turned %d %s:s.", counter, spawnentity)
       return PLUGIN_HANDLED
   }
   public plugin_init() {
       register_plugin(PLUGINNAME, VERSION, AUTHOR)
       register_concmd("amx_spawnangle",   "spawnangle_cmd",   ADMIN_CFG,
   "<team>  <+/=>  <degrees>  (+ turn team's spawns degrees, = set team's
   spawns to degree direction)")
   }
