搜索
查看: 3327|回复: 12

[以解決]切換武器問題

[复制链接]
发表于 2009-8-3 01:00:58 | 显示全部楼层 |阅读模式 来自 中国–台湾
本帖最后由 jiunnwoei2629 于 2009-8-11 00:48 编辑

有沒有辦法使用狙擊槍射殺敵人時,禁止立刻按下Q切換小槍(其他武器)?
发表于 2009-8-3 11:28:38 | 显示全部楼层 来自 中国–北京–北京–海淀区

  1. #include <amxmodx>

  2. #define PLUGIN        "Test"
  3. #define AUTHOR        "Jim"
  4. #define VERSION        "1.0"

  5. new Float:g_lastkilltime[33]
  6. new g_cantQ[33]

  7. public plugin_init()
  8. {
  9.         register_plugin(PLUGIN, VERSION, AUTHOR)
  10.         register_clcmd("lastinv", "cmd_lastinv")
  11.         register_event("DeathMsg", "event_death", "a", "4=awp")
  12.         register_event("CurWeapon", "event_curweapon", "be", "2=18", "3=0")
  13. }

  14. public client_connect(id)
  15. {
  16.         g_cantQ[id] = 0
  17.         g_lastkilltime[id] = 0.0
  18. }

  19. public event_death()
  20. {
  21.         new id = read_data(1)
  22.         if(is_user_connected(id))
  23.                 g_lastkilltime[id] = get_gametime()
  24. }

  25. public event_curweapon(id)
  26. {
  27.         g_cantQ[id] = (get_gametime() - g_lastkilltime[id] < 2.0)
  28. }

  29. public cmd_lastinv(id)
  30. {
  31.         return g_cantQ[id]
  32. }
复制代码
没测试,用awp杀人后两秒内不能用q键
回复

使用道具 举报

 楼主| 发表于 2009-8-3 13:48:11 | 显示全部楼层 来自 中国–台湾
測試結果 還是殺人的時候可以按Q切槍
回复

使用道具 举报

 楼主| 发表于 2009-8-4 14:41:27 | 显示全部楼层 来自 中国–台湾
請各位幫個忙
蠻需要這個插件
回复

使用道具 举报

 楼主| 发表于 2009-8-10 03:00:46 | 显示全部楼层 来自 中国–台湾
各位幫幫忙阿
我需要此插件的幫忙
回复

使用道具 举报

发表于 2009-8-10 13:09:00 | 显示全部楼层 来自 中国–福建–漳州
  1. #include <amxmodx>
  2. new Float:g_lastawpkilltime[33]
  3. public plugin_init()
  4. {
  5.         register_plugin("AWP Kill Test", "1.0", "Rulzy")
  6.         register_clcmd("lastinv", "cmd_lastinv")
  7.         register_event("DeathMsg", "event_death", "a", "4=awp")
  8.         register_event("CurWeapon", "event_curweapon", "be", "2!18", "1=1")
  9. }
  10. public client_connect(id)
  11. {
  12.         g_lastawpkilltime[id] = 0.0
  13. }
  14. public event_death()
  15. {
  16.         new id = read_data(1)
  17.         if(is_user_connected(id))
  18.                 g_lastawpkilltime[id] = get_gametime()
  19. }
  20. public cmd_lastinv(id)
  21. {
  22.         if(get_gametime()-g_lastawpkilltime[id]>1.0)
  23.                 return PLUGIN_CONTINUE;
  24.         return PLUGIN_HANDLE;
  25. }
  26. public event_curweapon(id)
  27. {
  28.         g_lastawpkilltime[id] = 0.0
  29. }
复制代码
一秒钟内按Q键无效,但可以按1、2、3、4等键切换武器。
回复

使用道具 举报

 楼主| 发表于 2009-8-10 13:23:55 | 显示全部楼层 来自 中国–台湾
OK 立刻測試 會給回報
回复

使用道具 举报

发表于 2009-8-10 13:25:06 | 显示全部楼层 来自 中国–北京–北京–海淀区
register_event("CurWeapon", "event_curweapon", "be", "2=18", "3=0")
我的代码这个地方写错了,应该是
register_event("CurWeapon", "event_curweapon", "be", "1=0", "2=18")
回复

使用道具 举报

 楼主| 发表于 2009-8-10 13:34:22 | 显示全部楼层 来自 中国–台湾
#include
new Float:g_lastawpkilltime[33]
public plugin_init()
{
        register_plugin("AWP Kill Test", "1.0", "Rulzy")
        register_clcmd("lastinv", "cmd_lastinv")
        register_event("Death ...
Rulzy 发表于 2009-8-10 13:09


你的PLUGIN_HANDLE寫錯摟
應該是PLUGIN_HANDLED
不過測試結果還是一樣可以案Q換槍
還是說 他是測試殺人的時候
不能按Q
我是在無人狀態測試的

register_event("CurWeapon", "event_curweapon", "be", "2=18", "3=0")
我的代码这个地方写错了,应该是
register_event("CurWeapon", "event_curweapon", "be", "1=0", "2=18")
jim_yang 发表于 2009-8-10 13:25


OK 現在測試看看
回复

使用道具 举报

发表于 2009-8-10 17:56:41 | 显示全部楼层 来自 中国–福建–漳州
晕倒,你是说用AWP杀人之后不能马上按Q键切枪,并不是说AWP开枪之后。
回复

使用道具 举报

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

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