
   /*
   *
   * AMX_VOTEBOT
   * based on PISTOL ONLY plugin
   * special thanks to [CCC]Taz_Devil for his help :)
   *  Players can say "vote_bot" to start a vote to disable bots (and not
   to kick them)
   * Admins can also enable/disable bots by writting "amx_bot" in console
   *  so  bots  will  still  be here but will die at the respawn and keep
   slots busy
   *  useful  for servers with little connection : you can set maxplayers
   to 10 with 5 bots
   * with 5 online players , that let make you run a 10 slots server
   *
   * NOTE: Plugin adminvote from AMX 0.9.x required!!!
   */
   #include <amxmod>
   #include <amxmisc>
   new bool:BotEnabled
   new option[2]
   public amx_enablebot(id,level,cid) {
      if (!cmd_access(id,level,cid,1))
         return PLUGIN_HANDLED
      new arg1[4]
      read_argv(1,arg1,3)
      if (equal(arg1,"1")||equali(arg1,"on")){
         BotEnabled = true
      }
      else if (equal(arg1,"0")||equali(arg1,"off")){
         BotEnabled = false
      }
      else {
         console_print(id,"Bots   are   %s",BotEnabled   ?  "disabled"  :
   "enabled")
         return PLUGIN_HANDLED
      }
      console_print(id,"Bots are %s",BotEnabled ? "disabled" : "enabled")
      client_print(0,print_center,"Bots are %s",BotEnabled ? "disabled" :
   "enabled")
      set_hudmessage(0, 100, 0, 0.05, 0.65, 2, 0.02, 10.0, 0.01, 0.1, 2)
      show_hudmessage(0,BotEnabled  ? "Bots won't play anymore !" : "Bots
   will play again next round !" )
      return PLUGIN_HANDLED
   }
   new votebot[] = "\yAMX %s bots?\w^n^n1. Yes^n2. No"
   public vote_bots(id){
      new Float:voting = get_cvar_float("amx_last_voting")
      if (voting > get_gametime()){
         client_print(id,print_chat,"*   There   is  already  a  vote  in
   progress...")
         return PLUGIN_HANDLED
      }
      if   (voting   &&   voting   +  get_cvar_float("amx_vote_delay")  >
   get_gametime()) {
           client_print(id,print_chat,"*   Voting  not  allowed  at  this
   time...")
           return PLUGIN_HANDLED
      }
      new menu_msg[256]
      format(menu_msg,255,votebot,BotEnabled   ?   "Play  with"  :  "Play
   without")
      new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0
      set_cvar_float("amx_last_voting",  get_gametime() + vote_time )
      show_menu(0,(1<<0)|(1<<1),menu_msg,floatround(vote_time))
      set_task(vote_time,"check_votes")
      client_print(0,print_chat,"* Voting has started...")
      option[0]=option[1]=0
      return PLUGIN_HANDLED
   }
   public vote_count(id,key){
      if ( get_cvar_float("amx_vote_answers") ) {
         new name[32]
         get_user_name(id,name,31)
         client_print(0,print_chat,"* %s vote %s", name, key ? "against."
   : "for." )
      }
      ++option[key]
      return PLUGIN_HANDLED
   }
   public check_votes(id){
      if (option[0] > option[1]){
         server_cmd("amx_bot %s", BotEnabled ? "off" : "on" )
         client_print(0,print_chat,"*  Voting successful (yes ^"%d^") (No
   ^"%d^").",option[0],option[1])
      }
      else{
         client_print(0,print_chat,"*  Voting  failed  (Yes  ^"%d^")  (No
   ^"%d^").",option[0],option[1])
      }
      return PLUGIN_CONTINUE
   }
   killbots() {
      new qlist[32],qnum
      get_players(qlist,qnum,"ad")
      for (new i=0; i<qnum; i++) {
         user_kill(qlist[i],1)
      }
   }
   public round_start(){
      new plist[32],pnum
      get_players(plist,pnum,"ac")
      if ((BotEnabled) && (pnum >= 2)) {
         killbots()
         client_print(0,print_center,"NO BOT AT THIS TIME")
      }
      if ((BotEnabled) && (pnum < 2))
         client_print(0,print_chat,"[AMX]  No  enough  player  to disable
   bots")

      return PLUGIN_CONTINUE

   }
   public  client_connect(id){              //  optional  : when an admin
   with flag RCON connect
      if (((get_user_flags(id)&ADMIN_RCON)) &&
   (get_cvar_num("admin_kickbot"))) // a bot is kicked and admin take its
   slot (FOR LOCAL USER ONLY)
         server_cmd("joebot kickbot|1|2")  // Joebot command
         server_cmd("pb kickbot")          // Podbot command
   }
   public  client_disconnect(id){           //  optional  : when an admin
   with flag RCON disconnect
      if (((get_user_flags(id)&ADMIN_RCON)) &&
   (get_cvar_num("admin_kickbot"))) // a bot comes and take his slot
         server_cmd("joebot addbot")       // Joebot command
         server_cmd("pb addbot")           // Podbot command
   }
   public plugin_init(){
      register_plugin("VoteBot","1.3","Parakeet")
      register_cvar("admin_kickbot", "0")
      register_event("SendAudio","round_start","bce","2=%!MRAD_GO","2=%!M
   RAD_MOVEOUT","2=%!MRAD_LETSGO","2=%!MRAD_LOCKNLOAD")
      register_concmd("amx_bot","amx_enablebot",ADMIN_IMMUNITY,"<1|0>   :
   turn bots off/on")
      register_clcmd("say vote_bot","vote_bots",0,"- start voting session
   for bots")
      register_menucmd(register_menuid("bots?"),(1<<0)|(1<<1),"vote_count
   ")
      return PLUGIN_CONTINUE
   }
