搜索
查看: 4012|回复: 11

发布保护队标的插件

[复制链接]
发表于 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
}

附件为编译版,

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注个册吧

×
发表于 2003-12-10 18:12:11 | 显示全部楼层 来自 中国–贵州–黔东南苗族侗族自治州–凯里市
amx可以设置队标保护,这个东西完全是多余的!:yeah:
回复

使用道具 举报

 楼主| 发表于 2003-12-10 20:03:53 | 显示全部楼层 来自 中国–广东–深圳–宝安区
看到了你的方法,我试试.
回复

使用道具 举报

 楼主| 发表于 2003-12-10 20:18:37 | 显示全部楼层 来自 中国–广东–深圳–宝安区
嗯,本来在看 user.ini 的时候就在想这个 clan tag 估计是用来保护队标的
但不知道具体如何设置
现在知道了.刚才看了一下
用 user.ini 的话,必须要把 amx_password_field 告诉战队每一个队员
回复

使用道具 举报

发表于 2003-12-10 23:16:36 | 显示全部楼层 来自 中国–贵州–黔东南苗族侗族自治州–凯里市
这个是肯定的啊,amx_password_field公布也没什么关系嘛,反正可以让每个队员的密码都不同。
回复

使用道具 举报

发表于 2003-12-11 16:54:42 | 显示全部楼层 来自 中国–四川–南充
学到了东西,偷笑。。。。
回复

使用道具 举报

发表于 2003-12-13 17:09:43 | 显示全部楼层 来自 中国–福建–厦门
对需要cdkey验证的服务器来说authid就相当于一个玩家的密码,用设置密码来代替authid,思路不错!
回复

使用道具 举报

发表于 2003-12-13 21:18:54 | 显示全部楼层 来自 中国–湖南–娄底
不懂
回复

使用道具 举报

发表于 2003-12-13 23:14:19 | 显示全部楼层 来自 中国–黑龙江–黑河
保护队标
是什么意思?
可不可以给个例子?
回复

使用道具 举报

发表于 2009-6-5 10:01:32 | 显示全部楼层 来自 中国–广东–深圳–罗湖区
可不可以给个例子?
回复

使用道具 举报

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

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