Advertisement
Sugisaki

[AMXX] C4 timer

Sep 22nd, 2015
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.12 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <csx>
  3.  
  4. #define PLUGIN "New Plug-In"
  5. #define VERSION "1.0"
  6. #define AUTHOR "author"
  7.  
  8. new TASK_ID = 2254145
  9.  
  10. new Float:fc4timer
  11.  
  12. new Sync
  13.  
  14. public plugin_init()
  15. {
  16.     register_plugin(PLUGIN, VERSION, AUTHOR)
  17.     register_event("HLTV", "pfn_round_start", "a", "1=0", "2=0")
  18.     Sync = CreateHudSyncObj()
  19. }
  20. public bomb_planted()
  21. {
  22.     set_task(0.1, "pfn_countdown", TASK_ID, _, _, "b")
  23.     fc4timer = get_cvar_float("mp_c4timer")
  24. }
  25. public bomb_defused()
  26. {
  27.     remove_task(TASK_ID)
  28. }
  29. public bomb_explode()
  30. {
  31.     remove_task(TASK_ID)
  32. }
  33. public pfn_countdown(id)
  34. {
  35.     fc4timer -=0.1
  36.     if(fc4timer >= 10.0)
  37.     {
  38.         set_hudmessage(0, 255, 0, -1.0, 0.88, 0, 0.1, 0.2)
  39.         ShowSyncHudMsg(0, Sync, "C4 %i", floatround(fc4timer))
  40.         return PLUGIN_HANDLED
  41.     }
  42.     else if(5.0 <= fc4timer < 10.0)
  43.         set_hudmessage(255, 255, 0, -1.0, 0.88, 0, 0.1, 0.2)
  44.     else
  45.         set_hudmessage(255, 0, 0, -1.0, 0.88, 0, 0.1, 0.2)
  46.        
  47.     ShowSyncHudMsg(0, Sync, "C4 %0.1f", fc4timer)
  48.    
  49.     if(fc4timer <= 0.0)
  50.         remove_task(TASK_ID)
  51.    
  52.     return PLUGIN_HANDLED
  53. }
  54. public pfn_round_start()
  55. {
  56.     if(task_exists(TASK_ID))
  57.         remove_task(TASK_ID)
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement