【求助】我这段代码哪里出错了!
不知道哪里出错了,菜单可以打开,但是按相应按键后没效果/*本插件由ReD战队 夜琴制作
BY:[ ReD ] > YeqinG < */
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <engine>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>
new bool:sbs=false
new bool:yezb=false
new bool:sj=false
new bool:dz=false
public plugin_init()
{
register_concmd( "say /shop","ShowMenu", -1, "xscd" )
register_menucmd(register_menuid("\ySilent战队 商店菜单:"), 1023, "MenuCommand" )
/*register_event("CurWeapon","daozi","b")*/
RegisterHam(Ham_TakeDamage ,"player","falldamage")
RegisterHam(Ham_Spawn,"player","ye",1)
register_forward(FM_PlayerPreThink,"shijiao")
return PLUGIN_CONTINUE
}
public daozi(id)
{
if(is_user_alive(id)&&dz==true&&get_user_weapon(id)==CSW_KNIFE)
{
set_pev(id,pev_viewmodel2,"models/Yq_d.mdl")
}
else if(is_user_alive(id)&&dz==false&&get_user_weapon(id)==CSW_KNIFE)
{
set_pev(id,pev_viewmodel2,"models/v_knife.mdl")
}
}
public shijiao(id)
{
if(is_user_alive(id)&&sj==true)
{
set_pev(id,pev_fov,180.0)
set_pev(id,pev_view_ofs,{0.0,0.0,0.01})
}
}
public plugin_precache()
{
precache_model("models/player/gsg9/gsg9.mdl")
precache_model("models/player/arctic/arctic.mdl")
precache_model("models/player/Yq_ct/Yq_ct.mdl")
precache_model("models/player/Yq/Yq.mdl")
precache_model("models/player/Yq_t/Yq_t.mdl")
precache_model("models/v_knife.mdl")
precache_model("models/Yq_d.mdl")
return PLUGIN_CONTINUE
}
public ye(id)
{
dz=false
yezb=false
set_pev(id,pev_fov,90.0)
set_pev(id,pev_view_ofs,{0.0,0.0,20.0})
sj=false
if(cs_get_user_team(id)==CS_TEAM_CT&&get_user_flags(id) & ADMIN_LEVEL_A)
{
cs_set_user_model(id,"Yq_ct")
}
else if(cs_get_user_team(id)==CS_TEAM_T&&get_user_flags(id) & ADMIN_LEVEL_A)
{
cs_set_user_model(id,"Yq_t")
}
else if(cs_get_user_team(id)==CS_TEAM_CT)
{
cs_set_user_model(id,"gsg9")
}
else if(cs_get_user_team(id)==CS_TEAM_T)
{
cs_set_user_model(id,"arctic")
}
}
public ShowMenu( id )
{
new caidan
new keys
new YQ = format( caidan, 511, "\rSilent战队 商店菜单:^n" )
YQ += format( caidan, 511-YQ, "^n\w1. \y信春哥,得永生($16000复活)" )
YQ += format( caidan, 511-YQ, "^n\w2. \y信春哥,摔不死($10000五秒摔不死)" )
YQ += format( caidan, 511-YQ, "^n\w3. \y信春哥,能逃生!($5000能隐身耶)" )
YQ += format( caidan, 511-YQ, "^n\w4. \y信曾哥,能加血!($6000瞬间加100血量)" )
YQ += format( caidan, 511-YQ, "^n\w5. \y信夜琴,射CT($10000琴哥给你AWP)" )
YQ += format( caidan, 511-YQ, "^n\w6. \y信夜琴,能装逼($0免费带你飞)" )
YQ += format( caidan, 511-YQ, "^n\w7. \y信夜琴,能换衣($10000给你一件敌对的衣服)." )
YQ += format( caidan, 511-YQ, "^n\w8. \y变身迷你狗!($8000让你变成非常小的狗)")
YQ += format( caidan, 511-YQ, "^n\w9. \y尼泊尔大屌刀($500给你宝刀)" )
YQ += format( caidan, 511-YQ, "^n^n\w0. 退出菜单" )
keys = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<8|1<<9)
show_menu( id, keys, caidan, -1 )
return PLUGIN_CONTINUE
}
public fuhuo(id)
{
new a=16000
new b=cs_get_user_money(id)
new name
get_user_name(id,name,31)
if(b>=a&&!is_user_alive(id))
{
cs_set_user_money (id,b-a,1)
client_print(0,print_chat,"玩家%s使用了复活道具",name)
ExecuteHamB(Ham_CS_RoundRespawn,id)
}
else if (b<a)
{
client_print(id,print_chat,"金钱不足%d",a)
}
else if (is_user_alive(id))
{
client_print(id,print_chat,"那么想复活,你先死了好了!")
}
}
public shuaibusi(id)
{
new a=10000
new b=cs_get_user_money(id)
new name
get_user_name(id,name,31)
if(b>=a&&is_user_alive(id))
{
cs_set_user_money (id,b-a,1)
client_print(0,print_chat,"玩家%s说信春哥,摔不死!",name)
sbs=true
set_task(5.0,"fall",id)
}
else if(b<a)
{
client_print(id,print_chat,"金钱不足")
}
else if(!is_user_alive(id))
{
client_print(id,print_chat,"首先你必须是活的!")
}
}
public fall(id)
{
sbs=false
client_print(id,print_chat,"真男人时间结束,不要再跳楼了")
}
public falldamage(id,victim, inf, attacker, Float:damage, damage_type)
{
if(sbs==false&&damage_type != DMG_FALL)return HAM_IGNORED
return HAM_SUPERCEDE
}
public jiaxue(id)
{
new a=6000
new b=cs_get_user_money(id)
new name
get_user_name(id,name,31)
if(b>=a&&is_user_alive(id))
{
cs_set_user_money (id,b-a,1)
client_print(0,print_chat,"玩家%s说信曾哥,给我血!结果顺利获得100HP!",name)
new x=get_user_health(id)
set_user_health (id,x+100)
}
else if(b<a)
{
client_print(id,print_chat,"金钱不足")
}
else if(!is_user_alive(id))
{
client_print(id,print_chat,"首先你必须是活的!")
}
}
public yinshen(id)
{
new a=5000
if(cs_get_user_money(id)>=a&&is_user_alive(id))
{
new name
get_user_name(id,name,31)
new b=cs_get_user_money(id)
b=b-5000
cs_set_user_money (id,b,1)
set_pev(id,pev_effects,EF_NODRAW)
client_print(id,print_chat,"购买成功,隐身5秒!")
set_task(5.0,"YSJS",id)
client_print(0,print_chat,"玩家 %s 使用了逃生道具!",name)
}
else if(cs_get_user_money(id)<=a)
{
client_print(id,print_chat,"金钱不足!")
}
else if(!is_user_alive(id))
{
client_print(id,print_chat,"死亡状态无法购买")
}
return PLUGIN_HANDLED
}
public YSJS(id)
{
set_pev(id,pev_effects,0)
client_print(id,print_chat,"隐身时间结束")
}
public AWP(id)
{
new a=10000
new b=cs_get_user_money(id)
new name
get_user_name(id,name,31)
if(b>=a&&is_user_alive(id)&&cs_get_user_team(id)==CS_TEAM_T)
{
cs_set_user_money (id,b-a,1)
client_print(0,print_chat,"玩家%s信仰夜琴,夜琴高兴给了他一把AWP!",name)
cs_set_weapon_ammo(give_item(id,"weapon_awp"),2)
cs_set_user_bpammo(id,CSW_AWP,0)
}
else if(cs_get_user_team(id)==CS_TEAM_CT)
{
client_print(id,print_chat,"渣渣CT想打T的小JJ?")
}
else if(b<a)
{
client_print(id,print_chat,"金钱不足")
}
else if(!is_user_alive(id))
{
client_print(id,print_chat,"首先你必须是活的!")
}
} public zhuangbi(id) {
if (yezb == false && is_user_alive(id)) {
yezb = true strip_user_weapons(id) set_task(0.2, "zhuangbi2", id)
} else if (yezb == true) {
client_print(id, print_chat, "一局只能带你飞一次!")
} else if (!is_user_alive(id)) {
client_print(id, print_chat, "首先你必须是活的!")
}
}
public zhuangbi2(id) {
new name get_user_name(id, name, 31) give_item(id, "weapon_knife") client_print(0, print_chat, "玩家%s大喊夜琴我爱你!夜琴心花路放,给了他装逼神器!", name) cs_set_weapon_ammo(give_item(id, "weapon_deagle"), 0) cs_set_user_bpammo(id, CSW_DEAGLE, 0)
}
public weizhuang(id) {
new a = 10000
if (cs_get_user_money(id) >= a && is_user_alive(id)) {
new name get_user_name(id, name, 31) new b = cs_get_user_money(id) b = b - 10000 cs_set_user_money(id, b, 1) set_task(0.1, "weizhuang2", id) client_print(0, print_chat, " %s 淫笑中...!", name)
} else if (cs_get_user_money(id) <= a) {
client_print(id, print_chat, "金钱不足!")
} else if (!is_user_alive(id)) {
client_print(id, print_chat, "死亡状态无法购买")
}
}
public weizhuang2(id) {
if (cs_get_user_team(id) == CS_TEAM_CT) {
cs_set_user_model(id, "arctic")
} else if (cs_get_user_team(id) == CS_TEAM_T) {
cs_set_user_model(id, "gsg9")
}
}
public xiaogou(id) {
new a = 80
if (cs_get_user_money(id) >= a && is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_T) {
new name get_user_name(id, name, 31) new b = cs_get_user_money(id) b = b - 80 cs_set_user_money(id, b, 1) cs_set_user_model(id, "Yq") sj = true client_print(0, print_chat, " %s 汪汪汪汪汪汪!", name)
} else if (cs_get_user_money(id) <= a) {
client_print(id, print_chat, "金钱不足!")
} else if (cs_get_user_team(id) == CS_TEAM_CT) {
client_print(id, print_chat, "CT不可以汪汪汪哦")
} else if (!is_user_alive(id)) {
client_print(id, print_chat, "死亡状态无法购买")
}
}
public maidaozi(id) {
new a = 500 new b = cs_get_user_money(id) new name get_user_name(id, name, 31) if (b >= a && is_user_alive(id)) {
cs_set_user_money(id, b - a, 1) client_print(0, print_chat, "玩家%s购买了大屌!", name) dz = true
} else if (b < a) {
client_print(id, print_chat, "金钱不足")
} else if (!is_user_alive(id)) {
client_print(id, print_chat, "首先你必须是活的!")
}
}
public MenuCommand(id, key) {
switch (key) {
case 0:
set_task(0.1, "fuhuo", id)
case 1:
set_task(0.1, "shuaibusi", id)
case 2:
set_task(0.1, "yinshen", id)
case 3:
set_task(0.1, "jiaxue", id)
case 4:
set_task(0.1, "AWP", id)
case 5:
set_task(0.1, "zhuangbi", id)
case 6:
set_task(0.1, "weizhuang", id)
case 7:
set_task(0.1, "xiaogou", id)
case 8:
set_task(0.1, "maidaozi", id)
case 9:
engclient_cmd(id, "退出菜单")
}
return PLUGIN_HANDLED
} 好贴!顶!点赞!
不回复就没有金钱,
没金钱就不能下载,
不下载楼主白发帖。 应该是这行没跟register_menucmd(register_menuid("\ySilent战队 商店菜单:"), 1023, "MenuCommand" )
这行对应new YQ = format( caidan, 511, "\rSilent战队 商店菜单:^n" ),这两个必须对应,不然不可以按.ok? 改改呀!!!!!!!!!!!
页:
[1]