|
发表于 2007-12-12 14:44:18
|
显示全部楼层
来自 中国–广东–惠州
回复: 求禁外网指定ID
谢谢版主指点,今天看看了下,发现个很严重的问题,少了个客户端信息改变的判断,又重新增加了客户端信息变更检测
[php]
#include <amxmodx>
#include <amxmisc>
#define PLUGIN_NAME "New Plug-In"
#define PLUGIN_VERSION "1.0"
#define PLUGIN_AUTHOR "zwfgdlc"
new player[512]
new configsDir[64]
new netbarip[16]
public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
get_configsdir(configsDir, 63)
format(configsDir, 63, "%s/player.ini", configsDir)
loadSettings(configsDir)
register_cvar("amx_netbarip","192.168")
get_cvar_string("amx_netbarip",netbarip,15)
}
loadSettings(szFilename[])
{
if (!file_exists(szFilename))
return 0
new len, pos = 0,temp[32]
while (read_file(szFilename,pos++,temp,31,len) )
{
if(temp[0==';']||len==0)
continue
format(player,511,"%s %s",player,temp)
}
return 1
}
public client_connect(id)
{
new name[32],ip[16]
get_user_name(id,name,31)
get_user_ip(id,ip,1)
if(containi(ip,netbarip)!=0 && containi(player,name)!=-1)
{
server_cmd("kick #%d ^"%s^"",get_user_userid(id),"对不起,此ID禁止在外网登陆")
}
}
public client_infochanged(id)
{
new oldname[32],newname[32],ip[16]
get_user_name(id,oldname,31)
get_user_info(id,"name",newname,31)
get_user_ip(id,ip,15)
if(!equal(oldname,newname))
{
if(containi(ip,netbarip)!=0 && containi(player,newname)!=-1)
server_cmd("kick #%d ^"%s^"",get_user_userid(id),"对不起,此ID禁止在外网登陆")
}
}
[/php] |
|