Advertisement
Tibers

bcd_hudtimer

Jul 13th, 2023
363
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.25 KB | Writing | 0 0
  1. /*
  2.  Bomb Countdown HUD Timer v0.2 by SAMURAI
  3.  
  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.  
  8.     * Required Modules:
  9.  - CSX
  10.  
  11.         * Credits:
  12. - Emp` for various indicates
  13. - Alka for full tests
  14.  
  15.     * Changelog
  16.  - Fixed Events problems
  17.  - Pcvars
  18.  - Fixed any bug on plugin
  19.  
  20. */
  21.  
  22.  
  23. #include <amxmodx>
  24. #include <csx>
  25.  
  26. #define PLUGIN "Bomb Countdown HUD Timer"
  27. #define VERSION "0.2"
  28. #define AUTHOR "SAMURAI"
  29.  
  30. new g_c4timer, pointnum;
  31. new bool:b_planted = false;
  32.  
  33. //new g_msgsync;
  34.  
  35.  
  36. public plugin_init()
  37. {
  38.     register_plugin(PLUGIN,VERSION,AUTHOR);
  39.  
  40.     pointnum = get_cvar_pointer("mp_c4timer");
  41.  
  42.     register_logevent("newRound", 2, "1=Round_Start");
  43.     register_logevent("endRound", 2, "1=Round_End");
  44.     register_logevent("endRound", 2, "1&Restart_Round_");
  45.  
  46.     //g_msgsync = CreateHudSyncObj();
  47. }
  48.  
  49. public newRound()
  50. {
  51.     g_c4timer = -1;
  52.     remove_task(652450);
  53.     b_planted = false;
  54. }
  55.  
  56. public endRound()
  57. {
  58.     g_c4timer = -1;
  59.     remove_task(652450);
  60. }
  61.  
  62. public bomb_planted()
  63. {
  64.     b_planted = true;
  65.     g_c4timer = get_pcvar_num(pointnum);
  66.     dispTime()
  67.     set_task(1.0, "dispTime", 652450, "", 0, "b");
  68. }
  69.  
  70. public bomb_defused()
  71. {
  72.     if(b_planted)
  73.     {
  74.         remove_task(652450);
  75.         b_planted = false;
  76.     }
  77.    
  78. }
  79.  
  80. public bomb_explode()
  81. {
  82.     if(b_planted)
  83.     {
  84.         remove_task(652450);
  85.         b_planted = false;
  86.     }
  87.    
  88. }
  89.  
  90. public dispTime()
  91. {  
  92.     if(!b_planted)
  93.     {
  94.         remove_task(652450);
  95.         return;
  96.     }
  97.        
  98.  
  99.     if(g_c4timer >= 0)
  100.     {
  101.         if(g_c4timer > 13) set_hudmessage(0, 150, 0, -1.0, 0.80, 0, 1.0, 1.0, 0.01, 0.01, -1);
  102.         else if(g_c4timer > 7) set_hudmessage(150, 150, 0, -1.0, 0.80, 0, 1.0, 1.0, 0.01, 0.01, -1);
  103.         else set_hudmessage(150, 0, 0, -1.0, 0.80, 0, 1.0, 1.0, 0.01, 0.01, -1);
  104.  
  105.         //ShowSyncHudMsg(0, g_msgsync, "C4: %d", g_c4timer);
  106.         show_dhudmessage(0, "--[ GAMELIFE ]--^n --[ TIME C4: %d ]--^n gamelife.ro", g_c4timer);
  107.  
  108.         --g_c4timer;
  109.     }
  110.  
  111. }
  112. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  113. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
  114. */
  115.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement