|
发表于 2003-12-10 17:22:53
|
显示全部楼层
|阅读模式
来自 中国–广东–深圳
这个问题一直想解决,以前听说 clanmod 可以,但一直没弄过.
最近把服务器加了amx,想amx既然这么强大,一定也能做吧
问了一天,没人帮我解答,只好自己动手.
在国外找了一个类似的插件
但很遗憾,这插件只支持以CDKEY来确认战队用户,不适合国人用..(虽然我不支持盗版,但这是现状,也没办法)
所以改编了一下,希望能对大家有用
源码:
/* AMX Mod script.
*
* (c) Copyright 2002, OLO
* This file is provided as is (no warranties).
* modify auth with pass by xianjian
* amx_protclantag.sma
*/
#include <amxmod>
#include <amxmisc>
/*
使用方法:
1.服务端
将编译好的 amx_protclantag.amx 保存到 \addons\amx\plugins 中
在 \addons\amx\plugins\plugins.ini 中加入新行:
amx_protclantag.amx
在 amx.cfg (0.9.3及以前版本为admin.cfg)中添加如下行:
格式: amx_protclantag 队标 密码
如
amx_protclantag "XJ.M" "ssssdd"
amx_protclantag "XJ.H" "fdfdfd"
amx_protclantag "XJ.C" "wwddwd"
2.客户端
战队的队员在自己的 config.cfg 中加入一行验证的密码,如
ID为 XJ.M | Lion 的用户加入:
setinfo "clanpass" "ssssdd"
ID为 XJ.C | langren 的用户加入:
setinfo "clanpass" "fdfdfd"
*/
/* Max. number of entries */
#define MAX_CLANTAGS 64
new clantaglist[MAX_CLANTAGS][32]
new authids[MAX_CLANTAGS][32]
new num_clantags
new bool:cancheck[33]
public add_clantag(id,level,cid){
if (!cmd_access(id,level,cid,3))
return PLUGIN_HANDLED
if (num_clantags >= MAX_CLANTAGS){
console_print(id,"Max. number of %d entries reached. Can't add more clan tags",MAX_CLANTAGS)
return PLUGIN_HANDLED
}
read_argv(1,clantaglist[num_clantags],31)
read_argv(2,authids[num_clantags],31)
console_print(id,"Protection for clan tag ^"%s^" set",clantaglist[ num_clantags++ ])
return PLUGIN_HANDLED
}
// check password with given clantag
cant_use_tag(id,clantag[]){
new password[32]
get_user_info(id,"clanpass",password,31)
for (new i=0; i<num_clantags; ++i){
if ( equal(clantag,clantaglist) && equal(password,authids) )
return false
}
return true
}
check_name(id,name[]) {
for (new i=0; i<num_clantags; ++i){
if (containi(name,clantaglist) != -1){
if (cant_use_tag(id,clantaglist)){
client_cmd(id,"echo ^"* Clan tag '%s' is protected on this server, you cannot use it!^";disconnect",clantaglist)
client_print(0,print_chat,"* %s kicked from server, clan tag '%s' is protected", name,clantaglist)
cancheck[id] = false
return PLUGIN_HANDLED
}
break
}
}
return PLUGIN_CONTINUE
}
/* catch clients connecting and check names & clan tags */
public client_connect(id){
cancheck[id] = true
new name[32]
get_user_name(id,name,31)
return check_name(id,name)
}
/* detect name change against protected list */
public client_infochanged(id){
if (cancheck[id]){ /* to exclude double checking when player is dead and name is switched back by CS */
new name[32]
get_user_info(id,"name",name,31)
return check_name(id,name)
}
return PLUGIN_CONTINUE
}
public plugin_init() {
register_cvar("Clan_Tag_Protec", "0.4",FCVAR_SERVER)
register_plugin("Clan Tag Protection","0.8.5","xianjian")
register_concmd("amx_protclantag","add_clantag",ADMIN_LEVEL_A,"<clan tag> <clanpass>")
return PLUGIN_CONTINUE
}
附件为编译版, |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注个册吧
×
|