香港雞棚 发表于 2009-5-7 16:20:05

自動導向問題.....問一問!

伺服器滿人自動導向
下面是原碼.......修改后要不要在cfg內建立指令!

/* AMXX Mod Script
*
* Simple Redirection Plugin for AMXX
* Orginal Code by Sonic (sonic@codet.de)
* Modified and Made for AMXX by BigBaller
*
*Place following cvars in server.cfg
*
*amx_rd_maxplayers <x>             // - begin redirection when more the x ppl connected ( 0 = redirect all players )
*amx_rd_server <ip>                // - redirect to this server
*amx_rd_serverport <port>          // - redirect server port
*amx_rd_serverpw <password>      // - password for the amx_rd_server (if needed)
*
*
*To Disable this plugin set amx_rd_maxppl to 33 or remove from plugins.ini
*/

#include <amxmodx>

public plugin_init() {
        register_plugin("Simple Redirect","1.0","BigBaller")
        register_cvar("amx_rd_maxplayers","0")

        register_cvar("amx_rd_server","")
        register_cvar("amx_rd_serverport","")
        register_cvar("amx_rd_serverpw","")
}

public client_connect(id){
        new rd_maxplayers = get_cvar_num("amx_rd_maxplayers")
        new rd_serverport = get_cvar_num("amx_rd_serverport")
        new rd_server, rd_serverpw
        get_cvar_string("amx_rd_server",rd_server,63)
        get_cvar_string("amx_rd_serverpw",rd_serverpw,31)
        if ( get_playersnum() >= rd_maxplayers) {
                if ( !equal(rd_serverpw,"") )
                        client_cmd(id,"echo ^" Simple Redirection - Set Password to %s^";password %s",rd_serverpw,rd_serverpw)
                client_cmd(id,"echo ^" Simple Redirection -Redirecting to %s:%d^";connect %s:%d",rd_server,rd_serverport,rd_server,rd_serverport)
        }
        return PLUGIN_CONTINUE
}


是否要將以下的設定放在 server.cfg 裡


amx_rd_maxplayers <x> // - 當人數超過此值設定的人數將自動轉向至 B 伺服器(設0 = 轉向所有的玩家,設33則關閉自動導向)
amx_rd_server <ip> // - 要導向至 B 伺服器的 IP 位址
amx_rd_serverport <port> // - 導向至 B 伺服器的 port
amx_rd_serverpw <password> // - 如果 B 伺服器有設密碼則把密碼設定於此,於轉向時自動加上

ex:
amx_rd_maxplayers 32
amx_rd_server 202.18.191.188
amx_rd_serverport 27015
amx_rd_serverpw ""

xuwenqi 发表于 2009-5-7 18:57:45

需要啊,你本身插件没值

香港雞棚 发表于 2009-5-7 19:06:23

2# xuwenqi


是否這樣......

public plugin_init() {
      register_plugin("Simple Redirect","1.0","BigBaller")
      register_cvar("amx_rd_maxplayers","32")

      register_cvar("amx_rd_server","202.18.191.188")
      register_cvar("amx_rd_serverport","27016")
      register_cvar("amx_rd_serverpw","")
}

server CFG內新增以下.....

amx_rd_maxplayers 32
amx_rd_server 202.18.191.188
amx_rd_serverport 27016
amx_rd_serverpw ""

以上設置沒有生效......為甚麼?

jiunnwoei2629 发表于 2009-5-7 21:08:43

設置在amxx.cfg裡面就可以了

y543685085 发表于 2009-5-8 07:57:26

代码里和AMXX.CFG里都可以写,随便你自己的.
页: [1]
查看完整版本: 自動導向問題.....問一問!