Advertisement
Sugisaki

[AMXX] C4 Timer with sound

Jun 24th, 2015
445
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.54 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <csx>
  3.  
  4. #define PLUGIN "Nuevo Plugin"
  5. #define VERSION "1.0"
  6. #define AUTHOR "Sugisaki"
  7.  
  8. #define MAX_SOUNDS  10
  9.  
  10. #define TASK_ID 5544132
  11.  
  12. new iSounds[MAX_SOUNDS+1][20]
  13.  
  14. //////////////////// Configurable /////////////
  15. new Folder[] = "myfolder"
  16. ///////////////////////////////////////
  17.  
  18. new countdown
  19. new szCvar[] = "mp_c4timer"
  20.  
  21. new HudSync
  22.  
  23. public plugin_init()
  24. {
  25.     register_plugin(PLUGIN, VERSION, AUTHOR)
  26.     register_logevent("task_check", 2, "1=Round_End")
  27.     register_logevent("task_check", 2, "1=Round_Start")
  28.     HudSync = CreateHudSyncObj()
  29. }
  30. public task_check()
  31. {
  32.     if(task_exists(TASK_ID)) remove_task(TASK_ID)
  33. }
  34. public plugin_precache()
  35. {
  36.     for(new i = 1; i <= MAX_SOUNDS ; i++)
  37.     {
  38.         formatex(iSounds[i], charsmax(iSounds[]), "%s/%i.wav", Folder, i)
  39.         precache_sound(iSounds[i])
  40.     }
  41. }
  42. public bomb_planted()
  43. {
  44.     if(task_exists(TASK_ID)) remove_task(TASK_ID)
  45.     countdown = get_cvar_num(szCvar) - 1
  46.     set_task(1.0, "fw_countdown", TASK_ID, _, _,"b")
  47. }
  48. public fw_countdown(id)
  49. {
  50.     if(countdown)
  51.     {
  52.         if(countdown > 13) set_hudmessage(0, 102, 204, -1.0, 0.80, 0, 1.0, 1.0, 0.01, 0.01, -1);
  53.         else if(countdown > 7) set_hudmessage(255, 0, 255, -1.0, 0.80, 0, 1.0, 1.0, 0.01, 0.01, -1);
  54.         else set_hudmessage(150, 0, 0, -1.0, 0.80, 0, 1.0, 1.0, 0.01, 0.01, -1);
  55.        
  56.         ShowSyncHudMsg(0, HudSync, "|===========|^n| Tiempo de C4: %d |^n|===========|", countdown);
  57.        
  58.         if(countdown <= MAX_SOUNDS)
  59.         {
  60.             client_cmd(0, "spk ^"%s^"", iSounds[countdown])
  61.         }
  62.     }
  63.     else
  64.     {
  65.         remove_task(id)
  66.     }
  67.     countdown--
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement