搜索
查看: 1500|回复: 0

[help]帮我改下这刀点插件的BUG

[复制链接]
发表于 2008-2-12 21:15:09 | 显示全部楼层 |阅读模式 来自 中国–广东–深圳–宝安区
这插件开始二局为刀战,没问题,(我玩的是CS1.5)
BUG 1.但是当你SAY /VOTEKNIVES 时,你按1,别人不知道按了什么,反正X秒后,只有我是用刀,他可以用枪...
BUG 2.我用AMX_KNIVES 1的时候,所有人自动换了一下刀,但又可以换回枪~

[php]/* AMX Mod X script.
*
* Knife Arena
* == last edited by KinSprite ==
*
* amx_knives 1 - restricts weapons to knives
* 0 - enables all weapons
*
*/
#include <amxmodx>
#include <amxmisc>
new bool:KnifeEnabled = true
new option[2]
new round
public amx_enableknife(id,level,cid)
{
if (!cmd_access(id,level,cid,1))
return PLUGIN_HANDLED
new arg1[4]
read_argv(1,arg1,3)
if (equal(arg1,"1")||equali(arg1,"on"))
{
KnifeEnabled = true
}
else
{
if (equal(arg1,"0")||equali(arg1,"off"))
{
KnifeEnabled = false
}
else
{
console_print(id,"Knives Only Mode is %s",KnifeEnabled ? "enabled" : "disabled")
return PLUGIN_HANDLED
}
}
console_print(id,"Knives Only Mode %s",KnifeEnabled ? "enabled" : "disabled")
client_print(0,print_center,"Knives Only Mode Has Been %s!",KnifeEnabled ? "Enabled" : "Disabled")
engclient_cmd(0,"weapon_knife")
set_hudmessage(0, 100, 0, 0.05, 0.65, 2, 0.02, 10.0, 0.01, 0.1, 2)
show_hudmessage(0,KnifeEnabled ? "Knives Only Allowed" : "All Guns Allowed" )
return PLUGIN_HANDLED
}
public switchweapon(id)
{
if (round<1 || !KnifeEnabled)
return PLUGIN_CONTINUE
new wpn = read_data(2)
if (wpn == CSW_C4)
return PLUGIN_CONTINUE
if (round < get_cvar_num("amx_kniferound") && (wpn == CSW_HEGRENADE || wpn == CSW_SMOKEGRENADE || wpn == CSW_FLASHBANG))
return PLUGIN_CONTINUE
engclient_cmd(id,"weapon_knife")
return PLUGIN_CONTINUE
}
new votepistols[] = "\yAMX %s Knives Only Mode?\w^n^n1. Yes^n2. No"
public vote_knives(id)
{
new Float:voting = get_cvar_float("amx_last_voting")
if (voting > get_gametime())
{
client_print(id,print_chat,"* There is already one voting...")
return PLUGIN_HANDLED
}
if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime())
{
client_print(id,print_chat,"* Voting not allowed at this time...")
return PLUGIN_HANDLED
}
new menu_msg[256]
format(menu_msg,255,votepistols,KnifeEnabled ? "Disable" : "Enable")
new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0
set_cvar_float("amx_last_voting", get_gametime() + vote_time )
show_menu(0,(1<<0)|(1<<1),menu_msg,floatround(vote_time))
set_task(vote_time,"check_votes")
client_print(0,print_chat,"* Voting has started...")
option[0]=option[1]=0
return PLUGIN_HANDLED
}
public vote_count(id,key)
{
if ( get_cvar_float("amx_vote_answers") )
{
new name[32]
get_user_name(id,name,31)
client_print(0,print_chat,"* %s voted %s", name, key ? "against" : "for" )
}
++option[key]
return PLUGIN_HANDLED
}
public check_votes(id)
{
if (option[0] > option[1])
{
server_cmd( "amx_knives %s", KnifeEnabled ? "off" : "on" )
client_print(0,print_chat,"* Voting successful (yes ^"%d^") (no ^"%d^").",option[0],option[1])
}
else
{
client_print(0,print_chat,"* Voting failed (yes ^"%d^") (no ^"%d^").",option[0],option[1])
}
return PLUGIN_CONTINUE
}
public end_round()
{
if (round >0)
round --
else
round = 0
return PLUGIN_CONTINUE
}
public reset_round()
{
round = get_cvar_num("amx_kniferound")
return PLUGIN_CONTINUE
}
public reset_player(id)
{
if (round>0 && KnifeEnabled)
{
new sz[90]
new len = format(sz,89," 还有%i局为刀战模式。",round)
if (round < get_cvar_num("amx_kniferound"))
format(sz[len],89-len,"^n 但是本局您可以使用手雷.")
set_hudmessage(200,0,0,-1.0,0.35,1,6.0,12.0,0.3,0.3,5)
show_hudmessage(id,sz)
}
}
public plugin_init()
{
register_plugin("Knife Arena","1.0","tcquest78 & KinSprite")
register_cvar("amx_kniferound","2")
register_event("CurWeapon","switchweapon","be","1=1","2!29")
register_concmd("amx_knives","amx_enableknife",ADMIN_LEVEL_B,"<1|0> - knives only mode")
register_clcmd("say /voteknives","vote_knives",0,"- start voting session for knives only mode")
register_menucmd(register_menuid("Knives Only Mode?"),(1<<0)|(1<<1),"vote_count")
register_event("SendAudio", "end_round", "a", "2=%!MRAD_terwin", "2=%!MRAD_ctwin", "2=%!MRAD_rounddraw")
register_event("TextMsg", "reset_round", "a", "2&#Game_C", "2&#Game_w")
register_event("ResetHUD","reset_player","b")
round = get_cvar_num("amx_kniferound")
return PLUGIN_CONTINUE
}
[/php]
游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

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