Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <engine>
  3. #include <fakemeta>
  4. #include <zombieplague>
  5.  
  6. static const szCountDownFolder[] = "zombie_plague/countdown/"
  7. new const szSoundMusic[] = "zombie_start3.mp3"
  8. new const szSoundCountdown[][] =
  9. {
  10. "1.wav",
  11. "2.wav",
  12. "3.wav",
  13. "4.wav",
  14. "5.wav",
  15. "6.wav",
  16. "7.wav",
  17. "8.wav",
  18. "9.wav",
  19. "10.wav"
  20. }
  21.  
  22. IsMp3(const szSound[])
  23. return equali(szSound[strlen(szSound) - 4], ".mp3")
  24.  
  25. public plugin_precache()
  26. {
  27. new szSound[60]
  28. for (new iIndex = 0; iIndex < charsmax(szSoundCountdown); iIndex++)
  29. {
  30. formatex(szSound, charsmax(szSound), "%s%s", szCountDownFolder, szSoundCountdown[iIndex])
  31.  
  32. if (IsMp3(szSound))
  33. precache_generic(szSound)
  34. else
  35. precache_sound(szSound)
  36. }
  37.  
  38. formatex(szSound, charsmax(szSound), "%s%s", szCountDownFolder, szSoundMusic)
  39. if (IsMp3(szSound))
  40. precache_generic(szSound)
  41. else
  42. precache_sound(szSound)
  43. }
  44.  
  45. public plugin_init()
  46. {
  47. register_plugin("[ZP] Countdown", "1.0", "Jack")
  48. register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
  49. }
  50.  
  51. public event_round_start()
  52. {
  53. set_task(1.0, "StartMusic")
  54. set_task(11.0, "StartCountDown")
  55. }
  56.  
  57. public StartMusic()
  58. {
  59. new szSound[128]
  60. formatex(szSound, charsmax(szSound), "%s%s", szCountDownFolder, szSoundMusic)
  61. PlaySound(0, szSoundMusic, "mp3 play")
  62. }
  63.  
  64. public StartCountDown()
  65. {
  66. set_task(1.0, "CountDownSound")
  67. }
  68.  
  69. public CountDownSound()
  70. {
  71. new g_iCountDown = 10, szSound[128]
  72.  
  73. while (g_iCountDown > 0)
  74. {
  75. client_print(0, print_center, "%d", g_iCountDown)
  76. formatex(szSound, charsmax(szSound), "%s%s", szCountDownFolder, szSoundCountdown[g_iCountDown - 1])
  77. PlaySound(0, szSound, "spk")
  78. g_iCountDown--
  79. }
  80.  
  81. if (!g_iCountDown)
  82. {
  83. client_cmd(0, "mp3 stop")
  84. }
  85. }
  86.  
  87. PlaySound(id, const szSound[], szPlayer[])
  88. {
  89. client_cmd(id, "%s ^"%s^"", szPlayer, szSound)
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement