搜索
查看: 3902|回复: 11

【求助】client_exec不支持USERID?

[复制链接]
发表于 2005-8-28 13:12:10 | 显示全部楼层 |阅读模式 来自 中国–重庆–重庆–南岸区
最新虐待作弊者的想法越来越丰富,所以想到一个超级恶毒的方法,利用client_exec插件在客户端执行破坏性命令!

不过试了一下,client_exec插件的命令并不支持带空格的名字,所以我想到用USERID,我输入RCON USERS命令后,前面的数字应该是USERID了,我用命令"amx_xclient #userid 命令"可没有作用,所以我怀疑是client_exec插件不支持USERID或代码错误!

  1. /*
  2. *
  3. * COMMANDS:
  4. * - amx_xclient //run console command on client
  5. *
  6. * *For name for example if the name is DynAstY you can type in console "amx_xclient Dy" and it will do the trick as long as there are not two names starting with Dy.
  7. *
  8. */


  9. #include <amxmodx>
  10. #include <amxmisc>

  11. public plugin_init() {
  12.         register_plugin("ExecClient", "0.3", "DynAstY")
  13.         register_concmd("amx_xclient", "run_xclient", ADMIN_KICK, "<authid, nick or #userid>")
  14.         return PLUGIN_CONTINUE
  15. }

  16. public run_xclient(id, level, cid) {
  17.         if (!cmd_access(id, level, cid, 1)) return PLUGIN_HANDLED

  18.         new name[32]
  19.         new cmd[128]
  20.         read_argv(1, name, 32)
  21.         read_args(cmd, 128)
  22.        
  23.         new i=0;
  24.         while(cmd[i]==' ') i++
  25.         i+=strlen(name)
  26.         while(cmd[i]==' ') i++
  27.         if (cmd[i]=='"') i++;
  28.         if (cmd[strlen(cmd)-1]=='"') cmd[strlen(cmd)-1]=' ';

  29.         if (equal(name,"*")) {
  30.                 client_cmd(0,"%s",cmd[i])
  31.                 client_print(id,print_console,"Executed command on all: %s", cmd[i])
  32.                 return PLUGIN_HANDLED
  33.         }

  34.         new player=find_player("b",name)
  35.         if (player) {
  36.                 new playername[32]
  37.                 get_user_name(player,playername,31);
  38.                 client_cmd(player, "%s", cmd[i]);
  39.                 client_print(id,print_console,"Executing command on %s: %s", playername, cmd[i])
  40.                 return PLUGIN_HANDLED
  41.         }
  42.         return PLUGIN_HANDLED
  43. }
复制代码
发表于 2005-8-28 17:01:45 | 显示全部楼层 来自 中国–四川–成都
cmd_access

官方函数的说明:
The last parameter (num) is the number of arguments.
Note that the first parameter is the command name so if you expect one param set it to 2.

This will automatically print out messages such as "You have no access to that command" and "Usage: <soandso".

还有这个,client_cmd(0,"%s",cmd)
按照我的理解,你是想存放命令进去吧,
但是cmd只能表示一个字符(你定义的是1维数组),不是字符串。
应该是client_cmd(0,"%s",cmd)
或者定义为2维的。

还有,你想执行什么破坏性命令。
就找几个典型的,(format,编号,然后用switch来判断输入,执行。)这样更好些。
回复

使用道具 举报

发表于 2005-8-28 17:34:26 | 显示全部楼层 来自 中国–北京–北京
这个应该很早就开始做了 我的代码是控制对方为作弊鸡 呵呵 视野30 生命1 重力调整大点

当然现在还有问题 就是即使我把重力调整到1000 但小鸡还是活蹦乱跳的!~ :sweat:
回复

使用道具 举报

 楼主| 发表于 2005-8-28 19:20:13 | 显示全部楼层 来自 中国–重庆–重庆–南岸区
我怎么说咧。。。

比如有个叫PLAYER的,然后我在控制台输入amx_xclient player say wo shi baichi,然后player就会执行命令say wo shi baichi,OP的控制台会反会提示,其中有一段是说“commotd on player : say wo shi baichi”,名字后面的所有东西都是命令,不管有多少空格!

如果有人叫xiao xiao,我如果输入amx_xclient xiao xiao say wo shi baichi,然后没什么用,OP控制台就会返回“commotd on xiao xiao : xiao say wo shi baichi”,就是说那人名字第一个空格后面的东西都会被看做命令!

我又想把名字用引号引起,不过没作用,OP控制台没返回任何消息!

我如果用USERID的话,也是没任何作用,OP控制台也不返回任何东西!

应该是代码错误吧!
回复

使用道具 举报

发表于 2005-8-29 20:47:41 | 显示全部楼层 来自 中国–四川–成都

回复: 【求助】client_exec不支持USERID?

你的源代码里面cmd_access用法有问题。

还有,本身consol里就判断不了名字的空格,比如想kick aa bb,会返回无此人的消息。

最好还是用userid,再用cmd_target来导出userid。
回复

使用道具 举报

 楼主| 发表于 2005-8-30 10:53:32 | 显示全部楼层 来自 中国–重庆–重庆

回复: 【求助】client_exec不支持USERID?

有什么解决方法吗??
回复

使用道具 举报

发表于 2005-8-30 11:30:52 | 显示全部楼层 来自 中国–陕西–西安

回复: 【求助】client_exec不支持USERID?


new player=find_player("b",name)
改为
new player=find_player("bc",name)
试试看
回复

使用道具 举报

发表于 2005-8-30 12:24:43 | 显示全部楼层 来自 中国–四川–成都

回复: 【求助】client_exec不支持USERID?

Post by Enigmaya
。。。再用cmd_target来导出userid。


方法就是这个。



对了,nwb13,哪里去找函数的详细参数解释阿??
回复

使用道具 举报

发表于 2005-8-30 12:37:30 | 显示全部楼层 来自 中国–陕西–西安

回复: 【求助】client_exec不支持USERID?

主要是include目录里的inc文件,其次就是自己的积攒了
回复

使用道具 举报

 楼主| 发表于 2005-8-30 18:48:06 | 显示全部楼层 来自 中国–重庆–重庆

回复: 【求助】client_exec不支持USERID?

用cmd_target来导出userid是什么意思?
回复

使用道具 举报

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

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