搜索
查看: 2721|回复: 5

【求助】我这段代码哪里出错了!

[复制链接]
发表于 2015-8-20 17:04:09 | 显示全部楼层 |阅读模式 来自 广东东莞
不知道哪里出错了,菜单可以打开,但是按相应按键后没效果
  1. /*本插件由ReD战队 夜琴制作
  2. BY:[ ReD ] > YeqinG < [Amxx]*/
  3. #include <amxmodx>
  4. #include <amxmisc>
  5. #include <fun>
  6. #include <engine>
  7. #include <cstrike>
  8. #include <fakemeta>
  9. #include <hamsandwich>
  10. new bool:sbs[33]=false
  11. new bool:yezb[33]=false
  12. new bool:sj[33]=false
  13. new bool:dz[33]=false
  14. public plugin_init()
  15. {
  16.    register_concmd( "say /shop","ShowMenu", -1, "xscd" )
  17.    register_menucmd(register_menuid("\ySilent战队 商店菜单:"), 1023, "MenuCommand" )
  18.    /*register_event("CurWeapon","daozi","b")*/
  19.    RegisterHam(Ham_TakeDamage ,"player","falldamage")
  20.    RegisterHam(Ham_Spawn,"player","ye",1)
  21.    register_forward(FM_PlayerPreThink,"shijiao")
  22.    return PLUGIN_CONTINUE
  23. }
  24. public daozi(id)
  25. {
  26.     if(is_user_alive(id)&&dz[id]==true&&get_user_weapon(id)==CSW_KNIFE)
  27.     {
  28.         set_pev(id,pev_viewmodel2,"models/Yq_d.mdl")
  29.         }
  30.     else if(is_user_alive(id)&&dz[id]==false&&get_user_weapon(id)==CSW_KNIFE)
  31.     {
  32.         set_pev(id,pev_viewmodel2,"models/v_knife.mdl")
  33.         }
  34.     }
  35. public shijiao(id)
  36. {
  37.     if(is_user_alive(id)&&sj[id]==true)
  38.     {
  39.     set_pev(id,pev_fov,180.0)
  40.     set_pev(id,pev_view_ofs,{0.0,0.0,0.01})
  41.         }
  42.     }
  43. public plugin_precache()
  44. {
  45.         precache_model("models/player/gsg9/gsg9.mdl")
  46.         precache_model("models/player/arctic/arctic.mdl")
  47.         precache_model("models/player/Yq_ct/Yq_ct.mdl")
  48.         precache_model("models/player/Yq/Yq.mdl")
  49.         precache_model("models/player/Yq_t/Yq_t.mdl")
  50.         precache_model("models/v_knife.mdl")
  51.         precache_model("models/Yq_d.mdl")
  52.         return PLUGIN_CONTINUE
  53. }   
  54. public ye(id)
  55. {
  56.    
  57.     dz[id]=false
  58.     yezb[id]=false
  59.     set_pev(id,pev_fov,90.0)
  60.     set_pev(id,pev_view_ofs,{0.0,0.0,20.0})
  61.     sj[id]=false
  62.     if(cs_get_user_team(id)==CS_TEAM_CT&&get_user_flags(id) & ADMIN_LEVEL_A)
  63.     {
  64.         cs_set_user_model(id,"Yq_ct")
  65.         }
  66.     else if(cs_get_user_team(id)==CS_TEAM_T&&get_user_flags(id) & ADMIN_LEVEL_A)
  67.     {
  68.         cs_set_user_model(id,"Yq_t")
  69.         }
  70.     else if(cs_get_user_team(id)==CS_TEAM_CT)
  71.     {
  72.         cs_set_user_model(id,"gsg9")
  73.         }
  74.     else if(cs_get_user_team(id)==CS_TEAM_T)
  75.     {
  76.         cs_set_user_model(id,"arctic")
  77.         }

  78.     }
  79. public ShowMenu( id )
  80. {
  81.    new caidan[512]
  82.    new keys

  83.    new YQ = format( caidan, 511, "\rSilent战队 商店菜单:^n" )

  84.    YQ += format( caidan[YQ], 511-YQ, "^n\w1. \y信春哥,得永生($16000复活)" )
  85.    YQ += format( caidan[YQ], 511-YQ, "^n\w2. \y信春哥,摔不死($10000五秒摔不死)" )
  86.    YQ += format( caidan[YQ], 511-YQ, "^n\w3. \y信春哥,能逃生!($5000能隐身耶)" )
  87.    YQ += format( caidan[YQ], 511-YQ, "^n\w4. \y信曾哥,能加血!($6000瞬间加100血量)" )
  88.    YQ += format( caidan[YQ], 511-YQ, "^n\w5. \y信夜琴,射CT($10000琴哥给你AWP)" )
  89.    YQ += format( caidan[YQ], 511-YQ, "^n\w6. \y信夜琴,能装逼($0免费带你飞)" )
  90.    YQ += format( caidan[YQ], 511-YQ, "^n\w7. \y信夜琴,能换衣($10000给你一件敌对的衣服)." )
  91.    YQ += format( caidan[YQ], 511-YQ, "^n\w8. \y变身迷你狗!($8000让你变成非常小的狗)")
  92.    YQ += format( caidan[YQ], 511-YQ, "^n\w9. \y尼泊尔大屌刀($500给你宝刀)" )
  93.    YQ += format( caidan[YQ], 511-YQ, "^n^n\w0. 退出菜单" )

  94.    keys = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<8|1<<9)

  95.    show_menu( id, keys, caidan, -1 )

  96.    return PLUGIN_CONTINUE
  97. }
  98. public fuhuo(id)
  99. {
  100.     new a=16000
  101.     new b=cs_get_user_money(id)
  102.     new name[32]
  103.     get_user_name(id,name,31)
  104.     if(b>=a&&!is_user_alive(id))
  105.     {
  106.         cs_set_user_money (id,b-a,1)
  107.         client_print(0,print_chat,"[Silent战队]玩家%s使用了复活道具",name)
  108.         ExecuteHamB(Ham_CS_RoundRespawn,id)
  109.     }
  110.     else if (b<a)
  111.     {
  112.         client_print(id,print_chat,"[Silent战队]金钱不足%d",a)
  113.         }
  114.     else if (is_user_alive(id))
  115.     {
  116.         client_print(id,print_chat,"[Silent战队]那么想复活,你先死了好了!")
  117.         }
  118.     }
  119. public shuaibusi(id)
  120. {
  121.     new a=10000
  122.     new b=cs_get_user_money(id)
  123.     new name[32]
  124.     get_user_name(id,name,31)
  125.     if(b>=a&&is_user_alive(id))
  126.     {
  127.         cs_set_user_money (id,b-a,1)
  128.         client_print(0,print_chat,"[Silent战队]玩家%s说信春哥,摔不死!",name)
  129.         sbs[id]=true
  130.         set_task(5.0,"fall",id)
  131.         }
  132.     else if(b<a)
  133.     {
  134.         client_print(id,print_chat,"[Silent战队]金钱不足")
  135.         }
  136.     else if(!is_user_alive(id))
  137.     {
  138.         client_print(id,print_chat,"[Silent战队]首先你必须是活的!")
  139.         }
  140.     }
  141. public fall(id)
  142. {
  143.     sbs[id]=false
  144.     client_print(id,print_chat,"[Silent战队]真男人时间结束,不要再跳楼了")
  145. }
  146. public falldamage(id,victim, inf, attacker, Float:damage, damage_type)
  147. {
  148. if(sbs[id]==false&&damage_type != DMG_FALL)return HAM_IGNORED
  149. return HAM_SUPERCEDE
  150. }
  151. public jiaxue(id)
  152. {
  153.     new a=6000
  154.     new b=cs_get_user_money(id)
  155.     new name[32]
  156.     get_user_name(id,name,31)
  157.     if(b>=a&&is_user_alive(id))
  158.     {
  159.         cs_set_user_money (id,b-a,1)
  160.         client_print(0,print_chat,"[Silent战队]玩家%s说信曾哥,给我血!结果顺利获得100HP!",name)
  161.         new x=get_user_health(id)
  162.         set_user_health (id,x+100)
  163.         }
  164.     else if(b<a)
  165.     {
  166.         client_print(id,print_chat,"[Silent战队]金钱不足")
  167.         }
  168.     else if(!is_user_alive(id))
  169.     {
  170.         client_print(id,print_chat,"[Silent战队]首先你必须是活的!")
  171.         }
  172.     }
  173. public yinshen(id)
  174.     {
  175.     new a=5000
  176.     if(cs_get_user_money(id)>=a&&is_user_alive(id))
  177. {
  178.     new name[32]
  179.     get_user_name(id,name,31)
  180.     new b=cs_get_user_money(id)
  181.     b=b-5000
  182.     cs_set_user_money (id,b,1)
  183.     set_pev(id,pev_effects,EF_NODRAW)
  184.     client_print(id,print_chat,"[Silent战队]购买成功,隐身5秒!")
  185.     set_task(5.0,"YSJS",id)
  186.     client_print(0,print_chat,"[Silent战队]玩家 %s 使用了逃生道具!",name)
  187.     }
  188.     else if(cs_get_user_money(id)<=a)
  189.     {
  190.     client_print(id,print_chat,"[Silent战队]金钱不足!")
  191.         }
  192.     else if(!is_user_alive(id))
  193.     {
  194.     client_print(id,print_chat,"[Silent战队]死亡状态无法购买")
  195.         }
  196.     return PLUGIN_HANDLED
  197. }
  198. public YSJS(id)
  199. {
  200.     set_pev(id,pev_effects,0)
  201.     client_print(id,print_chat,"[Silent战队]隐身时间结束")
  202.     }
  203. public AWP(id)
  204. {
  205.     new a=10000
  206.     new b=cs_get_user_money(id)
  207.     new name[32]
  208.     get_user_name(id,name,31)
  209.     if(b>=a&&is_user_alive(id)&&cs_get_user_team(id)==CS_TEAM_T)
  210.     {
  211.         cs_set_user_money (id,b-a,1)
  212.         client_print(0,print_chat,"[Silent战队]玩家%s信仰夜琴,夜琴高兴给了他一把AWP!",name)
  213.         cs_set_weapon_ammo(give_item(id,"weapon_awp"),2)
  214.         cs_set_user_bpammo(id,CSW_AWP,0)
  215.         }
  216.     else if(cs_get_user_team(id)==CS_TEAM_CT)
  217.     {
  218.         client_print(id,print_chat,"[Silent战队]渣渣CT想打T的小JJ?")
  219.         }
  220.     else if(b<a)
  221.     {
  222.         client_print(id,print_chat,"[Silent战队]金钱不足")
  223.         }
  224.     else if(!is_user_alive(id))
  225.     {
  226.         client_print(id,print_chat,"[Silent战队]首先你必须是活的!")
  227.         }
  228.     }
