搜索
查看: 3689|回复: 12

请KK帮个忙,帮忙修改下此插件 谢谢

[复制链接]
发表于 2009-6-30 18:08:39 | 显示全部楼层 |阅读模式 来自 广东深圳
  1. #include <amxmodx>
  2. #include <fakemeta>
  3. #include <hamsandwich>

  4. new check[33] = 0

  5. #define X_POS -1.0
  6. #define Y_POS 0.5
  7. #define HOLE_TIME 7.0

  8. public plugin_init()
  9. {
  10.         register_plugin("block player","1.0","anzzy")
  11.         RegisterHam(Ham_Spawn, "player", "Player_Spawn", 1)
  12.         register_logevent("EventRoundStart", 2, "1=Round_Start");
  13. }

  14. public EventRoundStart(id) //情况一:死了等待开局检查
  15. {
  16.         if(check[id] == 1) //检查过的就不检查
  17.         return PLUGIN_HANDLED;

  18.         check[id] = 1
  19.         set_pev(id,pev_flags,pev(id,pev_flags) | FL_FROZEN) //block player

  20.         set_hudmessage(255,0, 0, X_POS, Y_POS, 1, 0.5, HOLE_TIME, 0.1, 0.1, -1);
  21.         show_hudmessage(id,"开局 7 秒内不能走动")
  22.         set_task(7.0,"remove",id)
  23.         return PLUGIN_CONTINUE;
  24. }

  25. public Player_Spawn(id) //情况二:开局后才进入出生的,不排除刚进入等待开局
  26. {
  27.         if(check[id]==1) //检查过的就不检查
  28.         return PLUGIN_HANDLED;

  29.         set_task(1.0,"checks",id)
  30.         set_hudmessage(255,0, 0, X_POS, Y_POS, 1, 0.5, HOLE_TIME, 0.1, 0.1, -1);
  31.         show_hudmessage(id,"开局 7 秒内不能走动")
  32.         return PLUGIN_CONTINUE;
  33. }

  34. public checks(id)
  35. {
  36.         if(!is_user_alive(id)) //地图夹死的,跳过
  37.         return PLUGIN_HANDLED;
  38.         set_pev(id,pev_flags,pev(id,pev_flags) | FL_FROZEN) //block player
  39.         set_task(6.0,"remove",id)
  40.         return PLUGIN_CONTINUE;
  41. }

  42. public remove(id)
  43. {
  44.         new flags = pev(id,pev_flags)
  45.         flags &= ~FL_FROZEN
  46.         set_pev(id,pev_flags,flags)
  47. }

  48. public client_connect(id)
  49. {
  50.         check[id] = 0
  51. }

  52. public client_disconnect(id)
  53. {
  54.         remove_task(id)
  55. }
复制代码
之前已经开过贴了,这次再请KK帮个忙修改下次插件,插件本意是限制玩家首局开局固定玩家7秒不能走动,但现在插件却每句都限制玩家走动。。 麻烦KK修改下,做成玩家进入首局固定7秒不能动!谢谢了
发表于 2009-6-30 23:00:16 | 显示全部楼层 来自 广东广州
本帖最后由 kk阿朗 于 2009-6-30 23:08 编辑

你试试吧!
  1. #include <amxmodx>
  2. #include <fakemeta>
  3. #include <hamsandwich>

  4. new check[33] = 0

  5. #define X_POS -1.0
  6. #define Y_POS 0.5
  7. #define HOLE_TIME 7.0

  8. public plugin_init()
  9. {
  10.         register_plugin("block player","1.0","anzzy")
  11.         RegisterHam(Ham_Spawn, "player", "Player_Spawn", 1)
  12.         register_logevent("EventRoundStart", 2, "1=Round_Start")
  13. }

  14. public EventRoundStart(id)
  15. {
  16.         if(check[id] == 1)
  17.                 return PLUGIN_HANDLED
  18.        
  19.         else if (check[id] == 0)
  20.         {
  21.                 set_pev(id, pev_flags, pev(id,pev_flags) | FL_FROZEN)
  22.                 set_hudmessage(255, 0, 0, X_POS, Y_POS, 1, 0.5, HOLE_TIME, 0.1, 0.1, -1)
  23.                 show_hudmessage(id, "you can't move")
  24.                 set_task(7.0,"remove",id)
  25.         }
  26.         return PLUGIN_CONTINUE
  27. }

  28. public Player_Spawn(id)
  29. {
  30.         if(check[id]==1)
  31.                 return PLUGIN_HANDLED
  32.                
  33.         else if (check[id] == 0)
  34.         {
  35.                 set_task(1.0,"checks",id)
  36.                 set_hudmessage(255, 0, 0, X_POS, Y_POS, 1, 0.5, HOLE_TIME, 0.1, 0.1, -1)
  37.                 show_hudmessage(id, "you can't move")
  38.         }
  39.         return PLUGIN_CONTINUE
  40. }

  41. public checks(id)
  42. {
  43.         if(!is_user_alive(id))
  44.                 return PLUGIN_HANDLED
  45.         set_pev(id, pev_flags, pev(id,pev_flags) | FL_FROZEN)
  46.         set_task(6.0,"remove",id)
  47.         return PLUGIN_CONTINUE
  48. }

  49. public remove(id)
  50. {
  51.         new flags = pev(id,pev_flags)
  52.         flags &= ~FL_FROZEN
  53.         set_pev(id,pev_flags,flags)
  54.         check[id] = 1
  55. }

  56. public client_putinserver(id)
  57. {
  58.         if (is_user_alive(id))
  59.                 check[id] = 0
  60. }

  61. public client_disconnect(id)
  62. {
  63.         remove_task(id)
  64. }
