找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 597|回复: 4

求一个C4倒计时插件

[复制链接]

该用户从未签到

发表于 2009-10-8 02:02:01 | 显示全部楼层 |阅读模式
试用过好几个 都有小小的问题 手里边正好有的别藏着掖着了 分享下~

该用户从未签到

发表于 2009-10-8 04:43:23 | 显示全部楼层
到KZ论坛来求这种东西?

该用户从未签到

 楼主| 发表于 2009-10-8 06:17:29 | 显示全部楼层
本帖最后由 alei-02 于 2009-10-8 06:18 编辑

半夜了没地方找哇

该用户从未签到

发表于 2009-10-8 07:19:24 | 显示全部楼层
本帖最后由 dsm635625 于 2009-10-8 16:35 编辑

Bomb Countdown HUD Timer v0.2
http://forums.alliedmods.net/showthread.php?t=51363

bcd_hudtimer.sma

  1. /*
  2. Bomb Countdown HUD Timer v0.2 by SAMURAI
  3. * Plugin Details
  4. With this plugin enabled, you can see an colored Hud Message with the c4 time left, until explode
  5.   Remeber : if until explode remains less than 8 seconds, hudmessage color will be red, if > 7 will be yellow and > 13 will be green.
  6. * Required Modules:
  7. - CSX

  8.         * Credits:
  9. - Emp` for various indicates
  10. - Alka for full tests
  11. * Changelog
  12. - Fixed Events problems
  13. - Pcvars
  14. - Fixed any bug on plugin
  15. */

  16. #include <amxmodx>
  17. #include <csx>

  18. #define PLUGIN "Bomb Countdown HUD Timer"
  19. #define VERSION "0.2"
  20. #define AUTHOR "SAMURAI"

  21. new g_c4timer, pointnum;
  22. new bool:b_planted = false;
  23. new g_msgsync;


  24. public plugin_init()
  25. {
  26. register_plugin(PLUGIN,VERSION,AUTHOR);

  27. pointnum = get_cvar_pointer("mp_c4timer");

  28. register_logevent("newRound", 2, "1=Round_Start");
  29. register_logevent("endRound", 2, "1=Round_End");
  30. register_logevent("endRound", 2, "1&Restart_Round_");

  31. g_msgsync = CreateHudSyncObj();
  32. }

  33. public newRound()
  34. {
  35. g_c4timer = -1;
  36. remove_task(652450);
  37. b_planted = false;
  38. }

  39. public endRound()
  40. {
  41. g_c4timer = -1;
  42. remove_task(652450);
  43. }

  44. public bomb_planted()
  45. {
  46. b_planted = true;
  47. g_c4timer = get_pcvar_num(pointnum);
  48. dispTime()
  49. set_task(1.0, "dispTime", 652450, "", 0, "b");
  50. }

  51. public bomb_defused()
  52. {
  53. if(b_planted)
  54. {
  55.   remove_task(652450);
  56.   b_planted = false;
  57. }
  58.    
  59. }

  60. public bomb_explode()
  61. {
  62. if(b_planted)
  63. {
  64.   remove_task(652450);
  65.   b_planted = false;
  66. }

  67. }

  68. public dispTime()
  69. {   
  70. if(!b_planted)
  71. {
  72.   remove_task(652450);
  73.   return;
  74. }
  75.         

  76. if(g_c4timer >= 0)
  77. {
  78.   if(g_c4timer > 13) set_hudmessage(0, 150, 0, -1.0, 0.80, 0, 1.0, 1.0, 0.01, 0.01, -1);
  79.   else if(g_c4timer > 7) set_hudmessage(150, 150, 0, -1.0, 0.80, 0, 1.0, 1.0, 0.01, 0.01, -1);
  80.   else set_hudmessage(150, 0, 0, -1.0, 0.80, 0, 1.0, 1.0, 0.01, 0.01, -1);

  81.   ShowSyncHudMsg(0, g_msgsync, "C4: %d", g_c4timer);

  82.   --g_c4timer;
  83. }
  84.   
  85. }
  86. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  87. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
  88. */

复制代码



bcdhud_without_csx.sma

  1. /*
  2. Bomb Countdown HUD Timer without CSX Version
  3. v0.2 by SAMURAI

  4. * Plugin Details
  5. With this plugin enabled, you can see an colored Hud Message with the c4 time left, until explode
  6.   Remeber : if until explode remains less than 8 seconds, hudmessage color will be red, if > 7 will be yellow and > 13 will be green.

  7.         * Credits:
  8. - Emp` for various indicates
  9. - Alka for full tests

  10. * Changelog
  11. - Fixed Events problems
  12. - Pcvars
  13. - Fixed any bug on plugin
  14. */

  15. #include <amxmodx>
  16. #define PLUGIN "Bomb Countdown HUD Timer"
  17. #define VERSION "0.2"
  18. #define AUTHOR "SAMURAI"

  19. new g_c4timer, pointnum;
  20. new bool:b_planted = false;
  21. new g_msgsync;

  22. public plugin_init()
  23. {
  24. register_plugin(PLUGIN,VERSION,AUTHOR);

  25. pointnum = get_cvar_pointer("mp_c4timer");

  26. register_logevent("bomb_planted" , 3 , "2=Planted_The_Bomb");
  27. register_logevent("bomb_defused" , 3 , "2=Defused_The_Bomb");
  28. register_logevent("bomb_explode" , 6 , "3=Target_Bombed");
  29.    
  30. register_logevent("newRound", 2, "1=Round_Start");
  31. register_logevent("endRound", 2, "1=Round_End");
  32. register_logevent("endRound", 2, "1&Restart_Round_");

  33. g_msgsync = CreateHudSyncObj();
  34. }

  35. public newRound()
  36. {
  37. g_c4timer = -1;
  38. remove_task(652450);
  39. b_planted = false;
  40. }

  41. public endRound()
  42. {
  43. g_c4timer = -1;
  44. remove_task(652450);
  45. }

  46. public bomb_planted()
  47. {
  48. b_planted = true;
  49. g_c4timer = get_pcvar_num(pointnum);
  50. dispTime()
  51. set_task(1.0, "dispTime", 652450, "", 0, "b");
  52. }

  53. public bomb_defused()
  54. {
  55. if(b_planted)
  56. {
  57.   remove_task(652450);
  58.   b_planted = false;
  59. }
  60.    
  61. }

  62. public bomb_explode()
  63. {
  64. if(b_planted)
  65. {
  66.   remove_task(652450);
  67.   b_planted = false;
  68. }

  69. }

  70. public dispTime()
  71. {   
  72. if(!b_planted)
  73. {
  74.   remove_task(652450);
  75.   return;
  76. }
  77.         

  78. if(g_c4timer >= 0)
  79. {
  80.   if(g_c4timer > 13) set_hudmessage(0, 150, 0, -1.0, 0.80, 0, 1.0, 1.0, 0.01, 0.01, -1);
  81.   else if(g_c4timer > 7) set_hudmessage(150, 150, 0, -1.0, 0.80, 0, 1.0, 1.0, 0.01, 0.01, -1);
  82.   else set_hudmessage(150, 0, 0, -1.0, 0.80, 0, 1.0, 1.0, 0.01, 0.01, -1);

  83.   ShowSyncHudMsg(0, g_msgsync, "C4: %d", g_c4timer);

  84.   --g_c4timer;
  85. }
  86.   
  87. }
  88. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  89. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
  90. */

复制代码



贴了看看效果的....

该用户从未签到

发表于 2009-10-8 08:57:32 | 显示全部楼层
LS英语说的好么
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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