复制代码
 楼主| 发表于 2015-8-20 17:06:58 | 显示全部楼层 来自 广东东莞
  1. public zhuangbi(id) {
  2.     if (yezb[id] == false && is_user_alive(id)) {
  3.         yezb[id] = true strip_user_weapons(id) set_task(0.2, "zhuangbi2", id)
  4.     } else if (yezb[id] == true) {
  5.         client_print(id, print_chat, "[Silent战队]一局只能带你飞一次!")
  6.     } else if (!is_user_alive(id)) {
  7.         client_print(id, print_chat, "[Silent战队]首先你必须是活的!")
  8.     }
  9. }
  10. public zhuangbi2(id) {
  11.     new name[32] get_user_name(id, name, 31) give_item(id, "weapon_knife") client_print(0, print_chat, "[Silent战队]玩家%s大喊夜琴我爱你!夜琴心花路放,给了他装逼神器!", name) cs_set_weapon_ammo(give_item(id, "weapon_deagle"), 0) cs_set_user_bpammo(id, CSW_DEAGLE, 0)
  12. }
  13. public weizhuang(id) {
  14.     new a = 10000
  15.     if (cs_get_user_money(id) >= a && is_user_alive(id)) {
  16.         new name[32] 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, "[Silent战队] %s 淫笑中...!", name)
  17.     } else if (cs_get_user_money(id) <= a) {
  18.         client_print(id, print_chat, "[Silent战队]金钱不足!")
  19.     } else if (!is_user_alive(id)) {
  20.         client_print(id, print_chat, "[Silent战队]死亡状态无法购买")
  21.     }
  22. }
  23. public weizhuang2(id) {
  24.     if (cs_get_user_team(id) == CS_TEAM_CT) {
  25.         cs_set_user_model(id, "arctic")
  26.     } else if (cs_get_user_team(id) == CS_TEAM_T) {
  27.         cs_set_user_model(id, "gsg9")
  28.     }
  29. }
  30. public xiaogou(id) {
  31.     new a = 80
  32.     if (cs_get_user_money(id) >= a && is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_T) {
  33.         new name[32] 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[id] = true client_print(0, print_chat, "[Silent战队] %s 汪汪汪汪汪汪!", name)
  34.     } else if (cs_get_user_money(id) <= a) {
  35.         client_print(id, print_chat, "[Silent战队]金钱不足!")
  36.     } else if (cs_get_user_team(id) == CS_TEAM_CT) {
  37.         client_print(id, print_chat, "[Silent战队]CT不可以汪汪汪哦")
  38.     } else if (!is_user_alive(id)) {
  39.         client_print(id, print_chat, "[Silent战队]死亡状态无法购买")
  40.     }
  41. }
  42. public maidaozi(id) {
  43.     new a = 500 new b = cs_get_user_money(id) new name[32] get_user_name(id, name, 31) if (b >= a && is_user_alive(id)) {
  44.         cs_set_user_money(id, b - a, 1) client_print(0, print_chat, "[Silent战队]玩家%s购买了大屌!", name) dz[id] = true
  45.     } else if (b < a) {
  46.         client_print(id, print_chat, "[Silent战队]金钱不足")
  47.     } else if (!is_user_alive(id)) {
  48.         client_print(id, print_chat, "[Silent战队]首先你必须是活的!")
  49.     }
  50. }
  51. public MenuCommand(id, key) {
  52.     switch (key) {
  53.     case 0:
  54.         set_task(0.1, "fuhuo", id)
  55.     case 1:
  56.         set_task(0.1, "shuaibusi", id)
  57.     case 2:
  58.         set_task(0.1, "yinshen", id)
  59.     case 3:
  60.         set_task(0.1, "jiaxue", id)
  61.     case 4:
  62.         set_task(0.1, "AWP", id)
  63.     case 5:
  64.         set_task(0.1, "zhuangbi", id)
  65.     case 6:
  66.         set_task(0.1, "weizhuang", id)
  67.     case 7:
  68.         set_task(0.1, "xiaogou", id)
  69.     case 8:
  70.         set_task(0.1, "maidaozi", id)
  71.     case 9:
  72.         engclient_cmd(id, "退出菜单")
  73.     }
  74.     return PLUGIN_HANDLED
  75. }
复制代码
回复

使用道具 举报

发表于 2016-8-27 08:15:28 | 显示全部楼层 来自 广东深圳
好贴!顶!点赞!
不回复就没有金钱,
没金钱就不能下载,
不下载楼主白发帖。
回复

使用道具 举报

发表于 2016-8-27 08:29:11 | 显示全部楼层 来自 广东佛山
应该是这行没跟register_menucmd(register_menuid("\ySilent战队 商店菜单:"), 1023, "MenuCommand" )
这行对应new YQ = format( caidan, 511, "\rSilent战队 商店菜单:^n" ),这两个必须对应,不然不可以按.ok?
回复

使用道具 举报

发表于 2019-10-29 03:16:23 | 显示全部楼层 来自 河南
改改呀!!!!!!!!!!!
回复

使用道具 举报

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

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