搜索
查看: 1540|回复: 2

老问题,内网进自动踢外网玩家如何成为现实

[复制链接]
发表于 2004-12-3 15:09:10 | 显示全部楼层 |阅读模式 来自 中国–湖北–襄阳
我按以前的帖子下了插件也按要求安装了可就是无法实现请各位大侠能帮我以下如何操作。
我的外网ip 219.138.45.190:27016
我的内网ip 192.168.0.1:27016
我如何设置ins文件。谢谢各位 :10:
发表于 2004-12-7 22:39:50 | 显示全部楼层 来自 中国–广东–佛山–南海区
哈哈,我也想知道啊?
回复

使用道具 举报

发表于 2004-12-28 17:37:32 | 显示全部楼层 来自 中国–四川–凉山彝族自治州–西昌市
其实AMX的主页上就有这个插件,我下载SMA文件就是下面代码内容,在AMX0.99下编译(linux 下用的AMX0.99的SC编译成amx 文件),在1.6,1.5下都可正常使用,不是什么问题啊?
但AMXX下没成功,原因也没找,我感觉AMX0.99不错!就没再用AMXX!
按照说明,再IPS文件中加入你内网的IP段和掩码就可以!!

http://amxmod.net/plugins.php?ke ... p;cat=search#p29826

这是源代码

/* AMX Mod script.
*
* Slots reservation by IP (reserveslotsip.sma)这是 源代码文件名
*
* (c) Copyright 2002, SYZo
* This file is provided as is (no warranties).
-
* Slots reservation by IP (reserveslotsip.amx) working only with Slots reservation (adminslots.amx)
*这个插件和adminslots.amx插件一起运行,且最好放到它的前面,且配置好OP通道参数!
*
* Usage
* Create file cstrike/addons/amx/ips.ini
*在addons/amx/目录下创建一个ips.ini 文件,然后在文件中就象下面一样添加你想保留优先进入的网段,不需要外网地址.

* ips.ini file format:
* xxx.xxx.xxx.xxx/yyy.yyy.yyy.yyy
* where xxx.xxx.xxx.xxx - The address of the network
*       yyy.yyy.yyy.yyy - Mask of a subnet
* For example:
* 192.168.224.0/255.255.224.0
* 192.168.176.0/255.255.240.0
* 192.168.76.97/255.255.255.255
** WARNING:
* Correct plugin.ini
* insert "reserveslotsip.amx" before adminslots.amx
*插件配置文件中reserveslotsip.amx放到 adminslots.amx 它的前面象下面一样,且配置好OP通道参数.
* For example:
* welcome.amx
* admin.amx
* adminslay2.amx
* reserveslotsip.amx
* adminslots.amx
* adminvote.amx
* amx_atac.amx
*
*/

#include <amxmod>
#include <string>

ip_to_number(userip[16])
{
    new ipb1[12]
    new ipb2[12]
    new ipb3[12]
    new ipb4[12]
    new ip
    new nipb1
    new nipb2
    new nipb3
    new nipb4
    new uip[16]
    copy(uip, 16, userip)
    while(replace(uip, 16, ".", " ")){}
    parse(uip, ipb1, 12, ipb2, 12, ipb3, 12, ipb4, 12)
    nipb1 = strtonum(ipb1)
    nipb2 = strtonum(ipb2)
    nipb3 = strtonum(ipb3)
    nipb4 = strtonum(ipb4)
    ip = ((((nipb1 * 256) + nipb2) * 256) + nipb3) + ((((((nipb1 * 256) + nipb2) * 256) + nipb3) * 255) + nipb4)     
    return ip
}

net_hi_num(addr, mask)
{
    return addr+4294967296-mask
}

net_belongs(ipaddr, ipmask, ipaddrin, ipmaskin)
{
    if (ipaddr >= ipaddrin && net_hi_num(ipaddr, ipmask) <= net_hi_num(ipaddrin, ipmaskin))  {
    return 1
    }
    return 0
}

public client_connect(id){
    if (file_exists("addons\amx\ips.ini")) {
    new readdata[50]
    new sipaddr[16]
    new sipmask[16]
    new len
    new userip[16]
    get_user_ip(id,userip,16,1)
    for(new i=0; i < 100 && read_file("addons\amx\ips.ini",i,readdata,50,len) != 0; i += 1) {
        read_file("addons\amx\ips.ini",i,readdata,50,len)
        replace(readdata, 50, "/", " ")
        parse(readdata, sipaddr, 16, sipmask, 16)
        if (net_belongs(ip_to_number(userip), ip_to_number("255.255.255.255"), ip_to_number(sipaddr), ip_to_number(sipmask)) == 1) {
        set_user_flags(id,read_flags("b"))
        }
    }
    }
    return PLUGIN_CONTINUE
}

public plugin_init() {
    register_plugin("Slots reservation by IP","0.1","SYZo")
    return PLUGIN_CONTINUE
}

如果安装正常,你的服务器人数应该调整为比设计的服务器人数多1个人,这就是保留的通道.该通道可以让符合你的user.ini文件设定的OP通道规则和IP保留规则的人进入!这样人满的时候看起来服务器始终会不满,比如18/19,服务器人数为19但始终只会有18个玩家,这样就对了!

其实很简单,反正俺菜鸟也没花几小时就搞定了!希望对你有帮助!
回复

使用道具 举报

游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

快速回复 返回顶部 返回列表