
   /* AMX Mod script.
   *
   * Player Number based Mapcycle
   *  by Muldy@megauser.net
   *
   * cvar: amx_pnm player number
   * files:
   *       less_mapcycle.cfg - if number of players is less than amx_pnm
   *       plus_mapcycle.cfg  -  if  number  of  players  is greater than
   amx_pnm
   *       full_mapcycle.cfg - if the server is full
   *       empty_mapcycle.cfg - if the server is empty (0 or 1 players)
   *
   */
   #include <amxmod>
   public load_pmapcycle()
   {
      new number
      number = get_playersnum()
      new pnm
      pnm = get_cvar_num("amx_pnm")
      new maxplayers = get_maxplayers()
      new cmd[48]
      new id
      id=0;
      new mapcycle[48]
      console_print(id,"AMX_PNM - Current Players on server: %d",number)
      get_cvar_string("mapcyclefile",mapcycle,48);
      console_print(id,"AMX_PNM - Current Mapcycle: %s",mapcycle)
      if (number>pnm)
      {
              if(pnm==maxplayers)
              {
                      format(cmd,48,"mapcyclefile full_mapcycle.txt")
                      console_print(id,"AMX_PNM   -   Mapcycle  will  be:
   full_mapcycle.txt")
              }
              else
              {
                   format(cmd,48,"mapcyclefile plus_mapcycle.txt")
                   console_print(id,"AMX_PNM    -   Mapcycle   will   be:
   plus_mapcycle.txt")
              }
      }
      else if(number <=pnm)
      {
           if((number==0 ) || (number == 1))
           {
                   format(cmd,48,"mapcyclefile empty_mapcycle.txt")
                   console_print(id,"AMX_PNM    -   Mapcycle   will   be:
   empty_mapcycle.txt")
           }
           else
           {
              format(cmd,48,"mapcyclefile less_mapcycle.txt")
              console_print(id,"AMX_PNM     -     Mapcycle    will    be:
   less_mapcycle.txt")
           }
      }
      server_cmd(cmd)
      format(cmd,48,"amx_chat %s",cmd)
      server_cmd(cmd)
      return PLUGIN_HANDLED
   }
   public client_putinserver(id)
   {
      load_pmapcycle()
   }
   public client_disconnect(id)
   {
      load_pmapcycle()
   }
   public plugin_init()
   {
      register_plugin("Player Number Mapcycle","0.5","Muldy")
      load_pmapcycle()
      register_cvar("amx_pnm","5")
      return PLUGIN_CONTINUE
