
   /*********************************************************************
   ******
   *  amx_ejl_outofbounds.sma    version                1.5         Date:
   1/6/2003-2/23/2003
   *   Author: Eric Lidman     ejlmozart@hotmail.com
   *   Alias: Ludwig van       Upgrade:
   http://lidmanmusic.com/cs/plugins.html
   *
   *  Set artifical boundaries around maps to help prevent players from
   *   exploiting holes in maps. Most of these problems occur on more fun
   *   oriented  servers  where  for  example, especially when gravity is
   low,
   *   but  also when prizes like noclip are given to players for rolling
   dice,
   *   player  teleportation, or a combination of all those elements. The
   real
   *   problem, besides just being inaccesible off the map, is that these
   *   places  on  the  map offer cover to snipers where they can see you
   fine
   *   but  you  cant  see them. The characteristics of the maps in those
   places
   *   make  these  places invisible, and deadly. Its not fair. Sometimes
   it just
   *   about  keeping  players  from  places  they  just shouldnt be. The
   concept is
   *   simple.  We  draw an imaginary box around the map. Inside the box,
   and
   *   therefore  inside  the map, you are safe, outside the box, you are
   slapped
   *   for  a  bit  until you are killed. There is a cool lighning effect
   for
   *   every  violation.  Not  only  is  the lightning cool, but it helps
   alert
   *   others where the violator is.  Its not effective against all map
   *   exploits  by  any  means,  but  ts  a  big help. Often we are only
   defending
   *   one  "side"  of  the  box/map, usually the ceiling/sky, so in many
   cases
   *   only  the  top side of the "box" needs to be set and that does the
   job.
   *   I  have  used  this  plugin  ever  since I wrote it for adminmod 6
   months
   *   ago,  and  with  the  craziness  on  my  server, its a welcome and
   effective
   *   solution.  It comes with 15 maps I set bounds for on my server. If
   you
   *   dont like them there are tones of in-game commands which which you
   can
   *   change or delete these boudaries altogether. No need to set up any
   *   configs  or  files,  the plugin generates whatever it needs on its
   own.
   *   New:  now in addition to setting a box around the map, you can set
   up to
   *   2 restricted area boxes within the map to catch a few of those
   *   troublesome nooks and cranies that the big box could not cover.
   *   My  favorite command: amx_makebounds_forfools (wrote it for myself
   lol)
   *
   *  Commands:   (ADMIN_RCON   required.  These  are  owner,  not  admin
   matters)
   *
   *   amx_mapbounds_kill                 Toggles  on and off the ability
   for out
   *                                      of  bounds  to  be lethal. Sets
   default
   *                                      for  the  server  for  all maps
   that you
   *                                      do     not     provide     kill
   instructions for.
   *   amx_mapbounds_slap  <damage>        Set  the  damage  each  out of
   bounds
   *                                      slap does. Sets Default for the
   server
   *                                      for   all   maps  you  did  not
   provide
   *                                      specific       slap      damage
   instructions for.
   *                                      Usage example:
   *                                       amx_mapbounds_slap 30
   *   amx_mapbounds                      Toggles  on  and  off  'out  of
   bounds'
   *                                      checking  and  punishing.  Sets
   default
   *                                      too      if      issued      as
   amx_mapbounds_default.
   *                                      Default  function  is  only for
   RCON level
   *   amx_makebounds  <kill>  <damage>     Go to six extremities of map,
   issue
   *                                      this once at each one to set up
   *                                      bounds.  As  you  issue it, the
   plugin
   *                                      instructs   and   advises   you
   through
   *                                      many  console  messages.  The 6
   points
   *                                      on  the map represent the faces
   of a
   *                                      6  sided  polygon.  Go  to  the
   farthest
   *                                      point   you   can  in  those  6
   directions,
   *                                      north,  south,  east, west, up,
   down.
   *                                      Issue   the   command  at  that
   farthest
   *                                      point.  Once  the  6  sides are
   taken,
   *                                      you  will  be  asked to specify
   default
   *                                      slap  damage  and  whether  the
   plugin
   *                                      can  kill  a  player  for going
   outside
   *                                      the box your points make.
   *                                      Usage examples:
   *                                       amx_makebounds
   *                                       amx_makebounds          NOKILL
   0
   *                                       amx_makebounds KILL 15
   *   amx_makebounds_fordummies <kill/done> <damage>
   *                                      For  the most part this command
   does
   *                                      the      same      thing     as
   amx_makebounds. The
   *                                      differences is you can issue it
   up to
   *                                      1000 times in an attempt to set
   these
   *                                      artificial  borders  around the
   map. The
   *                                      idea  is  that  you walk around
   the map
   *                                      against the outer most parts of
   it.
   *                                      Circle the whole map, and along
   the
   *                                      way,  issue  the  command  wile
   pressed
   *                                      against  that  outermost  wall.
   Take lots
   *                                      of  samples  of bounds, you can
   take up
   *                                      to  1000, that should be enough
   to
   *                                      circle  the map. Dont forget to
   go to
   *                                      the   highest  piont  and  mark
   that, then
   *                                      do the same for the lowest part
   of the
   *                                      map  --  best done squatting in
   the lowest
   *                                      part.   If  you  feel  you  got
   enough bounds
   *                                      samples  before you reach 1000,
   issue the
   *                                      command with a 'done' after it,
   then the
   *                                      next  step  is  just  like  the
   above command.
   *                                       amx_makebounds_fordummies
   *                                       amx_makebounds_fordummies done
   *                                       amx_makebounds_fordummies
   NOKILL 0
   *                                       amx_makebounds_fordummies KILL
   15
   *   amx_makebounds_forfools <kill/done> <damage>
   *                                      This is really a simplified and
   more of
   *                                      an    automated    version   of
   amx_makebounds
   *                                      Basically,    you   isuus   the
   command once,
   *                                      a  timer starts in the HUD, run
   around the
   *                                      perimeter of the map, go to the
   highest
   *                                      and  lowest  points on the map,
   wait for
   *                                      the  timer to finish. Done. Or,
   if you dont
   *                                      want  to  wait  for  the timer,
   issue this
   *                                      command  again and it will give
   you a
   *                                      choice    of    punsiments    -
   optional, or just
   *                                      enter  the command once more --
   done. It
   *                                      automatically              does
   amx_writebounds for
   *                                      you assuming you are a fool and
   would
   *                                      forget to save your boudaries.
   *                                       amx_makebounds_forfools
   *                                       amx_makebounds_forfools done
   *                                       amx_makebounds_forfools NOKILL
   0
   *                                       amx_makebounds_forfools   KILL
   15
   *   amx_makebound  <type:  high_x|low_x|high_y|low_y|top|bottom [KILL]
   [DAMAGE]>
   *                                      Set  one  wall with a boundary,
   leave
   *                                      rest  alone.  This  is only for
   server
   *                                      operators   that  have  a  good
   grasp of
   *                                      both how this plugin works, and
   what
   *                                      the  various  x,y,z  coordiates
   mean on
   *                                      a                          map.
   x,-x,y,-y,z,-z,KILL/NOKILL 0
   *                                      Usage examples:
   *                                       amx_makebound x NOKILL 12
   *                                       amx_makebound -z KILL 50
   *                                       amx_makebound y KILL 99
   *   amx_setbox_1  <'punishmnents'  |  'done'  |  [<KILL/NOKILL>  <SLAP
   DAMAGE>]
   *                                      see  amx_setbox_2  (you  get  2
   boxes)
   *   amx_setbox_2  <'punishmnents'  |  'done'  |  [<KILL/NOKILL>  <SLAP
   DAMAGE>]
   *                                      This  allows  you  to set a box
   within
   *                                      the  map  as a restricted area.
   The
   *                                      plugin  will  guide you through
   the
   *                                      process   of  setting  up  your
   boxes.
   *                                      Usage examples:
   *                                       amx_setbox_2 done
   *                                       amx_setbox_2 KILL 50
   *                                       amx_setbox_2 punishments
   *                                       amx_setbox_2 NOKILL 1
   *   amx_resetbounds                    Revert  to  whatever bounds are
   in the
   *                                      out_of_bounds.txt file. Helpful
   if
   *                                      you  made  a  mistake or wan to
   start
   *                                      over     ifyou    were    doing
   amx_makebounds
   *   amx_writebounds                    Writes the bounds calculated be
   *                                      amx_makebounds              and
   amx_makebound to
   *                                      file,     overwiting    preious
   bounds.
   *                                      Only  do  this command when you
   are
   *                                      sure  you  like the box you set
   up.
   *   amx_deletebounds                   Deletes  the  boudaries  in the
   file
   *                                      for  that  map  and  sets to no
   bounds.
   *   amx_mapbounds_mappd [Optional <KILL/NOKILL> <SLAP DAMAGE>]
   *                                      Set  default bounds punishiment
   for
   *                                      the map you are on.
   *                                      Usage examples:
   *                                       amx_mapbounds_mappd KILL 10
   *                                       amx_mapbounds_mappd NOKILL 1
   *                                       amx_mapbounds_mappd KILL 0
   *
   *  Final  note: Once again I say when doing amx_makebounds, the plugin
   will
   *   guide  you  through  the process. Please read all the instructions
   and
   *   infor  it  gives  you.  This  is  best  done of course on an empty
   server, a
   *   server maintainence task.
   *
   **********************************************************************
   ***/
   #include <amxmod>
   new vault_value[128]
   new OOB_SLAP_DAMAGE = 30
   new bool:deadly = true
   new bool:oob = true
   new slap_d_d = -1
   new deadly_d = 0
   new counter = -1
   new cguy = 0
   new cguys[33]
   new calccoords[2000][3]
   new make_p = 0
   new making_box = 0
   new pun_box
   new box1, box2
   new box_bounds[12]
   new box1slap,box2slap
   new bool:box1deadly
   new bool:box2deadly
   new done_calc = 0
   new init_map = 0
   new map_watch =0
   new ThisMap[32]
   new punishments[33]
   new the_bounds[6]
   new light
   new smoke
   lightning(vec1[3],vec2[3])
   {
      //Lightning
      message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
      write_byte( 0 )
      write_coord(vec1[0])
      write_coord(vec1[1])
      write_coord(vec1[2])
      write_coord(vec2[0])
      write_coord(vec2[1])
      write_coord(vec2[2])
      write_short( light )
      write_byte( 1 ) // framestart
      write_byte( 5 ) // framerate
      write_byte( 2 ) // life
      write_byte( 20 ) // width
      write_byte( 30 ) // noise
      write_byte( 200 ) // r, g, b
      write_byte( 200 ) // r, g, b
      write_byte( 200 ) // r, g, b
      write_byte( 200 ) // brightness
      write_byte( 200 ) // speed
      message_end()
      //Sparks
      message_begin( MSG_PVS, SVC_TEMPENTITY,vec2)
      write_byte( 9 )
      write_coord( vec2[0] )
      write_coord( vec2[1] )
      write_coord( vec2[2] )
      message_end()
      //Smoke
      message_begin( MSG_BROADCAST,SVC_TEMPENTITY,vec2)
      write_byte( 5 ) // 5
      write_coord(vec2[0])
      write_coord(vec2[1])
      write_coord(vec2[2])
      write_short( smoke )
      write_byte( 10 )  // 10
      write_byte( 10 )  // 10
      message_end()
   }
   outofbounds_punish(id){
       new modname[32]
       get_modname(modname,32)
       if(equal(modname,"cstrike")){
           client_cmd(0, "spk ^"ambience/thunder_clap.wav^"")
       }else{
           emit_sound(id,CHAN_BODY,   "ambience/thunder_clap.wav",   1.0,
   ATTN_NORM, 0, PITCH_NORM)
       }
       punishments[id] += 1
       if(punishments[id] > 5){
           if(pun_box > 0){
               if(pun_box == 1){
                   if(box1deadly == true){
                       user_kill(id,1)
                       punishments[id] = 2
                   }else{
                       if(get_user_health(id) > box1slap +1){
                           user_slap(id,box1slap)
                       }else{
                           user_slap(id,0)
                           set_user_health(id,1)
                       }
                       punishments[id] = 2
                   }
               }
               else if(pun_box == 2){
                   if(box2deadly == true){
                       user_kill(id,1)
                       punishments[id] = 2
                   }else{
                       if(get_user_health(id) > box2slap +1){
                           user_slap(id,box2slap)
                       }else{
                           user_slap(id,0)
                           set_user_health(id,1)
                       }
                       punishments[id] = 2
                   }
               }
           }else{
               if(deadly == true){
                   user_kill(id,1)
                   punishments[id] = 2
               }else{
                   if(get_user_health(id) > OOB_SLAP_DAMAGE +1){
                       user_slap(id,OOB_SLAP_DAMAGE)
                   }else{
                       user_slap(id,0)
                       set_user_health(id,1)
                   }
                   punishments[id] = 2
               }
           }
       }else{
           if(pun_box > 0){
               if(pun_box == 1){
                   if(get_user_health(id) > box1slap +1){
                       user_slap(id,box1slap)
                   }else{
                       user_slap(id,0)
                       set_user_health(id,1)
                   }
               }
               else if(pun_box == 2){
                   if(get_user_health(id) > box2slap +1){
                       user_slap(id,box2slap)
                   }else{
                       user_slap(id,0)
                       set_user_health(id,1)
                   }
               }
           }else{
               if(get_user_health(id) > OOB_SLAP_DAMAGE +1){
                   user_slap(id,OOB_SLAP_DAMAGE)
               }else{
                   user_slap(id,0)
                   set_user_health(id,1)
               }
           }
       }
       pun_box = 0
       new Sid[1]
       Sid[0] = id
       set_task(0.3,"punish_fx",1317,Sid,1,"a",6)
   }
   public punish_fx(sfxid[]){
       new fxid = sfxid[0]
       new origin[3]
       get_user_origin(fxid,origin)
       origin[2] = origin[2] - 26
       new sorigin[3]
       sorigin[0] = 0
       sorigin[1] = 0
       sorigin[2] = 3700
       lightning(sorigin,origin)
       return PLUGIN_HANDLED
   }
   public map_watch_action(){
       if( (map_watch == 0) || (oob == false) ){
           return PLUGIN_CONTINUE
       }
       new maxplayers = get_maxplayers()+1
       new Name[33]
       new uxyz[3]
       for (new iC=1; iC<=maxplayers; iC++){
           if(is_user_alive(iC) == 1){
               get_user_origin(iC,uxyz)
               if((uxyz[0]  > the_bounds[0]) || (uxyz[0] < the_bounds[1])
   ||
               (uxyz[1] > the_bounds[2]) || (uxyz[1] < the_bounds[3]) ||
               (uxyz[2] > the_bounds[4]) || (uxyz[2] < the_bounds[5]) ){
                   if(uxyz[2] != 3700){
                       outofbounds_punish(iC)
                       client_print(iC,print_chat,"<Server>  You     were
   outside of the legal bounds.")
                       get_user_name(iC,Name,33)
                       log_message("[AMX] MAPWATCH %i %i %i %i %i %i USER
   %i %i
   %i",the_bounds[0],the_bounds[1],the_bounds[2],the_bounds[3],the_bounds
   [4],the_bounds[5],uxyz[0],uxyz[1],uxyz[2])
                       set_hudmessage(0,255,0,  -1.0, 0.25, 2, 0.02, 7.0,
   0.01, 0.1, 2)
                       show_hudmessage(0,"%s  has  been punished^nbecause
   he went out of bounds.", Name)
                   }
               }else{
                   if(box1 == 1){
                       if((uxyz[0]   <   box_bounds[0])   &&  (uxyz[0]  >
   box_bounds[1]) &&
                       (uxyz[1]    <   box_bounds[2])   &&   (uxyz[1]   >
   box_bounds[3]) &&
                       (uxyz[2]    <   box_bounds[4])   &&   (uxyz[2]   >
   box_bounds[5]) ){
                           if(uxyz[2] != 3700){
                               log_message("[AMX]  MAPWATCH BOX1 %i %i %i
   %i %i %i USER %i %i
   %i",box_bounds[0],box_bounds[1],box_bounds[2],box_bounds[3],box_bounds
   [4],box_bounds[5],uxyz[0],uxyz[1],uxyz[2])
                               pun_box = 1
                           }
                       }
                   }
                   if(box2 == 1){
                       if((uxyz[0]   <   box_bounds[6])   &&  (uxyz[0]  >
   box_bounds[7]) &&
                       (uxyz[1]    <   box_bounds[8])   &&   (uxyz[1]   >
   box_bounds[9]) &&
                       (uxyz[2]   <   box_bounds[10])   &&   (uxyz[2]   >
   box_bounds[11]) ){
                           if(uxyz[2] != 3700){
                               log_message("[AMX]  MAPWATCH BOX2 %i %i %i
   %i %i %i USER %i %i
   %i",box_bounds[6],box_bounds[7],box_bounds[8],box_bounds[9],box_bounds
   [10],box_bounds[11],uxyz[0],uxyz[1],uxyz[2])
                               pun_box = 2
                           }
                       }
                   }
                   if(pun_box > 0){
                       outofbounds_punish(iC)
                       client_print(iC,print_chat,"<Server>  You are in a
   restricted area of the map.")
                       get_user_name(iC,Name,33)
                       set_hudmessage(0,255,0,  -1.0, 0.25, 2, 0.02, 7.0,
   0.01, 0.1, 2)
                       show_hudmessage(0,"%s    has   been   punished^nhe
   violated a restriced area of the map.", Name)
                   }
               }
           }
       }
       return PLUGIN_CONTINUE
   }
   public set_map_bounds(){
       map_watch = 0
       get_mapname(ThisMap, 32)
       if(file_exists("addons/amx/out_of_bounds.txt") == 1){
           new line = 0
           new data[192]
           new stextsize = 0
           while((line=read_file("addons/amx/out_of_bounds.txt",line,data
   ,192,stextsize))!=0){
               new map[32]
               new sthe_bounds[6][16]
               new sKNK[16]
               new ssD[8]
               new sbox[12][16]
               new sboxpun[4][8]
               parse(data,map,32,sthe_bounds[0],16,sthe_bounds[1],16,sthe
   _bounds[2],16,sthe_bounds[3],16,sthe_bounds[4],16,sthe_bounds[5],16,sK
   NK,16,ssD,8,
                   sbox[0],16,sbox[1],16,sbox[2],16,sbox[3],16,sbox[4],16
   ,sbox[5],16,sboxpun[0],8,sboxpun[1],8,
                   sbox[6],16,sbox[7],16,sbox[8],16,sbox[9],16,sbox[10],1
   6,sbox[11],16,sboxpun[2],8,sboxpun[3],8)
               if(equali(map,ThisMap)){
                   map_watch = 1
                   for (new i=0; i<=5; i++){
                       if(equali(sthe_bounds[i],"N")){
                           if( (i == 0) || (i == 2) || (i == 4) ){
                               the_bounds[i] = 20000
                           }else{
                               the_bounds[i] = -20000
                           }
                       }else{
                           the_bounds[i] = str_to_num(sthe_bounds[i])
                       }
                   }
                   if(equali(sKNK,"KILL-OFF"))
                       deadly = false
                   if(equali(sKNK,"KILL-ON"))
                       deadly = true
                   if(equali(ssD,"S",1))
                       OOB_SLAP_DAMAGE = strtonum(ssD[1])
                   if(equali(sboxpun[0],"KILL")){
                       box1 = 1
                       box1deadly = true
                   }
                   if(equali(sboxpun[0],"NOKILL")){
                       box1 = 1
                       box1deadly = false
                   }
                   if(equali(sboxpun[2],"KILL")){
                       box2 = 1
                       box2deadly = true
                   }
                   if(equali(sboxpun[2],"NOKILL")){
                       box2 = 1
                       box2deadly = false
                   }
                   box1slap = str_to_num(sboxpun[1])
                   box2slap = str_to_num(sboxpun[3])
                   if( (box1 == 1) || (box2 == 1) ){
                       for (new i=0; i<=11; i++){
                           if(equali(sbox[i],"N")){
                               box_bounds[i] = 20000
                           }else{
                               box_bounds[i] = str_to_num(sbox[i])
                           }
                       }
                   }
               }
           }
       }else{
           write_file("addons/amx/out_of_bounds.txt","***  ARTIFICIAL MAP
   BOUNDARIES  FILE. SEE README. FORMAT:  mapname Xhi Xlo Yhi Ylo Zhi Zlo
   [optional   <KILL-ON/KILL-OFF>  <SLAP  DAMAGE>]  <<<no  restriction  =
   N>",-1)
           write_file("addons/amx/out_of_bounds.txt","de_cbble  N  N  N N
   476 N",-1)
           write_file("addons/amx/out_of_bounds.txt","cs_italy   N   N  N
   -2093 N N",-1)
           write_file("addons/amx/out_of_bounds.txt","de_driveby     3440
   -1745 3792 -3121 1100 -260",-1)
           write_file("addons/amx/out_of_bounds.txt","fy_pool_day N N N N
   N -180",-1)
           write_file("addons/amx/out_of_bounds.txt","he_pool_night N N N
   N N -180",-1)
           write_file("addons/amx/out_of_bounds.txt","de_dust N N N N 228
   N",-1)
           write_file("addons/amx/out_of_bounds.txt","de_dawn N N N N 228
   N",-1)
           write_file("addons/amx/out_of_bounds.txt","de_winterdust N N N
   N 228 N",-1)
           write_file("addons/amx/out_of_bounds.txt","de_jeepathon10k N N
   N N 690 N",-1)
           write_file("addons/amx/out_of_bounds.txt","cs_assault  N N N N
   630 N",-1)
           write_file("addons/amx/out_of_bounds.txt","de_driver2k    3856
   -3857 2800 -2257 451 -800",-1)
           write_file("addons/amx/out_of_bounds.txt","scout_map 1412 -457
   2312 -392 N N",-1)
           write_file("addons/amx/out_of_bounds.txt","starwars 3312 -3497
   2544 -1521 N N",-1)
           write_file("addons/amx/out_of_bounds.txt","cs_funpark     2416
   -3697 2160 -3937 N -1759",-1)
           write_file("addons/amx/out_of_bounds.txt","nth_lets_take_mothe
   rs_tank N N N N 525 N",-1)
       }
       if(init_map == 0)
           set_task(2.3,"map_watch_action",3121,"",0,"a", 9999)
       init_map = 1
       return PLUGIN_CONTINUE
   }
   public make_b_for_fools(id){
       if (!(get_user_flags(id)&ADMIN_RCON)) {
           client_print(id,print_console,"[AMX]  You  have  no  access to
   that command")
           return PLUGIN_HANDLED
       }
       if(cguy != id){
           if(cguy != 0){
               client_print(id,print_console,"[AMX]  Too many chefs spoil
   the stew. Some other admin is already in the middle of this.")
               return PLUGIN_HANDLED
           }
       }
       new auto_done = 0
       cguy = id
       cguys[id] = 1
       if(counter == -1){
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_cmd(id,"echo  [AMX]  Welcome to the 'make map boudaries
   for fools' command")
           client_cmd(id,"echo [AMX] To make boundaries for this map, you
   will go along all the outside most")
           client_cmd(id,"echo  [AMX]  walls of the map, the places where
   you do not want clients to pass.")
           client_cmd(id,"echo  [AMX]  OK!  Get moving! Your instructions
   will be in the HUD now.")
           client_cmd(id,"echo ")
           map_watch = 0
           counter = 0
           done_calc = 0
           new sid[1]
           sid[0] = id
           set_task(0.2,"mb_fool",5456,sid,1,"a",1999)
           return PLUGIN_HANDLED
       }
       if( (counter > 1999) && (done_calc == 1) ){
           done_calc = 2
           auto_done = 1
       }
       if(counter < 400){
           client_cmd(id,"echo ")
           client_cmd(id,"echo  [AMX]  No way you can be done yet, unless
   this is a small map. Must wait till counter is 1600 or less")
           client_cmd(id,"echo ")
       }else{
           if(done_calc == 0){
               done_calc = 1
           }
       }
       if( (counter > 400) && (done_calc == 1)){
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_cmd(id,"echo  [AMX]  Now  enter  this  command again to
   specify default punishments for this map.")
           client_cmd(id,"echo [AMX] Options: Allow out of bounds to kill
   player after warning slaps: KILL/NOKILL")
           client_cmd(id,"echo  [AMX]  Options:  Amount of damage warning
   slaps do. 0-99")
           client_cmd(id,"echo   [AMX]   Format:  amx_makebounds_forfools
   <KILL/NOLILL> <SLAP DAMAGE>")
           client_cmd(id,"echo   [AMX]  Example:  amx_makebounds_forfools
   KILL 30")
           client_cmd(id,"echo [AMX] If the command is issued without any
   options, plugin default 'KILL 30' will be used")
           done_calc = 2
           remove_task(5456,0)
           return PLUGIN_HANDLED
       }
       if(done_calc == 2){
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           new arg2[16]
           new arg3[8]
           if(!read_argv(1,arg2,16)){
               client_cmd(id,"echo  [AMX]  No  map  default set for KILL,
   server default will be used.")
               deadly_d = 0
           }
           else if(equali(arg2,"NOKILL")){
               deadly = false
               deadly_d = 1
               client_cmd(id,"echo  [AMX]  Plugin is set to be non-lethal
   in punishing bounds violators for this map. Default")
           }else{
               deadly_d = 2
               deadly = true
               client_cmd(id,"echo  [AMX]  Plugin  is  set to KILL bounds
   violators after a few warning slaps for this map. Default")
           }
           if(!read_argv(2,arg3,8)){
               slap_d_d = -1
               client_cmd(id,"echo  [AMX]  No  map  default  set for slap
   damage, server default will be used")
           }else{
               if( (strtonum(arg3) < 0) || (strtonum(arg3) > 99) ){
                   slap_d_d = -1
                   client_cmd(id,"echo  [AMX]  Slap entry invalid. No map
   default set. Slap damage set to server default")
               }else{
                   slap_d_d = strtonum(arg3)
                   OOB_SLAP_DAMAGE = strtonum(arg3)
                   client_cmd(id,"echo  [AMX] Slap damage map default set
   to your specifications")
               }
           }
           client_cmd(id,"echo  [AMX]  Proceeding  to calculate and apply
   new boudaries.")
           do_boundcalc(id)
           amx_writebounds(id)
           if(auto_done == 1){
               auto_done = 0
               new strMessage[192]
               format(strMessage,192,"Map bounds have been set^n^nDefault
   KILL    and    slap   damage   for   ^nout   of   bounds   is   server
   default.^nBoundaries  have  been written to file.^nThank you for using
   amx_makebounds_forfools")
               set_hudmessage(200,200,200,  -1.0,  0.55,  0,  0.02, 13.0,
   0.1, 0.1, 4)
               show_hudmessage(id,"%s",strMessage)
           }
       }
       return PLUGIN_HANDLED
   }
   public mb_fool(id[]){
       new strMessage[192]
       new porigin[3]
       get_user_origin(id[0],porigin)
       calccoords[counter][0] = porigin[0]
       calccoords[counter][1] = porigin[1]
       calccoords[counter][2] = porigin[2]
       counter++
       new mb_clock = 2000 - counter
       if(counter > 90){
           format(strMessage,192,"Remaining  time: %d^n^nGo to the lowest
   place and duck, then the highest and jump,^nthen against all outermost
   walls.^nIf done early, go to console,
   type:^namx_mapbounds_forfools",mb_clock)
           set_hudmessage(12,125,12,  -1.0, 0.55, 0, 0.02, 1.0, 0.1, 0.1,
   4)
       }else{
           format(strMessage,192,"Setting  maximum bounds for map^nYou're
   making a 6 sided SAFE BOX around whole map^nGo to the lowest place and
   duck, then the highest and jump,^nthen against all outermost walls.")
           set_hudmessage(200,200,200,  -1.0,  0.55,  0,  0.02, 1.0, 0.1,
   0.1, 4)
       }
       show_hudmessage(id[0],"%s",strMessage)
       if(counter >1999 ){
           done_calc = 1
           make_b_for_fools(id[0])
       }
       return PLUGIN_CONTINUE
   }
   public make_b_for_dummy(id){
       if (!(get_user_flags(id)&ADMIN_RCON)) {
           client_print(id,print_console,"[AMX]  You  have  no  access to
   that command")
           return PLUGIN_HANDLED
       }
       if(cguy != id){
           if(cguy != 0){
               client_print(id,print_console,"[AMX]  Too many chefs spoil
   the stew. Some other admin is already in the middle of this.")
               return PLUGIN_HANDLED
           }
       }
       cguy = id
       cguys[id] = 1
       if(counter == -1){
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_cmd(id,"echo  [AMX]  Welcome to the 'make map boudaries
   for dummies' command")
           client_cmd(id,"echo [AMX] To make boundaries for this map, you
   will go along all the outside most")
           client_cmd(id,"echo  [AMX]  walls of the map, the places where
   you do not want clients to pass.")
           client_cmd(id,"echo [AMX] You need to go to the lowest part of
   the map, mark it, then the highest")
           client_cmd(id,"echo  [AMX]  part  of the map, and mark it. For
   the sides, simply walk along the")
           client_cmd(id,"echo  [AMX]  outermost  walls,  every once in a
   while, press yourself up against the")
           client_cmd(id,"echo [AMX] wall, then issue this command. ")
           client_cmd(id,"echo  [AMX] amx_makebounds_fordummies ------and
   keep repeating till you make it all the way around the map.")
           client_cmd(id,"echo ")
           map_watch = 0
           counter = 0
           done_calc = 0
           return PLUGIN_HANDLED
       }
       new porigin[3]
       get_user_origin(id,porigin)
       if(done_calc < 1){
           calccoords[counter][0] = porigin[0]
           calccoords[counter][1] = porigin[1]
           calccoords[counter][2] = porigin[2]
           counter++
       }
       if( (counter > 1999) && (done_calc == 0) ){
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_cmd(id,"echo  [AMX]  You only get 2000 tries, it may be
   good, so we go to the next step")
           client_cmd(id,"echo ")
           done_calc = 1
       }
       if(done_calc == 3){
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_cmd(id,"echo [AMX] In the voice of David Spade from the
   movie Tommy Boy, 'Wow.'")
           client_cmd(id,"echo ")
           client_cmd(id,"echo  [AMX]  Temporary bounds have already been
   set for this map, you just did it")
           client_cmd(id,"echo    [AMX]    To    make    them   permanent
   do:    amx_writebounds")
           client_cmd(id,"echo  [AMX] To clear these temporary boundaries
   try again do:   amx_resetbounds")
           client_cmd(id,"echo [AMX]
   Warning:   amx_writebounds   overwrites any prior permanent boundaries
   with these.")
           counter = 7
           return PLUGIN_HANDLED
       }
       if(done_calc == 0){
           new arg2[16]
           read_argv(1,arg2,16)
           if(equali(arg2,"done")){
               if(counter < 6){
                   client_cmd(id,"echo ")
                   client_cmd(id,"echo   [AMX]  You  cant  be  done  yet.
   Minimum entries with this is 6")
                   client_cmd(id,"echo ")
               }else{
                   done_calc = 1
               }
           }
       }
       if((done_calc == 2) ){
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           new arg2[16]
           new arg3[8]
           if(!read_argv(1,arg2,16)){
               client_cmd(id,"echo  [AMX]  No  map  default set for KILL,
   server default will be used.")
               deadly_d = 0
           }
           else if(equali(arg2,"NOKILL")){
               deadly = false
               deadly_d = 1
               client_cmd(id,"echo  [AMX]  Plugin is set to be non-lethal
   in punishing bounds violators for this map. Default")
           }else{
               deadly_d = 2
               deadly = true
               client_cmd(id,"echo  [AMX]  Plugin  is  set to KILL bounds
   violators after a few warning slaps for this map. Default")
           }
           if(!read_argv(2,arg3,8)){
               slap_d_d = -1
               client_cmd(id,"echo  [AMX]  No  map  default  set for slap
   damage, server default will be used")
           }else{
               if( (strtonum(arg3) < 0) || (strtonum(arg3) > 99) ){
                   slap_d_d = -1
                   client_cmd(id,"echo  [AMX]  Slap entry invalid. No map
   default set. Slap damage set to server default")
               }else{
                   slap_d_d = strtonum(arg3)
                   OOB_SLAP_DAMAGE = strtonum(arg3)
                   client_cmd(id,"echo  [AMX] Slap damage map default set
   to your specifications")
               }
           }
           client_cmd(id,"echo  [AMX]  Proceeding  to calculate and apply
   new boudaries.")
           do_boundcalc(id)
       }
       else if( (counter > 0) && (done_calc == 0)){
           client_print(id,print_console,"^n^n^n^n^n[AMX] You have marked
   %d points for bounds calculation",counter)
           client_cmd(id,"echo  [AMX] If you are done, enter this command
   again to say so: 'amx_makebounds_fordummies done'")
           client_cmd(id,"echo ")
           client_cmd(id,"echo  [AMX]  If  not,  continue marking ALL the
   outside walls of the map where you do not want players beyond.")
           client_cmd(id,"echo ")
           client_cmd(id,"echo  [AMX]  Dont  forget  to  set  the top and
   bottom too if you havent done so already.")
           client_cmd(id,"echo  [AMX]  When  you  are  setting the BOTTOM
   boundary, and are on map, please issue command from a crouch")
             client_cmd(id,"echo  [AMX]  When  you  are  setting  the TOP
   boudary, you might need to amx_noclip yourself first --hope you have a
   noclip plugin")
           client_cmd(id,"echo ")
       }
       else if( (counter > 0) && (done_calc == 1)){
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_cmd(id,"echo  [AMX]  Now  enter  this  command again to
   specify default punishments for this map.")
           client_cmd(id,"echo [AMX] Options: Allow out of bounds to kill
   player after warning slaps: KILL/NOKILL")
           client_cmd(id,"echo  [AMX]  Options:  Amount of damage warning
   slaps do. 0-99")
           client_cmd(id,"echo  [AMX]  Format:  amx_makebounds_fordummies
   <KILL/NOLILL> <SLAP DAMAGE>")
           client_cmd(id,"echo  [AMX]  Example: amx_makebounds_fordummies
   KILL 30")
           client_cmd(id,"echo [AMX] If the command is issued without any
   options, plugin default 'KILL 30' will be used")
           counter--
           done_calc = 2
       }
       return PLUGIN_HANDLED
   }
   public make_raw_bounds(id){
       if (!(get_user_flags(id)&ADMIN_RCON)) {
           client_print(id,print_console,"[AMX]  You  have  no  access to
   that command")
           return PLUGIN_HANDLED
       }
       if(cguy != id){
           if(cguy != 0){
               client_print(id,print_console,"[AMX]  Too many chefs spoil
   the stew. Some other admin is already in the middle of this.")
               return PLUGIN_HANDLED
           }
       }
       cguy = id
       cguys[id] = 1
       if(counter == -1){
           client_cmd(id,"echo ")
           client_cmd(id,"echo [AMX] To make boundaries for this map, you
   will need to set the 6")
           client_cmd(id,"echo   [AMX]   farthest   points   on  the  map
   UP,DOWN,LEFT,RIGHT,FRONT,BACK. ")
           client_cmd(id,"echo  [AMX] To begin, go to the first point you
   want to mark as a boundary,")
           client_cmd(id,"echo  [AMX]  press yourself up against it, then
   issue this command again:")
           client_cmd(id,"echo  [AMX]  amx_makebounds ------and do it for
   each of the six farthest points.")
           client_cmd(id,"echo ")
           counter = 0
           map_watch = 0
           return PLUGIN_HANDLED
       }

       new porigin[3]
       get_user_origin(id,porigin)
       calccoords[counter][0] = porigin[0]
       calccoords[counter][1] = porigin[1]
       calccoords[counter][2] = porigin[2]
       counter++
       if(counter > 6){
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           new arg2[16]
           new arg3[8]
           if(!read_argv(1,arg2,16)){
               client_cmd(id,"echo  [AMX]  No  map  default set for KILL,
   server default will be used.")
               deadly_d = 0
           }
           else if(equali(arg2,"NOKILL")){
               deadly = false
               deadly_d = 1
               client_cmd(id,"echo  [AMX]  Plugin is set to be non-lethal
   in punishing bounds violators for this map. Default")
           }else{
               deadly_d = 2
               deadly = true
               client_cmd(id,"echo  [AMX]  Plugin  is  set to KILL bounds
   violators after a few warning slaps for this map. Default")
           }
           if(!read_argv(2,arg3,8)){
               slap_d_d = -1
               client_cmd(id,"echo  [AMX]  No  map  default  set for slap
   damage, server default will be used")
           }else{
               if( (strtonum(arg3) < 0) || (strtonum(arg3) > 99) ){
                   slap_d_d = -1
                   client_cmd(id,"echo  [AMX]  Slap entry invalid. No map
   default set. Slap damage set to server default")
               }else{
                   slap_d_d = strtonum(arg3)
                   OOB_SLAP_DAMAGE = strtonum(arg3)
                   client_cmd(id,"echo  [AMX] Slap damage map default set
   to your specifications")
               }
           }
           client_cmd(id,"echo  [AMX]  Proceeding  to calculate and apply
   new boudaries.")
           do_boundcalc(id)
       }
       else if(counter == 6){
           client_print(id,print_console,"^n^n^n^n^n[AMX] You have marked
   point %d of 6",counter)
           client_cmd(id,"echo  [AMX]  Now  enter  this  command again to
   specify default punishments for this map.")
           client_cmd(id,"echo [AMX] Options: Allow out of bounds to kill
   player after warning slaps: KILL/NOKILL")
           client_cmd(id,"echo  [AMX]  Options:  Amount of damage warning
   slaps do. 0-99")
           client_cmd(id,"echo [AMX] Format: amx_makebounds <KILL/NOLILL>
   <SLAP DAMAGE>")
           client_cmd(id,"echo [AMX] Example: amx_makebounds KILL 30")
           client_cmd(id,"echo [AMX] If the command is issued without any
   options, plugin default 'KILL 30' will be used")
       }else{
           client_print(id,print_console,"^n^n^n^n^n[AMX] You have marked
   point  %d  of  6  Please  mark  the  next  most  extreem  point on the
   map.",counter)
           client_cmd(id,"echo ")
           client_cmd(id,"echo [AMX] You are marking the six most extreme
   points in the map.")
           client_cmd(id,"echo [AMX] UP DOWN LEFT RIGHT FRONT BACK")
           client_cmd(id,"echo ")
           client_cmd(id,"echo  [AMX]  When  you  are  setting the BOTTOM
   boundary, and are on map, please issue command from a crouch")
             client_cmd(id,"echo  [AMX]  When  you  are  setting  the TOP
   boudary, you might need to amx_noclip yourself first --hope you have a
   noclip plugin")
           client_cmd(id,"echo ")
       }
       return PLUGIN_HANDLED
   }
   do_boundcalc(id){
       new hi_x = -20000
       new lo_x = 20000
       new hi_y = -20000
       new lo_y = 20000
       new hi_z = -20000
       new lo_z = 20000
       for (new i=0; i<=counter-1; i++){
           if(calccoords[i][0] > hi_x)
               hi_x = calccoords[i][0]
           if(calccoords[i][0] < lo_x)
               lo_x = calccoords[i][0]
           if(calccoords[i][1] > hi_y)
               hi_y = calccoords[i][1]
           if(calccoords[i][1] < lo_y)
               lo_y = calccoords[i][1]
           if(calccoords[i][2] > hi_z)
               hi_z = calccoords[i][2]
           if(calccoords[i][2] < lo_z)
               lo_z = calccoords[i][2]
       }
       if(making_box == 0){
           the_bounds[0] = hi_x +1
           the_bounds[1] = lo_x -1
           the_bounds[2] = hi_y +1
           the_bounds[3] = lo_y -1
           the_bounds[4] = hi_z
           the_bounds[5] = lo_z -1
       }
       else if(making_box == 1){
           box_bounds[0] = hi_x
           box_bounds[1] = lo_x
           box_bounds[2] = hi_y
           box_bounds[3] = lo_y
           box_bounds[4] = hi_z
           box_bounds[5] = lo_z
       }
       else if(making_box == 2){
           box_bounds[6] = hi_x
           box_bounds[7] = lo_x
           box_bounds[8] = hi_y
           box_bounds[9] = lo_y
           box_bounds[10] = hi_z
           box_bounds[11] = lo_z
       }
       client_cmd(id,"echo ")
       if(making_box > 0){
           client_cmd(id,"echo  [AMX]  A  temporary  box has been set for
   this map")
           if(making_box == 1)
               box1 = 1
           else
               box2 = 1
       }else{
           client_cmd(id,"echo  [AMX]  Temporary bounds have been set for
   this map")
       }
       client_cmd(id,"echo     [AMX]     To     make    them    permanent
   do:    amx_writebounds")
       client_cmd(id,"echo     [AMX]    To    clear    these    temporary
   boundaries/boxes and try again do:   amx_resetbounds")
       client_cmd(id,"echo  [AMX] Warning:   amx_writebounds   overwrites
   any prior permanent boundaries/boxes with current ones.")
       map_watch = 1
       counter = 7
       done_calc = 3
       making_box = 0
   }
   public amx_makeonewall(id){
       if (!(get_user_flags(id)&ADMIN_RCON)) {
           client_print(id,print_console,"[AMX]  You  have  no  access to
   that command")
           return PLUGIN_HANDLED
       }
       if(cguy != id){
           if(cguy != 0){
               client_print(id,print_console,"[AMX]  Too many chefs spoil
   the stew. Some other admin is already in the middle of this.")
               return PLUGIN_HANDLED
           }
       }
       client_cmd(id,"echo ")
       client_cmd(id,"echo ")
       client_cmd(id,"echo ")
       client_cmd(id,"echo ")
       client_cmd(id,"echo ")
       if (read_argc() < 2){
           client_cmd(id,"echo  [AMX] This command makes one wall instead
   of setting all six sides.")
           client_cmd(id,"echo  [AMX]  This  is  for  advanced users, see
   plugin readme in source code")
           client_cmd(id,"echo    [AMX]   Usage:   amx_makebound   <wall>
   <KILL/NOKILL>  <SLAP DAMAGE>  [Wall can be one of these: x, -x, y, -y,
   z, -z]")
           client_cmd(id,"echo ")
           return PLUGIN_HANDLED
       }
       new porigin[3]
       get_user_origin(id,porigin)
       new arg[8]
       read_argv(1,arg,8)
       if(map_watch == 0){
           the_bounds[0] = 20000
           the_bounds[1] = -20000
           the_bounds[2] = 20000
           the_bounds[3] = -20000
           the_bounds[4] = 20000
           the_bounds[5] = -20000
       }
       if(equal(arg,"x"))
           the_bounds[0] = porigin[0]
       else if(equal(arg,"-x"))
           the_bounds[1] = porigin[0]
       else if(equal(arg,"y"))
           the_bounds[2] = porigin[1]
       else if(equal(arg,"-y"))
           the_bounds[3] = porigin[1]
       else if(equal(arg,"z"))
           the_bounds[4] = porigin[2]
       else if(equal(arg,"-z"))
           the_bounds[5] = porigin[2]
       new arg2[16]
       new arg3[8]
       if(!read_argv(2,arg2,16)){
           client_cmd(id,"echo  [AMX] No map default set for KILL, server
   default will be used.")
           deadly_d = 0
       }
       else if(equali(arg2,"NOKILL")){
           deadly_d = 1
           deadly = false
           client_cmd(id,"echo  [AMX]  Plugin  is set to be non-lethal in
   punishing bounds violators for this map by default")
       }else{
           deadly_d = 2
           deadly = true
           client_cmd(id,"echo   [AMX]  Plugin  is  set  to  KILL  bounds
   violators after a few warning slaps for this map by default")
       }
       if(!read_argv(3,arg3,8)){
           slap_d_d = -1
           client_cmd(id,"echo  [AMX] No map default set for slap damage,
   server default will be used")
       }else{
           if( (strtonum(arg3) < 0) || (strtonum(arg3) > 99) ){
               slap_d_d = -1
               client_cmd(id,"echo  [AMX]  Slap  entry  invalid.  No  map
   default set. Slap damage set to server default")
           }else{
               slap_d_d = strtonum(arg3)
               OOB_SLAP_DAMAGE = strtonum(arg3)
               client_cmd(id,"echo  [AMX]  Slap damage map default set to
   your specifications.")
           }
       }
       counter = 7
       map_watch = 1
       client_cmd(id,"echo [AMX] Temporary boundary has been set.")
       client_cmd(id,"echo     [AMX]     To     make    them    permanent
   do:    amx_writebounds")
       client_cmd(id,"echo  [AMX] To clear these temporary boundaries try
   again do:   amx_resetbounds")
       client_cmd(id,"echo  [AMX] Warning:   amx_writebounds   overwrites
   any prior permanent boundaries with these.")
       return PLUGIN_HANDLED
   }
   public amx_writebounds(id){
       if (!(get_user_flags(id)&ADMIN_RCON)) {
           client_print(id,print_console,"[AMX]  You  have  no  access to
   that command")
           return PLUGIN_HANDLED
       }
       if(cguy != id){
           if(cguy != 0){
               client_print(id,print_console,"[AMX]  Too many chefs spoil
   the stew. Some other admin is already in the middle of this.")
               return PLUGIN_HANDLED
           }
       }
       if(counter < 7){
           if(making_box > 0)
               client_print(id,print_console,"[AMX]  Cannot write to file
   yet.  You  have  not  set all 6 faces of the box and set slap and kill
   status.")
           else
               client_print(id,print_console,"[AMX]  Cannot write to file
   yet.  You  have not set all 6 most extreme map points and set slap and
   kill status.")
           return PLUGIN_HANDLED
       }
       get_mapname(ThisMap, 32)
       new oobw[128]
       new bd1[8]
       new bd2[8]
       new dd[8]
       if(box1 == 1){
           if(box1deadly == true)
               copy(bd1,8,"KILL")
           else
               copy(bd1,8,"NOKILL")
       }else
           copy(bd1,8,"BOX1-DISABLED")
       if(box2 == 1){
           if(box2deadly == true)
               copy(bd2,8,"KILL")
           else
               copy(bd2,8,"NOKILL")
       }else
           copy(bd2,8,"BOX2-DISABLED")
       if(deadly_d == 2)
           copy(dd,8,"KILL-OFF")
       else
           copy(dd,8,"KILL-ON")
       if(slap_d_d < 0)
           slap_d_d = OOB_SLAP_DAMAGE
       format(oobw,128,"%s  %d  %d %d %d %d %d %s %d %d %d %d %d %d %d %s
   %d %d %d %d %d %d %d %s
   %d",ThisMap,the_bounds[0],the_bounds[1],the_bounds[2],the_bounds[3],th
   e_bounds[4],the_bounds[5],dd,slap_d_d,
           box_bounds[0],box_bounds[1],box_bounds[2],box_bounds[3],box_bo
   unds[4],box_bounds[5],bd1,box1slap,
           box_bounds[6],box_bounds[7],box_bounds[8],box_bounds[9],box_bo
   unds[10],box_bounds[11],bd2,box2slap)
       if(file_exists("addons/amx/out_of_bounds.txt") == 1){
           new skip = 0
           new line = 0
           new data[192]
           new stextsize = 0
           new map[32]
           while((line=read_file("addons/amx/out_of_bounds.txt",line,data
   ,192,stextsize))!=0){
               parse(data,map,32)
               if(skip == 0){
                   if( (equal(data,"")) || (equali(map,ThisMap)) ){
                       skip = 1
                       write_file("addons/amx/out_of_bounds.txt",oobw,lin
   e-1)
                   }
                   else if(equal(map,ThisMap)){
                       write_file("addons/amx/out_of_bounds.txt","",line-
   1)
                   }
               }
           }
           if(skip == 0){
               write_file("addons/amx/out_of_bounds.txt",oobw,-1)
           }
       }else{
           write_file("addons/amx/out_of_bounds.txt",oobw,-1)
       }
       client_cmd(id,"echo ")
       client_cmd(id,"echo  [AMX] New values have been written to file to
   be used as default")
       client_cmd(id,"echo  [AMX]  Any  old values for this map have been
   overwritten")
       done_calc =-1
       deadly_d = 0
       slap_d_d = -1
       counter = -1
       cguy = 0
       cguys[id] = 0
       return PLUGIN_HANDLED
   }
   public amx_deletebounds(id){
       if (!(get_user_flags(id)&ADMIN_RCON)) {
           client_print(id,print_console,"[AMX]  You  have  no  access to
   that command")
           return PLUGIN_HANDLED
       }
       get_mapname(ThisMap, 32)
       new oobw[128]
       format(oobw,128,"%s N N N N N N",ThisMap)
       if(file_exists("addons/amx/out_of_bounds.txt") == 1){
           new skip = 0
           new line = 0
           new data[192]
           new stextsize = 0
           new map[32]
           while((line=read_file("addons/amx/out_of_bounds.txt",line,data
   ,192,stextsize))!=0){
               parse(data,map,32)
               if(skip == 0){
                   if( (equal(data,"")) || (equali(map,ThisMap)) ){
                       skip = 1
                       write_file("addons/amx/out_of_bounds.txt",oobw,lin
   e-1)
                   }
                   else if(equal(map,ThisMap)){
                       write_file("addons/amx/out_of_bounds.txt","",line-
   1)
                   }
               }
           }
           if(skip == 0){
               write_file("addons/amx/out_of_bounds.txt",oobw,-1)
           }
       }else{
           write_file("addons/amx/out_of_bounds.txt",oobw,-1)
       }
       map_watch = 0
       client_cmd(id,"echo ")
       client_cmd(id,"echo  [AMX]  Deleted  bounds from out_of_bounds.txt
   for this map. I hope you were sure about that.")
       return PLUGIN_HANDLED
   }
   public amx_resetbounds(id){
       if (!(get_user_flags(id)&ADMIN_RCON)) {
           client_print(id,print_console,"[AMX]  You  have  no  access to
   that command")
           return PLUGIN_HANDLED
       }
       if(cguy != id){
           if(cguy != 0){
               client_print(id,print_console,"[AMX]  Too many chefs spoil
   the stew. Some other admin is already in the middle of this.")
               return PLUGIN_HANDLED
           }
       }
       if(counter == -1){
           client_print(id,print_console,"[AMX] Cannot reset bounds. Only
   bounds are in file. Use amx_deletebounds or make new ones.")
           return PLUGIN_HANDLED
       }
       if( (counter > -1) && (done_calc > -1) ){
           client_print(id,print_console,"[AMX] Messed up? Ok, things are
   back to the way they were before you started setting bounds.")
       }
       set_map_bounds()
       client_cmd(id,"echo [AMX] Temporary bounds have been erased, using
   bounds found in permanent file if any.")
       done_calc = -1
       counter = -1
       cguy = 0
       cguys[id] = 0
       return PLUGIN_HANDLED
   }
   public make_boxes(id){
       if (!(get_user_flags(id)&ADMIN_RCON)) {
           client_print(id,print_console,"[AMX]  You  have  no  access to
   that command")
           return PLUGIN_HANDLED
       }
       if(cguy != id){
           if(cguy != 0){
               client_print(id,print_console,"[AMX]  Too many chefs spoil
   the stew. Some other admin is already in the middle of this.")
               return PLUGIN_HANDLED
           }
       }
       cguy = id
       cguys[id] = 1
       new cmd[32]
       read_argv(0,cmd,32)
       if(equal(cmd[11],"1",1))
           making_box = 1
       else
           making_box = 2
       if(counter == -1){
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_cmd(id,"echo  [AMX]  To  make a restricted area box for
   this map, you will need to trace that box")
           client_cmd(id,"echo  [AMX]  with  your HEAD. You have been put
   into noclip mode to make you more well")
           client_cmd(id,"echo  [AMX]  suited  to  this  task. Mark every
   corner, every face of the box you want to")
           client_cmd(id,"echo [AMX] create
   TOP,BOTTOM,LEFT,RIGHT,FRONT,BACK faces. DO NOT mark anyplace outside")
           client_cmd(id,"echo  [AMX] of the area you want to make into a
   restricted area box. You are allowed to")
           client_cmd(id,"echo  [AMX]  to  set many points in and on box,
   only 6 are required, to mark box points:")
           if(making_box == 1)
               client_cmd(id,"echo   [AMX]  amx_setbox_1  ------and  keep
   repeating till you have traced all sides of the box.")
           else
               client_cmd(id,"echo   [AMX]  amx_setbox_2  ------and  keep
   repeating till you have traced all sides of the box.")
           client_cmd(id,"echo ")
           counter = 0
           done_calc = 0
           new arg[32]
           read_argv(1,arg,32)
           if(equal(arg,"p",1)){
               counter = 6
               done_calc = 1
               make_p = 1
           }else{
               map_watch = 0
               set_user_noclip(id,1)
               return PLUGIN_HANDLED
           }
       }

       new porigin[3]
       get_user_origin(id,porigin)
       if(done_calc < 1){
           calccoords[counter][0] = porigin[0]
           calccoords[counter][1] = porigin[1]
           calccoords[counter][2] = porigin[2]
           counter++
       }
       if( (counter > 1999) && (done_calc == 0) ){
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_cmd(id,"echo  [AMX]  You only get 2000 tries, it may be
   good, so we go to the next step")
           client_cmd(id,"echo ")
           done_calc = 1
       }
       if(done_calc == 3){
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_cmd(id,"echo [AMX] In the voice of David Spade from the
   movie Tommy Boy, 'Wow.'")
           client_cmd(id,"echo ")
           client_cmd(id,"echo [AMX] A temporary box has already been set
   for this map, you just did it")
           client_cmd(id,"echo    [AMX]    To    make    them   permanent
   do:    amx_writebounds")
           client_cmd(id,"echo  [AMX] To clear these temporary boundaries
   try again do:   amx_resetbounds")
           client_cmd(id,"echo [AMX]
   Warning:   amx_writebounds   overwrites any prior permanent boxes with
   these.")
           counter = 7
           return PLUGIN_HANDLED
       }
       if(done_calc == 0){
           new arg2[16]
           read_argv(1,arg2,16)
           if(equali(arg2,"done")){
               if(counter < 6){
                   client_cmd(id,"echo ")
                   client_cmd(id,"echo   [AMX]  You  cant  be  done  yet.
   Minimum entries with this is 6")
                   client_cmd(id,"echo ")
               }else{
                   set_user_noclip(id,0)
                   done_calc = 1
               }
           }
       }
       if((done_calc == 2) ){
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           new arg2[16]
           new arg3[8]
           if(!read_argv(1,arg2,16)){
               client_cmd(id,"echo  [AMX]  No  map  default set for KILL,
   KILL will be used.")
               if(making_box == 1)
                   box1deadly = true
               else if(making_box == 2)
                   box2deadly = true
           }
           else if(equali(arg2,"NOKILL")){
               if(making_box == 1)
                   box1deadly = false
               else if(making_box == 2)
                   box2deadly = false
               client_cmd(id,"echo  [AMX]  Plugin is set to be non-lethal
   in punishing box violators for this map. Default")
           }else{
               if(making_box == 1)
                   box1deadly = true
               else if(making_box == 2)
                   box2deadly = true
               client_cmd(id,"echo  [AMX]  Plugin  is  set  to  KILL  box
   violators after a few warning slaps for this map. Default")
           }
           if(!read_argv(2,arg3,8)){
               if(making_box == 1)
                   box1slap = 30
               else if(making_box == 2)
                   box2slap = 30
               client_cmd(id,"echo  [AMX] Default set for slap damage, 30
   health will be used")
           }else{
               if( (strtonum(arg3) < 0) || (strtonum(arg3) > 99) ){
                   if(making_box == 1)
                       box1slap = 30
                   else if(making_box == 2)
                       box2slap = 30
                   client_cmd(id,"echo  [AMX]  Slap entry invalid. No map
   default set. Slap damage set to 30")
               }else{
                   if(making_box == 1)
                       box1slap = strtonum(arg3)
                   else if(making_box == 2)
                       box2slap = strtonum(arg3)
                   client_cmd(id,"echo  [AMX] Slap damage map default set
   to your specifications")
               }
           }
           if(make_p == 0){
               client_cmd(id,"echo  [AMX]  Proceeding  to  calculate  and
   apply new box.")
               do_boundcalc(id)
           }else{
               make_p = 0
               map_watch = 1
               counter = 7
               done_calc = 3
               making_box = 0
           }
       }
       else if( (counter > 0) && (done_calc == 0)){
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_print(id,print_console,"^n^n^n^n^n[AMX] You have marked
   %d points for box restriction calculation",counter)
           client_cmd(id,"echo ")
           if(making_box == 1)
               client_cmd(id,"echo  [AMX]  If  you  are  done, enter this
   command again to say so: 'amx_setbox_1 done'")
           else
               client_cmd(id,"echo  [AMX]  If  you  are  done, enter this
   command again to say so: 'amx_setbox_2 done'")
           client_cmd(id,"echo ")
           client_cmd(id,"echo  [AMX]  Warning:  Upon issuing the done on
   the command, your noclip will be disabled")
           client_cmd(id,"echo  [AMX]  If  not done, continue marking ALL
   faces and/or corners of the box you want to restrict.")
           if(making_box == 1)
               client_cmd(id,"echo [AMX]
   TOP,BOTTOM,LEFT,RIGHT,FRONT,BACK.    By    going   there   and   doing
   'amx_setbox_1'")
           else
               client_cmd(id,"echo [AMX]
   TOP,BOTTOM,LEFT,RIGHT,FRONT,BACK.    By    going   there   and   doing
   'amx_setbox_2'")
           client_cmd(id,"echo ")
       }
       else if( (counter > 0) && (done_calc == 1)){
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_cmd(id,"echo  [AMX]  Now  enter  this  command again to
   specify default punishments for this box.")
           client_cmd(id,"echo  [AMX]  Options:  Allow  restricted box to
   kill player after warning slaps: KILL/NOKILL")
           client_cmd(id,"echo  [AMX]  Options:  Amount of damage warning
   slaps do. 0-99")
           if(making_box == 1){
               client_cmd(id,"echo     [AMX]     Format:     amx_setbox_1
   <KILL/NOLILL> <SLAP DAMAGE>")
               client_cmd(id,"echo [AMX] Example: amx_setbox_1 KILL 30")
           }else{
               client_cmd(id,"echo     [AMX]     Format:     amx_setbox_2
   <KILL/NOLILL> <SLAP DAMAGE>")
               client_cmd(id,"echo [AMX] Example: amx_setbox_2 KILL 30")
           }
           client_cmd(id,"echo [AMX] If the command is issued without any
   options, plugin default 'KILL 30' will be used")
           counter--
           done_calc = 2
       }
       return PLUGIN_HANDLED
   }
   public amx_mb(id) {
       if (!(get_user_flags(id)&ADMIN_LEVEL_A)) {
           client_print(id,print_console,"[AMX]  You  have  no  access to
   that command")
           return PLUGIN_HANDLED
       }
       new authid[16],name[32]
       get_user_authid(id,authid,16)
       get_user_name(id,name,32)
       log_to_file("addons/amx/admin.log","^"%s<%d><%s><>^" map_bounds",
           name,get_user_userid(id),authid)
       if ( oob == false) {
           client_print(0,print_chat,"[AMX] Admin:  %s  has turned out of
   bounds checking ON.",name)
           client_print(id,print_console,"[AMX] Out of bounds checking is
   ON.")
           server_print("[AMX] Out of bounds checking is ON.")
           oob = true
       }else{
           client_print(0,print_chat,"[AMX] Admin:  %s  has turned out of
   bounds checking OFF.",name)
           client_print(id,print_console,"[AMX] Out of bounds checking is
   OFF.")
           server_print("[AMX] Out of bounds checking is OFF.")
           oob = false
       }
       new cmd[32]
       read_argv(0,cmd,32)
       if(equali(cmd[14],"d",1)){
           if (!(get_user_flags(id)&ADMIN_RCON)) {
               client_print(id,print_console,"[AMX] but, setting defaults
   requires ADMIN_RCON level access")
               return PLUGIN_HANDLED
           }
           if ( oob == false) {
               ejl_vault("WRITE","MAP_BOUNDS","OFF")
               client_print(id,print_console,"[AMX]  Default  for  out of
   bounds checking is set to OFF.")
               server_print("[AMX] Out of bounds checking is OFF.")
           }else{
               ejl_vault("WRITE","MAP_BOUNDS","ON")
               client_print(id,print_console,"[AMX]  Default  for  out of
   bounds checking is set to ON.")
               server_print("[AMX] Out of bounds checking is ON.")
           }
           log_to_file("addons/amx/admin.log","^"%s<%d><%s><>^"
   map_bounds_default",
               name,get_user_userid(id),authid)
       }
       return PLUGIN_HANDLED
   }
   public amx_mb_kill(id) {
       if (!(get_user_flags(id)&ADMIN_RCON)) {
           client_print(id,print_console,"[AMX]  You  have  no  access to
   that command")
           return PLUGIN_HANDLED
       }
       if ( deadly == false) {
           ejl_vault("WRITE","MAP_BOUNDS_KILL","ON")
           client_print(id,print_console,"[AMX]  Out of bounds killing is
   ON. This is the default now.")
           server_print("[AMX] Out of bounds killing is ON.")
           deadly = true
       }else{
           ejl_vault("WRITE","MAP_BOUNDS_KILL","OFF")
           client_print(id,print_console,"[AMX]  Out of bounds killing is
   OFF. This is the default now.")
           server_print("[AMX] Out of bounds killing is OFF.")
           deadly = false
       }
       new authid[16],name[32]
       get_user_authid(id,authid,16)
       get_user_name(id,name,32)
       log_to_file("addons/amx/admin.log","^"%s<%d><%s><>^"
   map_bounds_kill",
           name,get_user_userid(id),authid)
       return PLUGIN_HANDLED

   }
   public amx_mb_slap(id) {
       if (!(get_user_flags(id)&ADMIN_RCON)){
           client_print(id,print_console,"[AMX]  You  have  no  access to
   that command")
           return PLUGIN_HANDLED
       }
       if (read_argc() < 2){
           client_print(id,print_console,"[AMX] Usage: amx_mapbounds_slap
   < amount of damage per slap >")
           return PLUGIN_HANDLED
       }
       new arg[32]
       read_argv(1,arg,32)
       if( (strtonum(arg) < 0) || (strtonum(arg) > 99) ){
           client_print(id,print_console,  "[AMX]  Slap  damage  per slap
   must be a number between 0 and 99")
           return PLUGIN_HANDLED
       }
       OOB_SLAP_DAMAGE = strtonum(arg)
       ejl_vault("WRITE","MAP_BOUNDS_SLAP",arg)
       client_print(id,print_console, "[AMX] Default slap damage for each
   out of bounds slap is %s",arg)
       new authid[16],name[32]
       get_user_authid(id,authid,16)
       get_user_name(id,name,32)
       log_to_file("addons/amx/admin.log","^"%s<%d><%s><>^"
   map_bounds_slap",
           name,get_user_userid(id),authid)
       return PLUGIN_HANDLED
   }
   public amx_mb_mappd(id) {
       if (!(get_user_flags(id)&ADMIN_RCON)){
           client_print(id,print_console,"[AMX]  You  have  no  access to
   that command")
           return PLUGIN_HANDLED
       }
       if(cguy != id){
           if(cguy != 0){
               client_print(id,print_console,"[AMX]  Too many chefs spoil
   the stew. Some other admin is already in the middle of this.")
               return PLUGIN_HANDLED
           }
       }
       if(map_watch == 0){
           client_print(id,print_console,"[AMX]   You  cannot  set  these
   values until you set written boundaries for this map.")
           return PLUGIN_HANDLED
       }
       if (read_argc() < 2){
           client_cmd(id,"echo ")
           client_cmd(id,"echo ")
           client_cmd(id,"echo [AMX] Usage: amx_mapbounds_mappd [optional
   <KILL/NOKILL> <slap damage>]")
           client_cmd(id,"echo  [AMX]  --  by leaving blank, you just set
   current settings to default for this map.")
           if(deadly == true){
               deadly_d = 2
           }else{
               deadly_d = 1
           }
           slap_d_d = OOB_SLAP_DAMAGE
       }else{
           new arg[16]
           read_argv(1,arg,16)
           if(equali(arg,"NOKILL")){
               deadly = false
               deadly_d = 1
           }else{
               deadly = true
               deadly_d = 2
           }
           new arg2[8]
           read_argv(2,arg2,8)
           if( (strtonum(arg2) < 0) || (strtonum(arg2) > 99) ){
               client_print(id,print_console, "[AMX] Slap damage per slap
   must be a number between 0 and 99")
               slap_d_d = OOB_SLAP_DAMAGE
               client_cmd(id,"echo  [AMX] Slap entry invalid. Slap damage
   default for this map set to server default")
           }else{
               slap_d_d = strtonum(arg2)
               OOB_SLAP_DAMAGE = strtonum(arg2)
               client_cmd(id,"echo [AMX] Slap damage map default for this
   map is set to your specifications.")
           }
       }
       counter = 7
       amx_writebounds(id)
       new authid[16],name[32]
       get_user_authid(id,authid,16)
       get_user_name(id,name,32)
       log_to_file("addons/amx/admin.log","^"%s<%d><%s><>^"
   map_bounds_mapdd",
           name,get_user_userid(id),authid)
       return PLUGIN_HANDLED
   }
   public client_connect(id)
   {
       punishments[id] = 0
       cguys[id] = 0
       return PLUGIN_CONTINUE
   }
   public client_disconnect(id)
   {
       punishments[id] = 0
       if(cguys[id] == 1){
           counter = 0
           cguy = 0
           cguys[id] = 0
       }
       return PLUGIN_CONTINUE
   }
   public plugin_precache(){
       light = precache_model("sprites/lgtning.spr")
       smoke = precache_model("sprites/steam1.spr")
       precache_sound( "ambience/thunder_clap.wav")
       return PLUGIN_CONTINUE
   }
   public plugin_init()
   {
       register_plugin("Out Of Bounds", "0.8", "EJL")
       register_clcmd("amx_mapbounds_kill",                "amx_mb_kill",
   ADMIN_RCON,"amx_mapbounds_kill <optional:MAP> : Toggles on and off the
   ability for out of bounds to be lethal. Sets default.")
       register_clcmd("amx_mapbounds_slap",                "amx_mb_slap",
   ADMIN_RCON,"amx_mapbounds_slap <damage per slap> <optional:MAP> :  Set
   the damage each out of bounds slap does. Sets Defasult.")
       register_clcmd("amx_mapbounds",                          "amx_mb",
   ADMIN_LEVEL_A,"amx_mapbounds  :  Toggles  on  and  off 'out of bounds'
   checking and punishing.")
       register_clcmd("amx_mapbounds_default",                  "amx_mb",
   ADMIN_RCON,"amx_mapbounds_default   :  Toggles  on  and  off  'out  of
   bounds' checking and punishing AND sets default.")
       register_clcmd("amx_makebounds",                "make_raw_bounds",
   ADMIN_RCON,"amx_makebounds :  Go to six extremities of map, issue this
   once at each one to set up bounds.")
       register_clcmd("amx_makebounds_fordummies",    "make_b_for_dummy",
   ADMIN_RCON,"amx_makebounds_fordummies  :  Go  along the walls and keep
   doing this command to set up bounds.")
       register_clcmd("amx_makebounds_forfools",      "make_b_for_fools",
   ADMIN_RCON,"amx_makebounds_forfools  :  Go  along  the outmost walls +
   floor and cieling set up bounds.")
       register_clcmd("amx_resetbounds",               "amx_resetbounds",
   ADMIN_RCON,"amx_resetbounds  :  Revert  to  whatever bounds are in the
   file.")
       register_clcmd("amx_writebounds",               "amx_writebounds",
   ADMIN_RCON,"amx_writebounds   :  Writes   the   bounds  calculated  be
   amx_makebounds to file, overwiting preious bounds.")
       register_clcmd("amx_deletebounds",             "amx_deletebounds",
   ADMIN_RCON,"amx_deletebounds  :  Deletes  the  boudaries  in  the file
   forthat map and sets to no bounds.")
       register_clcmd("amx_makebound",                 "amx_makeonewall",
   ADMIN_RCON,"amx_makebound <type: high_x low_x high_y low_y top bottom>
   : Set one wall with a boundary, leave rest alone.")
       register_clcmd("amx_setbox_1",                       "make_boxes",
   ADMIN_RCON,"amx_setbox_1  <'punishmnents'  |  'done'  | [<KILL/NOKILL>
   <SLAP DAMAGE>] :  Makes a restricted area box.")
       register_clcmd("amx_setbox_2",                       "make_boxes",
   ADMIN_RCON,"amx_setbox_2  <'punishmnents'  |  'done'  | [<KILL/NOKILL>
   <SLAP DAMAGE>] :  Makes a restricted area box.")
       register_clcmd("amx_mapbounds_mappd",              "amx_mb_mappd",
   ADMIN_RCON,"amx_mapbounds_mappd [Optional <KILL/NOKILL> <SLAP DAMAGE>]
   : Set default bounds punishiment for the map you are on.")
       set_task(1.5,"set_map_bounds")
       ejl_vault("READ","MAP_BOUNDS","")
       if(equal(vault_value,"OFF"))
           oob = false
       else
           oob = true
       ejl_vault("READ","MAP_BOUNDS_KILL","")
       if(equal(vault_value,"OFF"))
           deadly = false
       else
           deadly = true
       ejl_vault("READ","MAP_BOUNDS_SLAP","")
       if( (strtonum(vault_value) < 0) || (strtonum(vault_value) > 99) )
           OOB_SLAP_DAMAGE = 30
       else
           OOB_SLAP_DAMAGE = strtonum(vault_value)

       return PLUGIN_CONTINUE
   }
   public ejl_vault(rw[],key[],value[]){
       new data[192]
       new stxtsize = 0
       new line = 0
       new skip = 0
       new vkey[64]
       new vvalue[128]
       new vaultwrite[192]
       if(equal(rw,"READ")){
           if(file_exists("addons/amx/ejl_vault.ini") == 1){
               copy(vault_value,128,"")
               while((line=read_file("addons/amx/ejl_vault.ini",line,data
   ,192,stxtsize))!=0){
                   parse(data,vkey,64,vvalue,128)
                   if(equal(vkey,key)){
                       copy(vault_value,128,vvalue)
                   }
               }
           }else{
               write_file("addons/amx/ejl_vault.ini",  "****  Plugins use
   to store values -- immune to crashes and map changes ****", 0)
           }
       }
       else if(equal(rw,"WRITE")){
           if(file_exists("addons/amx/ejl_vault.ini") == 1){
               format(vaultwrite,192,"%s %s",key,value)
               while((line=read_file("addons/amx/ejl_vault.ini",line,data
   ,192,stxtsize))!=0){
                   parse(data,vkey,64,vvalue,128)
                   if(skip == 0){
                       if( (equal(data,"")) || (equal(vkey,key)) ){
                           skip = 1
                           write_file("addons/amx/ejl_vault.ini",vaultwri
   te,line-1)
                       }
                   }
                   else if(equal(vkey,key)){
                       write_file("addons/amx/ejl_vault.ini","",line-1)
                   }
               }
               if(skip == 0){
                   write_file("addons/amx/ejl_vault.ini",vaultwrite,-1)
               }
           }
       }
       return PLUGIN_CONTINUE
   }