复制代码
回复

使用道具 举报

 楼主| 发表于 2009-6-30 23:44:41 | 显示全部楼层 来自 广东深圳
谢谢KK帮助,我去试下.
回复

使用道具 举报

 楼主| 发表于 2009-6-30 23:57:33 | 显示全部楼层 来自 广东深圳
刚测试完,把插件加载上去,换图生效,玩家进入首局会卡着,但如果retry再进去 就无效了。
回复

使用道具 举报

发表于 2009-7-1 10:58:15 | 显示全部楼层 来自 广东广州
现在是不是就剩下retry这个问题了??
我会再帮你调试一下!
由于昨天刚喝了几杯小酒!!嘻嘻!不好意思!!!:lol
回复

使用道具 举报

 楼主| 发表于 2009-7-1 12:10:53 | 显示全部楼层 来自 广东深圳
没错 刚才我是加到混战的,但目前发现的就是retry问题,其他暂时没发现问题..需要测试才知道
回复

使用道具 举报

 楼主| 发表于 2009-7-1 12:12:18 | 显示全部楼层 来自 广东深圳
希望尽快能解决此问题 :lol
回复

使用道具 举报

发表于 2009-7-3 10:59:40 | 显示全部楼层 来自 广东广州
今天终于考完试了!!
这个你再测试一下!记住,什么情况都要测试!!
  1. #include <amxmodx>
  2. #include <fakemeta>
  3. #include <hamsandwich>

  4. new check[33] = 0

  5. #define X_POS -1.0
  6. #define Y_POS 0.5
  7. #define HOLE_TIME 7.0

  8. public plugin_init()
  9. {
  10.         register_plugin("block player","1.0","anzzy")
  11.         RegisterHam(Ham_Spawn, "player", "Player_Spawn", 1)
  12.         register_logevent("EventRoundStart", 2, "1=Round_Start")
  13.         register_event("TextMsg", "eStart_Game", "a", "2=#Game_Commencing", "2=#Game_will_restart_in")
  14. }

  15. public EventRoundStart(id)
  16. {
  17.         if(check[id] == 1)
  18.                 return PLUGIN_HANDLED
  19.        
  20.         set_pev(id, pev_flags, pev(id,pev_flags) | FL_FROZEN)
  21.         set_hudmessage(255, 0, 0, X_POS, Y_POS, 1, 0.5, HOLE_TIME, 0.1, 0.1, -1)
  22.         show_hudmessage(id, "you can't move!^nPlease waite for 7 Seconds!")
  23.         set_task(7.0,"remove",id)
  24.         return PLUGIN_CONTINUE
  25. }

  26. public Player_Spawn(id)
  27. {
  28.         if(check[id]==1)
  29.                 return PLUGIN_HANDLED
  30.        
  31.         set_task(1.0,"checks",id)
  32.         set_hudmessage(255, 0, 0, X_POS, Y_POS, 1, 0.5, HOLE_TIME, 0.1, 0.1, -1)
  33.         show_hudmessage(id, "you can't move!^nPlease waite for 7 Seconds!")
  34.         return PLUGIN_CONTINUE
  35. }

  36. public checks(id)
  37. {
  38.         if(!is_user_alive(id))
  39.                 return PLUGIN_HANDLED
  40.         set_pev(id, pev_flags, pev(id,pev_flags) | FL_FROZEN)
  41.         set_task(6.0,"remove",id)
  42.         return PLUGIN_CONTINUE
  43. }

  44. public remove(id)
  45. {
  46.         new flags = pev(id,pev_flags)
  47.         flags &= ~FL_FROZEN
  48.         set_pev(id,pev_flags,flags)
  49.         check[id] = 1
  50. }

  51. public client_putinserver(id)
  52. {
  53.         if (is_user_alive(id))
  54.                 check[id] = 0
  55. }

  56. public client_disconnect(id)
  57. {
  58.         remove_task(id)
  59.         check[id] = 0
  60. }

  61. public eStart_Game(id)
  62. {
  63.         check[id] = 0
  64. }
复制代码
回复

使用道具 举报

 楼主| 发表于 2009-7-4 14:06:16 | 显示全部楼层 来自 广东深圳
我会尽快测试出来,会提到详细的细节
回复

使用道具 举报

 楼主| 发表于 2009-7-4 14:21:07 | 显示全部楼层 来自 广东深圳
KK,测试基本成功了,但我有个疑问,为什么了刷新一次服务器,HUD信息会显示,但玩家不会被卡住,其他一切正常,但没真正应用到混战服
回复

使用道具 举报

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

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