|
发表于 2005-11-9 22:07:22
|
显示全部楼层
来自 中国–四川–凉山彝族自治州–西昌市
回复: 【原创】内网玩家登录自动踢外网Ping高者插件(AMX and AMXX Ⅱ版)
这个功能的插件在amxmod.net里面n年前就有了我都用了差不多2年了,大家何必花钱???
大家找插件为什么不先去amxmod.net,和amxx的老家?
其中amxmod.net中最多,而且大多都能使用!!
这个插件在amxmod中叫slots_reservation_by_ip, 这是源码,大家初略看看就晓得咋个用了!
/* 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)
*
* Usage
* Create file cstrike/addons/amx/ips.ini
*这个路径可以在源码中改成了addons/amx/config/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
* 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.5/1.6amx amxx通用!!! |
|