
   /*********************************************************************
   ******
   *   amx_ejl_timebomb.sma     release   version   3.3.1           Date:
   11/17/02
   *  Author: Eric Lidman      ejlmozart@hotmail.com
   *  Alias: Ludwig van        Upgrade:
   http://lidmanmusic.com/cs/plugins.html
   *
   * Formerly my Adminmod 'kamikazi' plugin re-written for AMX mod.
   * PODBOT: If using my podbots controller, podbots use this plugin too.
   * FX updated -- looks way cooler !!!
   *
   * COMMANDS:
   *
   *   say: kamikaze
   *   amx_timebombs < 0 | 1 >
   *   amx_timebombs_default
   *   amx_timebombs_lock
   *   amx_votetimebomb <part of nick>
   *   stopvote
   *   amx_timebomb_credit < 0 | 1 >
   *   amx_timebomb_credit_default
   *   amx_timebomb <part of nick>
   *
   *   Player  can  become a timebomb by saying "kamikazi" in chat. Admin
   can
   *   disable  the  kamikaze  function  with amx_timebombs 0 and turn it
   back
   *   on  again  with amx_timebombs 1. amx_timebombs_credit turns on and
   off
   *   the  giving  of frag credit to the kamikazi for any kills he makes
   by
   *   blowing  up  members  of  the  other team. Admin can make any live
   player
   *   without immunity into a timebomb with amx_timebomb <part of nick>.
   *   amx_timebombs_default  sets  the current timebombs mode as default
   by
   *   writing  it  to  a  vault  file  and  loading it at map start when
   plugins
   *   are  initialized.  amx_timebomb_credit_default  sets  the  current
   kamikazi
   *   frag credit mode as default just as admin_timebombs_default does.
   *   AMX ACCESS_RCON is required to set any defaults.
   *
   * CVARS:
   *
   *   amx_kamikaze_obeyffcvar 1  --if mp_friendlyfire is 1 and this cvar
   is
   *                                set to 0, this plugin will act as if
   *                                friendlyfire  is  off ... even if its
   on.
   *   amx_kamikaze_tkpunish2  1   --if friendlyfire is on, this sets the
   type
   *                                of  punishment  given  if  you kill a
   certain
   *                                number  of teammates detemined by the
   cvar
   *                                amx_kamikaze_tkpunish3.  Can be set 0
   - 2
   *                                   0 = no action
   *                                   1 = kick off server
   *                                   2 = ban for 3 hours
   *   amx_kamikaze_tkpunish3  3   --if  friendlyfire  is  on, on killing
   this
   *                                many  of  your  teammates, the plugin
   takes
   *                                the        action        set       by
   amx_kamikaze_tkpunish2
   *   amx_kamikaze_delay  300     --time  a  player  is  reqired to wait
   between
   *                                his   kamikazi   runs.   Time  is  in
   seconds.
   *   amx_kamikaze_hurtradius   700   -hurt   radius   of  bomb  (96  is
   playerheight)
   *   amx_kamikaze_killradius 450 -killing radius of bomb
   *   amx_kamikaze_fusetime 15   --timer length, best left at 15
   *
   * THE DETAILS:
   *
   *    Timer  has  a  15  second  fuse. Countdown is done with half-life
   sounds.
   *    Displayed  countdown  message  is  color  coded by team (CS t=red
   ct=blue).
   *    Bystanders will also die when bomb explodes. You know you are a
   *    bystander (or bomb) if you hear the timer beep. No more than
   *    one  player can kamikazi any given time. There is no limit to how
   many
   *    players can be bombs by an admin command. A timebomb player glows
   red
   *    during the countdown. Dead Players cannot become timebombs.
   *    There is a delay between "kamikaze" runs for each player to keep
   *    players  from hogging the bomb. A timebomb player who dies before
   the
   *    end of countdown explodes one second after death, also killing
   *    bystanders.  The bomb is sensitive to the friendlyfire cvar. This
   way
   *    if FF is off, you dont blow up your teamates. You earn a frag for
   each
   *    player  of the opposing team you blow up as the bomber. This frag
   credit
   *    only  appies  as  the  admin allows and only for kamikazi runs. A
   player
   *    who was turned into a timebomb by an admin recieves no credit.
   *    There  is  a delay at round start for kamikazi runs. Also, within
   the
   *    first  10  seconds  of  round  start, the bomb will only kill the
   bomber
   *    and  no  bystanders  even if FF is on. Kamikazis/timebombs do not
   carry
   *    over into the next round and will be exploded at the end of the
   *    round (CS). New: bystanders, if far enough away may only get hurt
   by
   *    the bomb and not killed outright. This plugin logs kills in the
   *    standard  HL  format  so  that  log parsers like psyshcostats can
   record
   *    kamikazi kills for stats pages (if frag credit is on). Also there
   is
   *    now  an  option for friendlyfire servers to turn off friendlyfire
   for
   *    kamikaze  kills.  Additionallly  there  is  A  built in TK punish
   system
   *    for dealing with kamikaze team kills. See cvars.
   *
   *  Setup:  Set  kamikazi  rule  for particular maps and lock it if you
   wish.
   *
   *    Create a file called kamikazi_config.txt and put it into your
   *    ..addons/amx folder. The contents should be the name of the map
   *    followed by 2 numbers which are 1 or 0. The first number turns on
   *    and off kamikazi mode for a map, the second specifies whether the
   *    fist value is locked and cannot be changed by a lower admin.
   *    Example contents of a line:  de_dust 0 1
   *    That  0  turns  kamikazi  off for de_dust and the 1 locks that so
   admin
   *    cant change it.
   *
   * Other Credits:
   *
   *    OLO -- for making AMXmod so that we can have a kamikaze with cool
   FX
   *    f117bomb -- for snippets admin_slay2 that helped me
   *    Ludwig  van  --  (lol  -me)  for for writing the original admimod
   version
   *
   * Additional:
   *
   *   If you have the module from SpaceDude's warcraft3 plugin (war3_ms)
   you
   *   can  make  the deahtmessages look more real, so flamethrower kills
   look
   *   like  an actual player killing another player instead of a suicide
   on the
   *   part  of the killed player. To enable this, you need to change the
   code
   *   below.  Simply change the value to 1 where it has #define use_war3
   0
   *   Its  simple, a one line change, thats it, compile and its ready to
   go.
   TODO:
   >  Hey  Lud  I  was thinking about Kamikaze again. How about making it
   something
   > you have to buy.
   >  Once  you  buy it you start ticking and Flashing , with the bomb on
   your back.
   >  Then  you  can  detonate  yourself  when  you hearts desire.(/boom)
   detonator
   > switch?
   >  At  round  end if you haven't detonated yourself 1)then you explode
   2)you can
   > carry the Kamikaze bomb over to next round.
   >  And  if  you die prior to typing the detonator switch , oh well you
   just
   > contiune to Tick !!
   >
   > Also Lud the other Variation of Kamikaze.
   >  The  player  typing  Kamikaze has a Primer(which could be variable)
   that needs
   > to be meet before the
   >  bomber  would  be  come  lethal to his enemy. So what do you think?
   Also thanks
   > For the deathbeams ,
   > Cool. Thanks Eric , Collin
   >
   *
   **********************************************************************
   *****/
   /*  To get the better deathmessages. Change this one  */
   /*  line so it looks like:    #define use_war3 1      */
   #define use_war3 0
   /*********************************************************************
   ***************
   *
                *
   *  *end*  customizable section of code. other changes can be done with
   the cvars    *
   *
                *
   **********************************************************************
   **************/
   #include <amxmod>
   #include <amxmisc>
   #if use_war3 == 1
   #include <war3>
   new gmsgDeathMsg
   new redundant_plug
   #endif
   new votenumber = 0
   new votecontroller[33][2]
   new answer[128]
   new option_name[4][32]
   new option[4]
   new Float:vote_ratio
   new st_vote = 0
   new totalvoters
   new bool:bVoteToStop = false
   new bool:bomb_lock = false
   new bool:tfc_b = false
   new bool:dod_running
   new bool:cstrike_running
   new tkcount[33]
   new bgf_message[33]
   new isspy[33]
   new dod_team[33]
   new vault_value[128]
   new gmsgFade
   new gmsgShake
   new fuselight
   new c4bomb
   new gibs
   new smoke
   new white
   new fire
   new Float:ejl_nextbomb[33]
   new IsBomb[33]
   new IsKamik[33]
   new wasbomb[33]
   new bool:bKamikAllow = true
   new bool:bKamikCredit = true
   new bool:rs = false
   explode(vec1[3],id){
      // blast circles
      message_begin( MSG_BROADCAST,SVC_TEMPENTITY,vec1)
      write_byte( 21 )
      write_coord(vec1[0])
      write_coord(vec1[1])
      write_coord(vec1[2] + 16)
      write_coord(vec1[0])
      write_coord(vec1[1])
      write_coord(vec1[2] + 1936)
      write_short( white )
      write_byte( 0 ) // startframe
      write_byte( 0 ) // framerate
      write_byte( 3 ) // life 2
      write_byte( 20 ) // width 16
      write_byte( 0 ) // noise
      write_byte( 188 ) // r
      write_byte( 220 ) // g
      write_byte( 255 ) // b
      write_byte( 255 ) //brightness
      write_byte( 0 ) // speed
      message_end()

      //Explosion2
      message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
      write_byte( 12 )
      write_coord(vec1[0])
      write_coord(vec1[1])
      write_coord(vec1[2])
      write_byte( 188 ) // byte (scale in 0.1's) 188
      write_byte( 10 ) // byte (framerate)
      message_end()
      //TE_Explosion
      message_begin( MSG_BROADCAST,SVC_TEMPENTITY,vec1)
      write_byte( 3 )
      write_coord(vec1[0])
      write_coord(vec1[1])
      write_coord(vec1[2])
      write_short( fire )
      write_byte( 65 ) // byte (scale in 0.1's) 188
      write_byte( 10 ) // byte (framerate)
      write_byte( 0 ) // byte flags
      message_end()
      //TE_KILLPLAYERATTACHMENTS
      message_begin(MSG_BROADCAST,SVC_TEMPENTITY,{0,0,0},id)
      write_byte( 125 ) // will expire all TENTS attached to a player.
      write_byte( id ) // byte (entity index of player)
      message_end()
      //Smoke
      message_begin( MSG_BROADCAST,SVC_TEMPENTITY,vec1)
      write_byte( 5 ) // 5
      write_coord(vec1[0])
      write_coord(vec1[1])
      write_coord(vec1[2])
      write_short( smoke )
      write_byte( 20 )  // 2
      write_byte( 10 )  // 10
      message_end()
   }
   public roundend_cleanup(){
       blowem_up(100)
       rs = true
       set_task(15.0,"roundstart_delay")
   }
   public roundstart_delay(){
       rs = false
   }
   public round_start(){
       new maxplayers = get_maxplayers()+1
       for (new a=1; a<maxplayers; a++){
           if(wasbomb[a] == 1){
               set_user_rendering(a,kRenderFxNone,255,255,255,
   kRenderNormal,16)
               wasbomb[a] = 0
           }
       }
       return PLUGIN_CONTINUE
   }
   public client_connect(id){
       dod_team[id] = 0
       ejl_nextbomb[id] = -1000.0
       IsBomb[id] = 0
       IsKamik[id] = 0
       wasbomb[id] = 0
       votecontroller[id][1] = 0
       isspy[id] = 0
       return PLUGIN_CONTINUE
   }
   public client_disconnect(id){
       dod_team[id] = 0
       ejl_nextbomb[id] = -1000.0
       IsBomb[id] = 0
       IsKamik[id] = 0
       wasbomb[id] = 0
       votecontroller[id][1] = 0
       isspy[id] = 0
       return PLUGIN_CONTINUE
   }
   public amx_timebombs(id,level,cid){
       if (!cmd_access(id,level,cid,1))
           return PLUGIN_HANDLED
       if(bomb_lock == true){
           console_print(id,"[AMX]  Kamikaze  ON/OFF is locked. No change
   can be made unless you do amx_timebombs_lock")
           return PLUGIN_HANDLED
       }
       if (read_argc() < 2){
           new onoff[4]
           if(bKamikAllow == true){
               copy(onoff, 4, "ON")
           }else{
               copy(onoff, 4, "OFF")
           }
           console_print(id,"[AMX]   Usage:  amx_timebombs  <  on  |  off
   >     Currently: %s", onoff)
           return PLUGIN_HANDLED
       }
       new arg[10]
       read_argv(1,arg,10)
       if ( (equal(arg,"on", 2)) || (equal(arg,"1", 1)) ){
           bKamikAllow = true
           console_print(id,"[AMX] Kamikaze mode is now ON")
           client_print(0,print_chat,"[AMX]  Admin  has  turned  Kamikaze
   mode ON")
       }else{
           bKamikAllow = false
           console_print(id,"[AMX] Kamikaze mode is now OFF")
           client_print(0,print_chat,"[AMX]  Admin  has  turned  Kamikaze
   mode OFF")
       }
       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><>^"
   timebombs_mode %s",
           name,get_user_userid(id),authid,arg)
       return PLUGIN_HANDLED
   }
   public amx_timebombs_d(id,level,cid){
       if (!cmd_access(id,level,cid,1))
           return PLUGIN_HANDLED
       if(bKamikAllow == false){
           ejl_vault("WRITE","Timebombs","off")
           console_print(id,"[AMX]   Kamikaze   mode   OFF   is  now  the
   default.")
       }else{
           ejl_vault("WRITE","Timebombs","on")
           console_print(id,"[AMX]   Kamikaze   mode   ON    is  now  the
   default.")
       }
       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><>^"
   timebombs_mode_d",
           name,get_user_userid(id),authid)
       return PLUGIN_HANDLED
   }
   public amx_tb_credit(id,level,cid){
       if (!cmd_access(id,level,cid,1))
           return PLUGIN_HANDLED
       if (read_argc() < 2){
           new onoff[4]
           if(bKamikCredit == true){
               copy(onoff, 4, "ON")
           }else{
               copy(onoff, 4, "OFF")
           }
           console_print(id,"[AMX]  Usage: amx_timebomb_credit < on | off
   >     Currently: %s", onoff)
           return PLUGIN_HANDLED
       }
       new arg[10]
       read_argv(1,arg,10)
       if ( (equal(arg,"on", 2)) || (equal(arg,"1", 1)) ){
           bKamikCredit = true
           console_print(id,"[AMX] Kamikaze frag credit is now ON")
           client_print(0,print_chat,"[AMX]  Admin  has  turned  Kamikaze
   frag credit mode ON")
       }else{
           bKamikCredit = false
           console_print(id,"[AMX] Kamikaze frag credit is now OFF")
           client_print(0,print_chat,"[AMX]  Admin  has  turned  Kamikaze
   frag credit mode OFF")
       }
       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><>^"
   kamikazi_frag_cr %s",
           name,get_user_userid(id),authid,arg)
       return PLUGIN_HANDLED
   }
   public amx_tb_credit_d(id,level,cid){
       if (!cmd_access(id,level,cid,1))
           return PLUGIN_HANDLED
       if(bKamikCredit == false){
           ejl_vault("WRITE","Kamikazi_FragCredit","off")
           console_print(id,"[AMX]  Kamikaze  frag  credit:  OFF   is now
   the default.")
       }else{
           ejl_vault("WRITE","Kamikazi_FragCredit","on")
           console_print(id,"[AMX]  Kamikaze  frag  credit:  ON    is now
   the default.")
       }
       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><>^"
   kamikazi_frag_cr_d",
           name,get_user_userid(id),authid)
       return PLUGIN_HANDLED
   }
   public amx_tfc_by(id,level,cid){
       if (!cmd_access(id,level,cid,1))
           return PLUGIN_HANDLED
       if (read_argc() < 2){
           new onoff[4]
           if(tfc_b == true){
               copy(onoff, 4, "ON")
           }else{
               copy(onoff, 4, "OFF")
           }
           console_print(id,"[AMX]  Usage:  amx_timebomb_tfc_b < on | off
   >     Currently: %s", onoff)
           return PLUGIN_HANDLED
       }
       new arg[10]
       read_argv(1,arg,10)
       if ( (equal(arg,"on", 2)) || (equal(arg,"1", 1)) ){
           tfc_b = true
           console_print(id,"[AMX] TFC timebomb bystander damage ON")
           client_print(0,print_chat,"[AMX] Admin has turned TFC timebomb
   bystander damage ON")
       }else{
           tfc_b = false
           console_print(id,"[AMX]  TFC  timebomb bystander damage is now
   OFF")
           client_print(0,print_chat,"[AMX] Admin has turned TFC timebomb
   bystander damage OFF")
       }
       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><>^" tfc_bystander
   %s",
           name,get_user_userid(id),authid,arg)
       return PLUGIN_HANDLED
   }
   public amx_tfc_by_d(id,level,cid){
       if (!cmd_access(id,level,cid,1))
           return PLUGIN_HANDLED
       if(tfc_b == false){
           ejl_vault("WRITE","TFC_Kamikazi_b","off")
           console_print(id,"[AMX]       TFC      timebomb      bystander
   damage:  OFF   is now the default.")
       }else{
           ejl_vault("WRITE","TFC_Kamikazi_b","on")
           console_print(id,"[AMX]       TFC      timebomb      bystander
   damage:  ON    is now the default.")
       }
       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><>^"
   tfc_bystander_d",
           name,get_user_userid(id),authid)
       return PLUGIN_HANDLED
   }
   public lock_unlock(id,level,cid){
       if (!cmd_access(id,level,cid,1))
           return PLUGIN_HANDLED
       if (bomb_lock == true){
           bomb_lock = false
           console_print(id,"[AMX] Kamikaze mode lock is OFF.")
       }else    {
           bomb_lock = true
           console_print(id,"[AMX] Kamikazi mode lock is ON.")
           if(bKamikAllow == true){
               console_print(id,"[AMX]   You   have  locked  kamikazi  ON
   mode.")
           }else{
               console_print(id,"[AMX]   You  have  locled  Kamikazi  OFF
   mode.")
           }
       }
       return PLUGIN_HANDLED
   }
   public check_votes()
   {
       set_cvar_string("amx_vote_inprogress","0")
       ejl_vault("WRITE","CURRENT_VOTE","NULL")
       bVoteToStop = false
       for(new a = 0; a < 33; a++){
           votecontroller[a][1] = 0
       }
       if(st_vote == 1){
           st_vote = 0
           client_print(0,print_chat,"[AMX]  Voting           sucessfully
   stopped.")
           return PLUGIN_HANDLED
       }
       new best = 0
       new best_count = 0
       for(new a = 0; a < 4; ++a) {
           if (option[a] > best_count){
               best_count = option[a]
               best = a
           }
       }
       new inum = totalvoters
       new  Float:result_v = inum ? (float(option[best]) / float(inum)) :
   0.0
       if (result_v >= vote_ratio) {
           new player = strtonum(option_name[0])
           new name2[32]
           get_user_name(player,name2,32)
           if(best == 0){
               if(is_user_alive(player) == 0){
                   client_print(0,print_chat,"[AMX] %s is dead and cannot
   be turned into a bomb.",name2)
                   return PLUGIN_HANDLED
               }
               bgf_message[player] = 0
               IsBomb[player] = get_cvar_num("amx_kamikaze_fusetime")
               player_attachment(player)
               client_cmd(0,"spk  ^"vox/warning  _comma _comma detonation
   device activated^"")
               client_print(0,print_chat,"[AMX]  Voting  successful.  The
   result:  %s  has  been  turned  into  a  timebomb by vote. (%d - %d of
   %d)",name2,option[0],option[1],totalvoters)
           }else{
               client_print(0,print_chat,"[AMX]  Voting  result:  %s will
   not become a timebomb.  (%d - %d of
   %d)",name2,option[0],option[1],totalvoters)
               log_to_file("addons/amx/admin.log","World        triggered
   ^"voting_success^"   (needed   ^"%.2f^")   (ratio   ^"%.2f^")  (result
   ^"bomb^")",
                   vote_ratio,result_v)
           }
       }else {
           client_print(0,print_chat,"[AMX]  Bomb  voting  failed...  Not
   enough for a clear majority  (%d - %d of
   %d)",option[0],option[1],totalvoters)
           log_to_file("addons/amx/admin.log","World            triggered
   ^"voting_failure^" (needed ^"%.2f^") (ratio ^"%.2f^")",
               vote_ratio,result_v)
       }
       return PLUGIN_HANDLED
   }
   public bot_voteinterface(){
       new arg1[8],arg2[8]
       read_argv(1,arg1,7)
       read_argv(2,arg2,7)
       new id = strtonum(arg1)
       new key = strtonum(arg2) - 1
       vote_count(id,key)
       return PLUGIN_CONTINUE
   }
   public vote_count(id,key){
       ejl_vault("READ","CURRENT_VOTE","")
       if(equal(vault_value,"TIMEBOMB")){
       new name[32]
       get_user_name(id,name,32)
       if(votenumber != votecontroller[id][0]){
           votecontroller[id][0] = votenumber
           if (get_cvar_float("amx_vote_answers")) {
               client_print(0,print_chat,"[AMX]  %s  voted  for  option #
   %d",name,key+1)
           }
           option[key] += 1
       }else{
           votecontroller[id][1] +=1
       }
       }else{
           return PLUGIN_CONTINUE
       }
       return PLUGIN_HANDLED
   }
   public admin_votebomb(id,level,cid){
       if (!cmd_access(id,level,cid,2))
           return PLUGIN_HANDLED
       new Float:voting = get_cvar_float("amx_last_voting")
       if (voting > get_gametime()){
           console_print(id,"There is already one voting...")
           return PLUGIN_HANDLED
       }
       if   (voting   &&   voting  +  get_cvar_float("amx_vote_delay")  >
   get_gametime()) {
           console_print(id,"Voting not allowed at this time")
           return PLUGIN_HANDLED
       }
       new inprogress[32]
       get_cvar_string("amx_vote_inprogress",inprogress,32)
       if(equal(inprogress, "0",1)){
       new arg[32]
       read_argv(1,arg,32)
       new player = cmd_target(id,arg,1)
       if (!player) return PLUGIN_HANDLED
       new menu_msg[256]
       new keys
       get_user_name(player,arg,32)
       if(is_user_alive(player) == 0){
           client_print(id,print_console,"[AMX]  %s is dead and cannot be
   voted a bomb.",arg)
           return PLUGIN_HANDLED
       }
       if (cstrike_running)
           format(menu_msg,256,"\yShould         we        blow        up
   %s?\w^n^n1.  Yes^n2.  No", arg)
       else
           format(menu_msg,256,"Should         we         blow         up
   %s?^n^n1.  Yes^n2.  No", arg)
       num_to_str(player,option_name[0],32)
       keys = (1<<0)|(1<<1)
       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><>^"   vote   bomb
   (target ^"%s^")",
           name,get_user_userid(id),authid,arg)
       new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0
       set_cvar_float("amx_last_voting",  get_gametime() + vote_time )
       vote_ratio = get_cvar_float("amx_votetimebomb_ratio")
       copy(answer,128, "bomb %s")
       for(new a = 0; a < 33; a++){
           votecontroller[a][1] = 0
       }
       votenumber++
       set_cvar_string("amx_vote_inprogress","1")
       ejl_vault("WRITE","CURRENT_VOTE","TIMEBOMB")
       bVoteToStop = true
       totalvoters = 0
       new Team[33]
       new maxpl = get_maxplayers()+1
       for(new k = 1; k < maxpl; k++){
           if( is_user_bot(k) && !get_cvar_num("amx_allowbotvotes") )
               continue
           get_user_team(k,Team,33)
           if(!((equali(Team,"UNAS",4))   ||  (equali(Team,"SPEC",4))  ||
   (get_user_time(k)== 0) )){
               show_menu(k,keys,menu_msg,floatround(vote_time))
               totalvoters++
           }
       }
       // cmd, #of options, type of vote 7=bomb
       server_cmd("bot_votebegin 2 7")
       if(is_user_bot(player))
           server_cmd("bot_bombrevenge %d %d",player,id)
       set_task(vote_time,"check_votes")
       st_vote = 0
       client_print(id,print_console,"[AMX] Voting has started...")
       for(new j = 0; j < 4;++j) option[j] = 0
       }else{
       client_print(id,print_console,"[AMX]  Voting  not  allowed  yet.")
       }
       return PLUGIN_HANDLED
   }
   public stopvote(id,level,cid){
       if (!cmd_access(id,level,cid,1))
           return PLUGIN_HANDLED
       if(bVoteToStop == true){
           new name[32]
           get_user_name(id,name,32)
           st_vote = 1
           client_print(id,print_console,"[AMX]  ADMIN   !!!  Ignore  the
   unknown command message -- its ok")
           client_print(0,print_chat,"[AMX]  %s  has disabled the vote in
   progress.",name)
       }
       return PLUGIN_CONTINUE
   }
   public admin_timebomb(id,level,cid){
       if (!cmd_access(id,level,cid,2))
           return PLUGIN_HANDLED
       new arg[32]
       read_argv(1,arg,32)
       new player = cmd_target(id,arg,1)
       if (!player) return PLUGIN_HANDLED
       if(is_user_alive(player) == 0){
           console_print(id,"[AMX]  The  player  is  dead  and  cannot be
   bombed")
           return PLUGIN_HANDLED
       }
       if(IsBomb[player] > 0){
           console_print(id,"[AMX] :  That player is already a bomb")
           return PLUGIN_HANDLED
       }
       bgf_message[player] = 0
       IsBomb[player] = get_cvar_num("amx_kamikaze_fusetime")
       new name2[32]
       get_user_name(player,name2,32)
       client_cmd(0,"spk  ^"vox/warning  _comma  _comma detonation device
   activated^"")
       client_print(0,print_chat,"[AMX]   :  %s   has   become   a  human
   timebomb, run for cover!!!", name2)
       new authid[16],authid2[16],name[32]
       get_user_authid(player,authid2,16)
       get_user_authid(id,authid,16)
       get_user_name(id,name,32)
       player_attachment(player)
       log_to_file("addons/amx/admin.log","^"%s<%d><%s><>^"      timebomb
   ^"%s<%d><%s><>^"",
           name,get_user_userid(id),authid,
   name2,get_user_userid(player),authid2 )
       console_print(id,"[AMX] Client ^"%s^" bombed",name2)
       client_print(0,print_chat,"[AMX]                 Admin:    %s  has
   bombed  %s",name,name2)
       return PLUGIN_HANDLED
   }
   public handle_botsayplugin(){
       new arg0[8]
       read_argv(1,arg0,7)
       new iarg0 = strtonum(arg0)
       new sarg2[192]
       read_args(sarg2,191)
       new arg1[8]
       read_argv(2,arg1,7)
       new iarg1 = strtonum(arg1)
       if(is_user_bot(iarg1)){
           new OnlySay[128]
           new len = strlen(sarg2)
           new start = contain(sarg2,":    ")
           copy(OnlySay,len-start+5,sarg2[start+5])
           if(HandleSay2(iarg1,OnlySay))
               server_cmd("botsayreturn %d 1",iarg0)
       }
       return PLUGIN_CONTINUE
   }
   public HandleSay(id){
       new Speech[192]
       read_args(Speech,192)
       remove_quotes(Speech)
       if(HandleSay2(id,Speech))
           return PLUGIN_HANDLED
       return PLUGIN_CONTINUE
   }
   public HandleSay2(id,Speech[]){
       new Float:gt = get_gametime()
       new Float:KAMIKAZI_DELAY = get_cvar_float("amx_kamikaze_delay")
       if ( (equal(Speech,"kamik",5)) || (equal(Speech,"kamak",5)) ){
           if(bKamikAllow == false){
               client_print(id,print_chat,"[AMX]  :  Admin  has  disabled
   the ability to kamikaze.")
               return PLUGIN_HANDLED
           }
           if(is_user_alive(id) == 0){
               client_print(id,print_chat,"[AMX]  :  You  cannot become a
   bomb, you are already dead.")
               return PLUGIN_HANDLED
           }
           if(rs == true){
               client_print(id,print_chat,"[AMX]  :  Its too early in the
   round to become a bomb.")
               return PLUGIN_HANDLED
           }
           if(IsBomb[id] > 0){
               client_print(id,print_chat,"[AMX]   :  You  are  the  bomb
   already.")
               return PLUGIN_HANDLED
           }
           if(isspy[id] == 1){
               client_print(id,print_chat,"[AMX]  :  You  are a spy, spys
   cannot become kamikazes.")
               return PLUGIN_HANDLED
           }
           new maxpl = get_maxplayers() +1
           for(new a = 1; a < maxpl; ++a) {
               if(IsKamik[a] == 1){
                   client_print(id,print_chat,"[AMX]  :  Wait  your turn,
   someone else is the kamikazi.")
                   return PLUGIN_HANDLED
               }
           }
           if(ejl_nextbomb[id] > gt - KAMIKAZI_DELAY ){
               client_print(id,print_chat,"[AMX]  :  You were just a bomb
   a short while ago, give someone else a chance.")
               return PLUGIN_HANDLED
           }
           bgf_message[id] = 0
           IsKamik[id] = 1
           IsBomb[id] = get_cvar_num("amx_kamikaze_fusetime")
           ejl_nextbomb[id] = gt
           new name[32]
           get_user_name(id,name,32)
           player_attachment(id)
           client_cmd(0,"spk   ^"vox/warning   _comma  _comma  detonation
   device activated^"")
           client_print(0,print_chat,"[AMX]  :  %s  has  become  a  human
   timebomb, run for cover!!!", name)
           return PLUGIN_CONTINUE
       }
       return PLUGIN_CONTINUE
   }
   public timebomb_timer(){
       new hibomb = 100
       new maxpl = get_maxplayers() +1
       new a
       for(a = 1; a < maxpl; a++) {
           if ((IsBomb[a] != 0) && (IsBomb[a] < hibomb))
               hibomb = a
       }
       for(a = 1; a < maxpl; a++) {
           if (IsBomb[a] > 0){
               emit_sound(a,CHAN_ITEM,      "buttons/blip2.wav",     1.0,
   ATTN_NORM, 0, PITCH_NORM)
               new origin[3]
               get_user_origin(a,origin)
               //TE_SPRITE
               message_begin(MSG_BROADCAST,SVC_TEMPENTITY,{0,0,0},a)
               write_byte(17) // additive sprite, plays 1 cycle
               write_coord(origin[0]) // pos
               write_coord(origin[1]) // pos
               write_coord(origin[2]+20) // pos
               write_short (fuselight) // spr index
               write_byte(20) // (scale in 0.1's)
               write_byte (200) //(brightness)
               message_end()
               if (IsBomb[a] == 1){
                   blowem_up(a)
               }else{
                   IsBomb[a] -= 1
                   if (a == hibomb){
                       new name[32]
                       new team[32]
                       get_user_name(a,name,32)
                       get_user_team(a,team,32)
                       if(equal(team,"T", 1)){
                           set_hudmessage(200,0,0,  0.03,  0.76, 2, 0.02,
   2.0, 0.01, 0.1, 2)
                       }else{
                           set_hudmessage(0,100,200, 0.03, 0.76, 2, 0.02,
   2.0, 0.01, 0.1, 2)
                       }
                       show_hudmessage(0,"%s    will    explode   in   %d
   seconds.",name,IsBomb[a])
                       if (IsBomb[a] == 11){
                           client_cmd(0,"spk ^"fvox/remaining^"")
                       }
                       if (IsBomb[a] < 11){
                           new temp[48]
                           num_to_word(IsBomb[a],temp,48)
                           client_cmd(0,"spk ^"fvox/%s^"",temp)
                       }
                   }
                   if(is_user_alive(a) == 0){
                       blowem_up(a)
                   }
               }
           }
       }
   }
   public blowem_up(id){
       if(id == 100){
           new maxpl = get_maxplayers() +1
           for(new a = 1; a < maxpl; a++) {
               if ((IsBomb[a] > 0) || (IsKamik[a] == 1)){
                   IsKamik[a] = 0
                   IsBomb[a] = 0
                   new name[32]
                   get_user_name(a,name,32)
                   set_hudmessage(200,255,200,  0.03, 0.76, 2, 0.02, 2.0,
   0.01, 0.1, 2)
                   show_hudmessage(0,"%s has exploded.",name)
                       new origin[3]
                   get_user_origin(a,origin)
                   origin[2] = origin[2] - 26
                   user_kill(a,1)
                   explode(origin,a)
                   wasbomb[a] = 1
                   #if use_war3 == 1
                   stop_dm(a,a,0,9876)
                   #endif
               }
           }
       }else{
           if (IsBomb[id] > 0){
               new BOMBKILL_RANGE =
   get_cvar_num("amx_kamikaze_killradius")
               new BOMBHURT_RANGE =
   get_cvar_num("amx_kamikaze_hurtradius")
               new players[32], inum
               new origin1[3],name[32]
               get_user_name(id,name,31)
               set_hudmessage(200,255,200,  0.03,  0.76,  2,  0.02,  2.0,
   0.01, 0.1, 2)
               show_hudmessage(0,"%s has exploded.",name)
               new origin[3]
               get_user_origin(id,origin)
               new maxpl = get_maxplayers() +1
               for(new a = 1; a < maxpl; a++) {
                   if(cvar_exists("mp_friendlyfire")){
                       new ffcvar = get_cvar_num("mp_friendlyfire")
                       if(   (ffcvar   ==   0)   ||  ((ffcvar  ==  1)  &&
   (get_cvar_num("amx_kamikaze_obeyffcvar") == 0)) ){
                           if(dod_running){
                               if(dod_team[a] != dod_team[id]){
                                   if((is_user_alive(a)  ==  1)  && (a !=
   id)){
                                       get_user_origin(a,origin1)
                                       if(get_distance(origin,origin1)  <
   BOMBKILL_RANGE)
                                           do_victim(a,id,1,origin1,0)
                                       else
   if(get_distance(origin,origin1) < BOMBHURT_RANGE)
                                           do_victim(a,id,0,origin1,0)
                                   }
                               }
                           }else{
                               if(get_user_team(a) != get_user_team(id)){
                                   if((is_user_alive(a)  ==  1)  && (a !=
   id)){
                                       get_user_origin(a,origin1)
                                       if(get_distance(origin,origin1)  <
   BOMBKILL_RANGE)
                                           do_victim(a,id,1,origin1,0)
                                       else
   if(get_distance(origin,origin1) < BOMBHURT_RANGE)
                                           do_victim(a,id,0,origin1,0)
                                   }
                               }
                           }
                       }else{
                           if((is_user_alive(a) == 1) && (a != id)){
                               get_user_origin(a,origin1)
                               if(dod_running){
                                   if(dod_team[a] == dod_team[id]){
                                       if(get_distance(origin,origin1)  <
   BOMBKILL_RANGE){
                                           if(!rs)
                                               do_victim(a,id,1,origin1,1
   )
                                       }
                                       else
   if(get_distance(origin,origin1) < BOMBHURT_RANGE){
                                           if(!rs)
                                               do_victim(a,id,0,origin1,1
   )
                                       }
                                   }else{
                                       if(get_distance(origin,origin1)  <
   BOMBKILL_RANGE)
                                           do_victim(a,id,1,origin1,0)
                                       else
   if(get_distance(origin,origin1) < BOMBHURT_RANGE)
                                           do_victim(a,id,0,origin1,0)
                                   }
                               }else{
                                   if(get_user_team(a)                 ==
   get_user_team(id)){
                                       if(get_distance(origin,origin1)  <
   BOMBKILL_RANGE){
                                           if(!rs)
                                               do_victim(a,id,1,origin1,1
   )
                                       }
                                       else
   if(get_distance(origin,origin1) < BOMBHURT_RANGE){
                                           if(!rs)
                                               do_victim(a,id,0,origin1,1
   )
                                       }
                                   }else{
                                       if(get_distance(origin,origin1)  <
   BOMBKILL_RANGE)
                                           do_victim(a,id,1,origin1,0)
                                       else
   if(get_distance(origin,origin1) < BOMBHURT_RANGE)
                                           do_victim(a,id,0,origin1,0)
                                   }
                               }
                           }
                       }
                   }else{
                       if((is_user_alive(a) == 1) && (a != id)){
                           get_user_origin(a,origin1)
                           if(get_distance(origin,origin1)              <
   BOMBKILL_RANGE)
                               do_victim(a,id,1,origin1,0)
                           else     if(get_distance(origin,origin1)     <
   BOMBHURT_RANGE)
                               do_victim(a,id,0,origin1,0)
                       }
                   }
               }
               IsBomb[id] = 0
               IsKamik[id] = 0
               client_print(id,print_chat,"[AMX]   :  Sorry,   the   bomb
   killed you.")
               user_kill(id,1)
               #if use_war3 == 1
               stop_dm(id,id,0,9876)
               #endif
               message_begin(MSG_ONE,gmsgFade,{0,0,0},id)
               write_short( 1<<11 ) // fade lasts this long furation
               write_short( 1<<11 ) // fade lasts this long hold time
               write_short( 1<<12 ) // fade type (in / out)
               write_byte( 250 ) // fade red
               write_byte( 250 ) // fade green
               write_byte( 250 ) // fade blue
               write_byte( 255 ) // fade alpha
               message_end()
               if((bKamikCredit == true) && (bgf_message[id] > 0)){
                   client_print(id,print_chat,"[AMX]   :  Your   kamikazi
   attempt was a success:  You made %d KILLS.", bgf_message[id])
               }
               origin[2] = origin[2] - 26
               explode(origin,id)
               get_players(players,inum,"c")
               for(new i = 0 ;i < inum; ++i){
                   message_begin(MSG_ONE,gmsgShake,{0,0,0},players[i])
                   write_short( 1<<14 )// shake amount
                   write_short( 1<<14 )// shake lasts this long
                   write_short( 1<<14 )// shake noise frequency
                   message_end()
               }
               //define TE_EXPLODEMODEL
               message_begin(MSG_BROADCAST,SVC_TEMPENTITY,{0,0,0},id)
               write_byte(107)  // spherical shower of models, picks from
   set
               write_coord(origin[0]) // pos
               write_coord(origin[1])
               write_coord(origin[2])
               write_coord(175) //(velocity)
               write_short (gibs) //(model index)
               write_short (25) // (count)
               write_byte (100) // (life in 0.1's)
               message_end()
               wasbomb[id] = 1
               set_user_rendering(id,kRenderFxNone,                0,0,0,
   kRenderTransAdd,0)
           }
       }
   }
   do_victim(victim,killer,killvictim,origin1[3],tk){
       new health = get_user_health(victim)
       new team[32],teamv[32],authid[32],authidv[32],name[32],namev[32]
       get_user_team(victim,teamv,31)
       get_user_name(victim,namev,31)
       get_user_authid(victim,authidv,31)
       get_user_team(killer,team,31)
       get_user_name(killer,name,31)
       get_user_authid(killer,authid,31)
       if((killvictim == 1) || (health < 50)){
           client_print(victim,print_chat,"[AMX]   :  Sorry,   the   bomb
   killed you.")
           if((bKamikCredit == true) && (IsKamik[killer] == 1)){
               new bombguyfrags = get_user_frags(killer)
               if(tk == 0){
                   bgf_message[killer] +=1
                   set_user_frags(killer,bombguyfrags + 1)
               }else{
                   tkcount[killer] +=1
                   set_user_frags(killer,bombguyfrags - 1)
                   new punish1 = get_cvar_num("amx_kamikaze_tkpunish1")
                   new punish2 = get_cvar_num("amx_kamikaze_tkpunish2")
                   if(tkcount[killer] > punish2 - 1){
                       if(punish1 == 1)
                           client_cmd(killer,"echo  You  were  kicked for
   team killing;disconnect")
                       else if(punish1 == 2){
                           client_cmd(killer,"echo  You  were  banned for
   team killing")
                           if (equal("4294967295",authid)){
                               new ipa[32]
                               get_user_ip(killer,ipa,31,1)
                               server_cmd("addip 180.0 %s;writeip",ipa)
                           }else{
                               server_cmd("banid         180.0         %s
   kick;writeid",authid)
                           }
                       }
                   }
               }
               log_message("^"%s<%d><%s><%s>^"  killed ^"%s<%d><%s><%s>^"
   with ^"Kamikaze Bomb^"",
               name,get_user_userid(killer),authid,team,namev,get_user_us
   erid(victim),authidv,teamv)
           }
           #if use_war3 == 1
           stop_dm(killer,victim,0,9876)
           #endif
           server_cmd("artificial_dm %d %d",killer,victim)
           user_kill(victim,1)
           explode(origin1,victim)
       }else{
           client_print(victim,print_chat,"[AMX]  :  Ouch, that bomb hurt
   you.")
           set_user_health(victim,health-50)
           if(get_cvar_num("mp_logdetail") == 3){
               log_message("^"%s<%d><%s><%s>^"                   attacked
   ^"%s<%d><%s><%s>^"  with  ^"Kamikaze  Bomb^"  (hit  ^"chest^") (damage
   ^"50^") (health ^"%d^")",
               name,get_user_userid(killer),authid,team,namev,get_user_us
   erid(victim),authidv,teamv,get_user_health(victim))
           }
           if(tk == 1){
               new players[32],pNum
               get_players(players,pNum,"e",team)
               for(new i=0;i<pNum;i++)
                   client_print(players[i],print_chat,"%s  attacked     a
   teammate",name)
           }
       }
   }
   player_attachment(id){
       new att_life = (get_cvar_num("amx_kamikaze_fusetime") * 10) + 20
       if(att_life > 255 || att_life < 1)
           att_life = 255
       //TE_PLAYERATTACHMENT
       message_begin(MSG_BROADCAST,SVC_TEMPENTITY,{0,0,0},id)
       write_byte  (  124  )  //attaches  a  TENT  to a player (this is a
   high-priority tent)
       write_byte ( id )  //(entity index of player)
       write_coord  (  7  )  // ( attachment origin.z = player origin.z +
   vertical offset )
       write_short ( c4bomb ) // model index
       write_short ( att_life )     // (life * 10 )
       message_end()
   }
   public plugin_log(){
       new args = read_logargc()
       if(args == 2){
           new msg[32]
           read_logargv(1,msg,31)
           if(msg[6] == 'S')
               round_start()
       }
       else if(args == 3){
           new msg[32]
           read_logargv(1,msg,31)
           if(equal(msg,"changed role to",15)){
               new clinfo[64],won[32],cutoff,bcount
               new classinfo[32]
               read_logargv(0,clinfo,63)
               read_logargv(2,classinfo,31)
               new tcbackw = strlen(clinfo)
               new cbackw = tcbackw
               for(new i=0;i<tcbackw;i++){
                   cbackw -= 1
                   if(cbackw > 0){
                       if(clinfo[cbackw] == '<'){
                           bcount +=1
                           if(bcount == 2){
                               copy(won,i-cutoff,clinfo[cbackw+1])
                           }
                           else if(bcount == 1)
                               cutoff = i + 2
                       }
                   }
               }
               new playerl = find_player("c",won)
               if(!playerl) return PLUGIN_CONTINUE
               if(equali(classinfo,"Spy"))
                   isspy[playerl] = 1
               else
                   isspy[playerl] = 0
           }
           else if(equal(msg,"joined t",8)){
               new clinfo[64],won[32],cutoff,bcount
               new classinfo[32]
               read_logargv(0,clinfo,63)
               read_logargv(2,classinfo,31)
               new tcbackw = strlen(clinfo)
               new cbackw = tcbackw
               for(new i=0;i<tcbackw;i++){
                   cbackw -= 1
                   if(cbackw > 0){
                       if(clinfo[cbackw] == '<'){
                           bcount +=1
                           if(bcount == 3){
                               copy(won,i-cutoff,clinfo[cbackw+1])
                           }
                           else if(bcount == 2)
                               cutoff = i + 2
                       }
                   }
               }
               new iwon = strtonum(won)
               new playerl = find_player("k",iwon)
               if(!playerl) return PLUGIN_CONTINUE
               if(equali(classinfo,"Axis"))
                   dod_team[playerl] = 1
               else
                   dod_team[playerl] = 2
           }
       }
       return PLUGIN_CONTINUE
   }
   public new_spawn(id){
       if(!cstrike_running){
           set_user_rendering(id,kRenderFxNone,255,255,255,
   kRenderNormal,16)
           wasbomb[id] = 0
       }
       #if use_war3 == 1
       block_message(gmsgDeathMsg)
       #endif
       return PLUGIN_CONTINUE
   }
   #if use_war3 == 1
   public stop_dm(id,tid,tbody,num){
       if(num == 9876){
           if (tbody == 1){
               message_begin( MSG_ALL, gmsgDeathMsg,{0,0,0},0)
               write_byte(id)
               write_byte(tid)
               write_string(" kamikaze bomb")
               message_end()
           }else{
               message_begin( MSG_ALL, gmsgDeathMsg,{0,0,0},0)
               write_byte(id)
               write_byte(tid)
               write_byte(0)
               write_string(" kamikaze bomb")
               message_end()
           }
       }else{
           if(redundant_plug == 0){
               new killer_id = read_data(1)
               new victim_id = read_data(2)
               new headshot = read_data(3)
               new weaponname[20]
               if(cstrike_running)
                   read_data(4,weaponname,31)
               else
                   read_data(3,weaponname,31)
               new weapon
               get_user_attacker(victim_id,weapon)

               if     (!(killer_id==victim_id     &&     !headshot     &&
   equal(weaponname,"world"))){
                   message_begin( MSG_ALL, gmsgDeathMsg,{0,0,0},0)
                   write_byte(killer_id)
                   write_byte(victim_id)
                   write_byte(headshot)
                   write_string(weaponname)
                   message_end()
               }
           }
       }
       return PLUGIN_HANDLED
   }
   public regulate_plugins_dm(){
       new nump = get_pluginsnum()
       new filename[64],name[64],version[32],author[32],status[32]
       for(new i=0;i<nump;++i){
           get_plugin(i,filename,63,name,63,version,31,author,31,status,3
   1)
           if(equali(filename,"warcraft3.amx")){
               set_cvar_num("amx_ejl_rpdm",1)
               redundant_plug = 1
           }
       }
       for(new i=0;i<nump;++i){
           get_plugin(i,filename,63,name,63,version,31,author,31,status,3
   1)
           if(get_cvar_num("amx_ejl_rpdm")){
               if(     (equali(filename,"amx_ejl_laserweapon.amx"))    &&
   (strtonum(version[0]) > 1) )
                   redundant_plug = 1
               else     if(     (equali(filename,"laser_guns.amx"))    &&
   (strtonum(version[0]) > 1) )
                   redundant_plug = 1
               else   if(   (equali(filename,"amx_ejl_missiles.amx"))  &&
   (strtonum(version[0]) > 1) )
                   redundant_plug = 1
               else     if(    (equali(filename,"cs_missiles.amx"))    &&
   (strtonum(version[0]) > 1) )
                   redundant_plug = 1
               else  if( (equali(filename,"amx_ejl_flamethrower.amx")) &&
   (strtonum(version[0]) > 4) )
                   redundant_plug = 1
               else   if(   (equali(filename,"cs_flamethrower.amx"))   &&
   (strtonum(version[0]) > 4) )
                   redundant_plug = 1
               else   if(   (equali(filename,"amx_ejl_jetpack.amx"))   &&
   (strtonum(version[0]) > 1) )
                   redundant_plug = 1
               else    if(    (equali(filename,"luds_jetpack.amx"))    &&
   (strtonum(version[0]) > 1) )
                   redundant_plug = 1
           }
       }
       set_cvar_num("amx_ejl_rpdm",1)
       set_task(1.0,"regulate_plugins_rs")
       return PLUGIN_CONTINUE
   }
   public regulate_plugins_rs(){
       set_cvar_num("amx_ejl_rpdm",0)
       return PLUGIN_CONTINUE
   }
   #endif
   public plugin_precache(){
       new mod_name[32]
       get_modname(mod_name,31)
       dod_running = equal(mod_name,"dod") ? true : false
       if(dod_running)
           smoke = precache_model("sprites/smoke.spr")
       else
           smoke = precache_model("sprites/steam1.spr")
       white = precache_model("sprites/white.spr")
       fire = precache_model("sprites/explode1.spr")
       fuselight = precache_model("sprites/glow01.spr")
       c4bomb = precache_model("models/w_weaponbox.mdl")
       gibs = precache_model("models/hgibs.mdl")
       precache_sound( "buttons/blip2.wav")
       return PLUGIN_CONTINUE
   }
   public plugin_init(){
       register_plugin("Kamikaze","3.3.1","EJL")
       register_cvar("amx_luds_kamikaze","v3.3.1",FCVAR_SERVER )
       register_concmd("amx_timebombs","amx_timebombs",ADMIN_SLAY,"<on
   |off>   turns ability to kamikazi on and off")
       register_concmd("amx_timebombs_default","amx_timebombs_d",ADMIN_RC
   ON,"sets the current kamikazi mode as default")
       register_concmd("amx_timebomb_credit","amx_tb_credit",ADMIN_SLAY,"
   <on |off>   turns kamikazi frag credit on and off")
       register_concmd("amx_timebomb_credit_default","amx_tb_credit_d",AD
   MIN_RCON,"sets the current kamikazi frag credit mode as default")
       register_concmd("amx_timebomb","admin_timebomb",ADMIN_SLAY,"<
   player >")
       register_concmd("amx_votetimebomb","admin_votebomb",ADMIN_USER,"<
   part of nick >")
       register_concmd("amx_timebombs_lock","lock_unlock",ADMIN_RCON,"Loc
   ks/unlocks the current timebombs mode")
       register_concmd("stopvote","stopvote",ADMIN_MAP,"stops   vote   in
   progress")
       register_clcmd("say","HandleSay")
       register_event("SendAudio","roundend_cleanup","a","2=%!MRAD_terwin
   ","2=%!MRAD_ctwin","2=%!MRAD_rounddraw")
       register_event("TextMsg","roundend_cleanup","a","2&#Game_C","2&#Ga
   me_w")
       register_srvcmd("botsay","handle_botsayplugin")
       register_srvcmd("bot_votesfor","bot_voteinterface")
       register_cvar("amx_kamikaze_obeyffcvar","1")
       register_cvar("amx_kamikaze_tkpunish1","1")
       register_cvar("amx_kamikaze_tkpunish2","3")
       register_cvar("amx_kamikaze_delay","300")
       register_cvar("amx_kamikaze_hurtradius","700")
       register_cvar("amx_kamikaze_killradius","450")
       register_cvar("amx_kamikaze_fusetime","15")
       set_cvar_string("amx_kamikaze_obeyffcvar","1")
       set_cvar_string("amx_kamikaze_tkpunish1","1")
       set_cvar_string("amx_kamikaze_tkpunish2","3")
       set_cvar_string("amx_kamikaze_delay","300")
       set_cvar_string("amx_kamikaze_hurtradius","700")
       set_cvar_string("amx_kamikaze_killradius","450")
       set_cvar_string("amx_kamikaze_fusetime","15")
       register_cvar("amx_vote_inprogress","0")
       register_cvar("amx_last_voting","0")
       set_cvar_float("amx_last_voting",0.0)
       register_menucmd(register_menuid("Should    we    blow    up    ")
   ,(1<<0)|(1<<1)|(1<<2)|(1<<3),"vote_count")
       register_cvar("amx_votetimebomb_ratio","0.51")
       gmsgFade = get_user_msgid("ScreenFade")
       gmsgShake = get_user_msgid("ScreenShake")
       set_task(1.0,"timebomb_timer",765,"",0,"a", 9999)
       ejl_vault("READ","Timebombs","")
       if(equal(vault_value,"off"))
           bKamikAllow = false
       else
           bKamikAllow = true
       ejl_vault("READ","Kamikazi_FragCredit","")
       if(equal(vault_value,"off"))
           bKamikCredit = false
       else
           bKamikCredit = true
       ejl_vault("READ","TFC_Kamikazi_b","")
       if(equal(vault_value,"off"))
           tfc_b = false
       else
           tfc_b = true
       new mod_name[32]
       get_modname(mod_name,31)
       cstrike_running = equal(mod_name,"cstrike") ? true : false
       ejl_vault("WRITE","CURRENT_VOTE","NULL")
       set_task(2.2,"set_kamik_rule")
       register_event("ResetHUD", "new_spawn", "b")
       #if use_war3 == 1
       gmsgDeathMsg = get_user_msgid("DeathMsg")
       register_event("DeathMsg", "stop_dm", "a")
       block_message(gmsgDeathMsg)
       set_task(1.0,"regulate_plugins_dm")
       register_cvar("amx_ejl_rpdm","0")
       #endif
       return PLUGIN_CONTINUE
   }
   public set_kamik_rule(){
       new ThisMap[33]
       get_mapname(ThisMap, 33)
       if(file_exists("addons/amx/kamikazi_config.txt") == 1){
           new line = 0
           new data[128]
           new stextsize = 0
           new map[32]
           new value[2], value2[2]
           while((line=read_file("addons/amx/kamikazi_config.txt",line,da
   ta,128,stextsize))!=0){
               parse(data,map,32,value,2,value2,2)
               if(equali(map,ThisMap)){
                   if(equal(value,"1",1)){
                       bKamikAllow = true
                   }else{
                       bKamikAllow = false
                   }
                   if(equal(value2,"1",1)){
                       bomb_lock = true
                   }
               }
           }
       }
       return PLUGIN_HANDLED
   }
   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
   }
