
   /* AMXMOD script.
   *
   *  (c)  Copyright  2000-2002,  Rich  - This file is provided as is (no
   warranties).
   *
   * INSTANT BUTTON v1.2 - THE INSTANT ALTERNATIVE TO BINDING
   *
   * - Saves having to bind a key for ninjarope/hookmod with CS support.
   *
   *  -  Set  to  'USE' key, and +rope, by default - Open xtrafun.inc for
   complete list of keys
   *
   *
   *   v1.2  -  Added  CS defuse detection to stop being pushed away from
   bomb
   *
   *   v1.1  -  Fixed  repeated  console  commands  when holding down the
   button
   *
   *   v1.0 - Initial Release
   */
   #include <amxmod>
   #include <amxmisc>
   #include <xtrafun>
   new bool:icheck
   new bool:bcheck[33]
   new bool:dcheck[33]
   public plugin_init()
   {
     register_plugin("Instant Button", "2.0", "Rich")
     register_event("BarTime", "bomb_defuse", "be", "1=10", "1=5","1=3")
     set_task(0.1,"check_button",0,"",0,"b")
     set_task(5.0,"check_cvar",0,"",0,"b")
   }
   public check_cvar()
   {
     if (get_cvar_num("sv_ninjarope"))
     {
       icheck = true
     }
     else
     {
       icheck = false
     }
     return PLUGIN_CONTINUE
   }
   public check_button()
   {
     if (!(icheck))
     {
       return PLUGIN_CONTINUE
     }
     for(new i = 1; i <= get_maxplayers(); ++i)
     {
       if (is_user_alive(i))
       {
         if (get_user_button(i)&IN_USE)
         {
           if (!bcheck[i] && !dcheck[i])
           {
             client_cmd(i,"+rope")
             bcheck[i] = true
           }
         }
         else if (bcheck[i] || dcheck[i])
         {
           client_cmd(i,"-rope")
           bcheck[i] = false
           dcheck[i] = false
         }
       }
     }
     return PLUGIN_CONTINUE
   }
   public bomb_defuse(id)
   {
     client_cmd(id,"-rope")
     dcheck[id] = true
     return PLUGIN_CONTINUE
   }
