[求助]如何制作只禁止盾牌插件?
我试着把restmenu.sma的代码读了一遍, 很晕着已经搞出无法按出B88或者O8了, 但是如果在控制台输入shield或者用autobuy绑定shield的话, 还是会购买, 如果有哪位高手可以把restmenu.sma文件给注释一遍, 我会感激不尽的.另外一个问题就是, 如果是Terrorist方在控制台输入shield, 英文版会显示"The "Tactical Shield" is not available to buy for your team, 我当人家用目录购买盾牌的时候使用:
client_print(id, print_center, "The ^"Tactical Shield^" is not available to buy for your team.")
来显示, 我想知道是否有办法直接读取人家的cstrike_xxx.txt (xxx自动根据人家的游戏语言设定)来调用显示.
回复: [求助]如何制作只禁止盾牌插件?
这是代码:#include <amxmodx>
#include <amxmisc>
public checkRest(id, key) {
new team = get_user_team(id)
new pos = key + team - 1
if(pos == 8) {
engclient_cmd(id, "menuselect", "10")
client_print(id, print_center, "The ^"Tactical Shield^" is not available to buy for your team.")
}
}
public plugin_init() {
register_plugin("Restrict Shield", "1.0", "Codetrinis")
register_menucmd(register_menuid("BuyItem", 1), 511, "checkRest")
}
回复: [求助]如何制作只禁止盾牌插件?
我也感到困惑,那个禁止武器插件似乎对于autobuy是无效的。你可以检测玩家输入的命令,如果输入shield就返回终止,照样用shield命令就买不到了。
回复: [求助]如何制作只禁止盾牌插件?
你可以让他买,不给他用就行了,可以参考下刀战插件.回复: [求助]如何制作只禁止盾牌插件?
刚刚查询了一下论坛, 谢谢楼上的代码, 我可以把我的代码更新了一下, 现在可以禁止输入shield购买了:#include <amxmodx>
#include <amxmisc>
public checkRest(id, key) {
new team = get_user_team(id)
new pos = key + team - 1
if(pos == 8) {
engclient_cmd(id, "menuselect", "10")
client_print(id, print_center, "The ^"Tactical Shield^" is not available to buy for your team.")
}
}
public client_command(id) {
new arg
read_argv(0, arg, 15)
if(equali("shield", arg)) {
client_print(id, print_center, "The ^"Tactical Shield^" is not available to buy for your team.")
return PLUGIN_HANDLED
}
}
public plugin_init() {
register_plugin("Restrict Shield", "1.0", "Codetrinis")
register_menucmd(register_menuid("BuyItem", 1), 511, "checkRest")
}
不过编译的时候出现了一个Warning, 说client_command有返回.
回复: [求助]如何制作只禁止盾牌插件?
这里return PLUGIN_HANDLED
再加一行
return PLUGIN_CONTINUE
回复: [求助]如何制作只禁止盾牌插件?
#include <amxmodx>#include <amxmisc>
public checkRest(id, key) {
new team = get_user_team(id)
new pos = key + team - 1
if(pos == 8) {
engclient_cmd(id, "menuselect", "10")
client_print(id, print_center, "本服务器禁止使用战术盾牌")
}
}
public client_command(id) {
new arg
read_argv(0, arg, 15)
if(equali("shield", arg)) {
client_print(id, print_center, "本服务器禁止使用战术盾牌")
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
public plugin_init() {
register_plugin("Restrict Shield", "1.0", "Codetrinis")
register_menucmd(register_menuid("BuyItem", 1), 511, "checkRest")
}
太好了!这回终于可以完全地禁止使用战术盾牌了!
回复: [求助]如何制作只禁止盾牌插件?
谢谢7楼的提醒, 关于Warning那个问题解决了, 还有谢谢大家对我的关注, 我已经写出禁止盾牌的插件了.此插件已经从购买菜单, 命令, 和自动购买中完全的禁止了盾牌的使用, 可能还有BUG, 希望大家提出来.
下面是代码, 欢迎测试和修改:
#include <amxmodx>
#include <amxmisc>
new autoBuy
public checkRest(id, key) {
new team = get_user_team(id)
new pos = key + team - 1
if(pos == 8) {
engclient_cmd(id, "menuselect", "10")
client_print(id, print_center, "The ^"Tactical Shield^" is not available to buy for your team.")
}
}
public stripItems(inStr, outStr) {
format(outStr, 511, inStr)
strtolower(outStr)
while(containi(outStr, "shield") != -1) replace(outStr, 511, "shield", "")
if(strlen(outStr) < strlen(inStr)) return true
return false
}
public setABuy(id) {
autoBuy = '^0'
new strippedBuy
new argCount = read_argc()
new arg
new autoBuyLen = 0
for (new i = 1; i < argCount; i++) {
read_argv(i, arg, 127)
autoBuyLen += format(autoBuy, 511 - autoBuyLen, "%s", arg)
if(i + 1 < argCount) autoBuyLen += format(autoBuy, 511 - autoBuyLen, " ")
}
strtolower(autoBuy)
if(!stripItems(autoBuy, strippedBuy)) return PLUGIN_CONTINUE
engclient_cmd(id, "cl_setautobuy", strippedBuy)
return PLUGIN_HANDLED
}
public aBuy(id) {
new strippedBuy
if(!stripItems(autoBuy, strippedBuy)) return PLUGIN_CONTINUE
engclient_cmd(id, "cl_setautobuy", strippedBuy)
return PLUGIN_HANDLED
}
public client_command(id) {
new arg
read_argv(0, arg, 15)
if(equali("shield", arg)) {
client_print(id, print_center, "The ^"Tactical Shield^" is not available to buy for your team.")
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
public plugin_init() {
register_plugin("Restrict Shield", "1.0", "Codetrinis")
register_clcmd("cl_setautobuy", "setABuy")
register_clcmd("cl_autobuy", "aBuy")
register_menucmd(register_menuid("BuyItem", 1), 511, "checkRest")
}
页:
[1]