Guest User

Untitled

a guest
Feb 24th, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 28.08 KB | None | 0 0
  1. /*
  2. To do:
  3.  
  4. T = needs testing
  5. X = done
  6. - = cancelled
  7.  
  8. [X] latest zp43 and older support
  9. [X] zp5 support
  10. [X] speak instead of spk command so that the sound sentences won't overlap
  11. [X] optimize the way the sounds are played
  12. [T] zpa support
  13. [T] amxx >= 1.8.3 support
  14. [T] fix mp3 sounds not precaching or playing(add sound folder first)
  15. [T] only check for TASK_MAKEZOMBIE for zpnm, zpa, zp43 and lower
  16. [T] cache if sounds are mp3 instead of checking in file name all the time
  17. [T] play sound function check if there is any string and add option to use spk instead of speak
  18. [T] independent thunder effects
  19. [T] single thunder lightning task for both round and mode start
  20. [T] random thunder lightning counts
  21. [-] make sure the IDs of the pcvars are gotten on round start
  22. v1.7.1
  23. [T] fix countdown not showing on the first round after map change
  24. [T] fix wrong zp_lighting value being set on first round start with only 1 player
  25. v1.7.3
  26. [T] only manually trigger round start forward after 0.5 seconds if the running mod is 4 based
  27. [T] use spk instead of speak for countdown sentences
  28. (if sentence is too long, the sounds will overlap, but it's better left to the user's decision anyway)
  29. v1.7.5
  30. [T] fix 1 second delay causing runtime error
  31. v1.7.6
  32. [ ] full customization by external file(s)
  33. [ ] add more cvars for customizing
  34. [ ] fully customizable thunder effects
  35. [ ] custom countdown message(+color, position & effect) for each second
  36. [ ] custom round & mode start message
  37. [ ] ability to choose between dhud, hud, print_center, print_chat, print_notify and teammate aim info
  38. [ ] separate the thunder effects from the plugin?
  39. [ ] zp50 assassin mode support
  40. [ ] only remove lightning tasks on countdown start if effects cvar is 1 and current second has an assigned light level?
  41. [ ]
  42. */
  43.  
  44. // Modules
  45. #include <amxmodx>
  46. #include <fakemeta>
  47.  
  48. // Plug-in APIs
  49. // Uncomment the zombie plague mod version you want to use and comment the others
  50. //#include <zombieplague>
  51. //#include <zombie_plague_advance>
  52. #include <zombieplaguenightmare>
  53. //#include <zp50_gamemodes>
  54.  
  55. // Stocks
  56. #if AMXX_VERSION_NUM <= 182
  57. #include <dhudmessage>
  58. #endif
  59.  
  60. //#define g_bDebug;
  61.  
  62. enum
  63. {
  64. g_iIDTaskLightningRoundStart = 75000,
  65. g_iIDTaskCountDownStart,
  66. g_iIDTaskCountDown,
  67. g_iIDTaskLightningModeStart
  68. }
  69.  
  70. new const g_szSoRoundStart[][] =
  71. {
  72. ""
  73. }
  74. const g_iSizeSoundsRoundStart = sizeof g_szSoRoundStart - 1;
  75. new g_szSoRoundStartIsMp3[sizeof g_szSoRoundStart];
  76.  
  77. new const g_szSoThunderRoundStart[][] =
  78. {
  79. "de_torn/torn_thndrstrike",
  80. "ambience/thunder_clap"
  81. }
  82. const g_iSizeSoundsThunderRoundStart = sizeof g_szSoThunderRoundStart - 1;
  83. new g_szSoThunderRoundStartIsMp3[sizeof g_szSoThunderRoundStart];
  84.  
  85. new const g_szLightsThunderClapBright[][] =
  86. {
  87. "v", "w", "x", "y", "z"
  88. }
  89. const g_iSizeLightsThunderClapBright = sizeof g_szLightsThunderClapBright - 1;
  90.  
  91. new const g_szLightsThunderClapDark[][] =
  92. {
  93. "a", "b", "c", "d", "e"
  94. }
  95. const g_iSizeLightsThunderClapDark = sizeof g_szLightsThunderClapDark - 1;
  96.  
  97. new const g_szSoCountdown[][] =
  98. {
  99. "fvox/one",
  100. "fvox/two",
  101. "fvox/three",
  102. "fvox/four",
  103. "fvox/five",
  104. "fvox/six",
  105. "fvox/seven",
  106. "fvox/eight",
  107. "fvox/nine",
  108. "fvox/ten",
  109. /*
  110. "fvox/eleven",
  111. "fvox/twelve",
  112. "fvox/thirteen",
  113. "fvox/fourteen",
  114. */
  115. "", "", "", "",
  116. "fvox/fifteen seconds remaining",
  117. /*
  118. "fvox/sixteen",
  119. "fvox/seventeen",
  120. "fvox/eighteen",
  121. "fvox/nineteen",
  122. */
  123. "", "", "", "",
  124. "fvox/twenty seconds remaining",
  125. "", "", "", "",
  126. // "fvox/twentyfive",
  127. "",
  128. "", "", "", "",
  129. "fvox/thirty seconds remaining",
  130. "", "", "", "", "", "", "", "", "",
  131. // "fvox/fourty",
  132. "",
  133. "", "", "", "", "", "", "", "", "",
  134. // "fvox/fifty",
  135. "",
  136. "", "", "", "", "", "", "", "", "",
  137. "fvox/one minutes remaining",
  138. "", "", "", "", "", "", "", "", "",
  139. // "fvox/seventy",
  140. "",
  141. "", "", "", "", "", "", "", "", "",
  142. // "fvox/eighty",
  143. "",
  144. "", "", "", "", "", "", "", "", "",
  145. "fvox/one minutes thirty seconds remaining",
  146. // "fvox/ninety",
  147. "", "", "", "", "", "", "", "", "",
  148. // "fvox/onehundred",
  149. "",
  150. "", "", "", "", "", "", "", "", "", "",
  151. "", "", "", "", "", "", "", "", "",
  152. "fvox/two minutes remaining"
  153. }
  154. const g_iSizeSoundsCountdown = sizeof g_szSoCountdown - 1;
  155. new g_szSoCountdownIsMp3[sizeof g_szSoCountdown];
  156.  
  157. new const g_szLightsCountdownLevels[][] =
  158. {
  159. "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m"
  160. }
  161. const g_iSizeLightsCountdownLevels = sizeof g_szLightsCountdownLevels - 1;
  162.  
  163. new const g_szSoModeStart[][] =
  164. {
  165. "fvox/biohazard_detected"
  166. }
  167. const g_iSizeSoundsModeStart = sizeof g_szSoModeStart - 1;
  168. new g_szSoModeStartIsMp3[sizeof g_szSoModeStart];
  169.  
  170. new const g_szSoThunderModeStart[][] =
  171. {
  172. "de_torn/torn_thndrstrike",
  173. "ambience/thunder_clap"
  174. }
  175. const g_iSizeSoundsThunderModeStart = sizeof g_szSoThunderModeStart - 1;
  176. new g_szSoThunderModeStartIsMp3[sizeof g_szSoThunderModeStart];
  177.  
  178. new g_iIDPCvarEffects, g_iIDPCvarDelay, g_iIDPCvarLighting, g_iDelay, g_szLighting[2], g_iSeconds, g_iThunderLights;
  179.  
  180. public plugin_init()
  181. {
  182. register_plugin("[ZPNM] Countdown Lights", "1.7.6", "D i 5 7 i n c T")
  183.  
  184. register_dictionary("zpnm_countdown.txt")
  185.  
  186. register_event("HLTV", "fwEvHLTVRoundStart", "a", "1=0", "2=0")
  187.  
  188. g_iIDPCvarEffects = register_cvar("zpnm_countdown_effects", "1");
  189. }
  190.  
  191. public plugin_cfg()
  192. {
  193. #if defined _zombieplaguenightmare_included || defined _zombie_plague_advance_included || defined _zombieplague_included
  194. g_iIDPCvarDelay = get_cvar_pointer("zp_delay");
  195.  
  196. set_task(0.5, "fwEvHLTVRoundStart", g_iIDTaskCountDownStart)
  197. #else
  198. #if defined _zp50_gamemodes_included
  199. g_iIDPCvarDelay = get_cvar_pointer("zp_gamemode_delay");
  200. #endif
  201. #endif
  202.  
  203. g_iIDPCvarLighting = get_cvar_pointer("zp_lighting");
  204. }
  205.  
  206. stock ftSoundIsMp3(const szSound[])
  207. return equali(szSound[strlen(szSound) - 4], ".mp3");
  208.  
  209. stock ftPlaySound(const iID = 0, const szSound[], bIsMp3 = -1, const bSpeak = 0)
  210. {
  211. if (!szSound[0])
  212. return;
  213.  
  214. if (bIsMp3 < 0)
  215. bIsMp3 = ftSoundIsMp3(szSound);
  216.  
  217. client_cmd(iID, "%s ^"%s%s^"", !bIsMp3 ? !bSpeak ? "spk" : "speak" : "mp3 play", !bIsMp3 ? "" : "sound/", szSound)
  218. }
  219.  
  220. public fwEvHLTVRoundStart()
  221. {
  222. //if (!g_iIDPCvarDelay)
  223. //plugin_cfg();
  224.  
  225. g_iDelay = floatround(get_pcvar_float(g_iIDPCvarDelay), floatround_floor);
  226.  
  227. if (g_iDelay <= 0)
  228. return;
  229.  
  230. remove_task(g_iIDTaskLightningRoundStart)
  231. remove_task(g_iIDTaskCountDownStart)
  232. remove_task(g_iIDTaskCountDown)
  233. remove_task(g_iIDTaskLightningModeStart)
  234.  
  235. if (g_szLighting[0])
  236. {
  237. engfunc(EngFunc_LightStyle, 0, g_szLighting)
  238. set_pcvar_string(g_iIDPCvarLighting, g_szLighting);
  239.  
  240. g_szLighting = "";
  241. }
  242.  
  243. new iRandom;
  244.  
  245. iRandom = random_num(0, g_iSizeSoundsRoundStart);
  246.  
  247. ftPlaySound(_, g_szSoRoundStart[iRandom], g_szSoRoundStartIsMp3[iRandom], 1)
  248.  
  249. #if defined _zombieplaguenightmare_included || defined _zombie_plague_advance_included || defined _zombieplague_included
  250. set_task(2.0, "fwTaskCountDownStart", g_iIDTaskCountDownStart)
  251. #else
  252. #if defined _zp50_gamemodes_included
  253. set_task(0.2, "fwTaskCountDownStart", g_iIDTaskCountDownStart)
  254. #endif
  255. #endif
  256.  
  257. if (get_pcvar_num(g_iIDPCvarEffects))
  258. {
  259. get_pcvar_string(g_iIDPCvarLighting, g_szLighting, charsmax(g_szLighting))
  260.  
  261. //set_pcvar_string(g_iIDPCvarLighting, "0")
  262.  
  263. #if defined _zombieplaguenightmare_included || defined _zombie_plague_advance_included || defined _zombieplague_included
  264. while ((g_iThunderLights = random_num(5, 19)) % 2 == 0)
  265. {
  266. // Generate a random number until it's uneven
  267. }
  268. #else
  269. #if defined _zp50_gamemodes_included
  270. g_iThunderLights = 1
  271. #endif
  272. #endif
  273.  
  274. fwTaskThunderLightning(g_iIDTaskLightningRoundStart)
  275. set_task(0.1, "fwTaskThunderLightning", g_iIDTaskLightningRoundStart, _, _, "b")
  276.  
  277. iRandom = random_num(0, g_iSizeSoundsThunderRoundStart);
  278.  
  279. ftPlaySound(0, g_szSoThunderRoundStart[iRandom], g_szSoThunderRoundStartIsMp3[iRandom])
  280. }
  281. }
  282.  
  283. public fwTaskCountDownStart()
  284. {
  285. g_iSeconds = g_iDelay - 1;
  286.  
  287. fwTaskCountDown(g_iIDTaskCountDown)
  288.  
  289. if (g_iSeconds >= 0)
  290. set_task(1.0, "fwTaskCountDown", g_iIDTaskCountDown, _, _, "b")
  291. }
  292.  
  293. public fwTaskThunderLightning(const iIDTask)
  294. {
  295. if (g_iThunderLights)
  296. {
  297. new iRandom;
  298.  
  299. if (g_iThunderLights % 2 == 0)
  300. {
  301. iRandom = random_num(0, g_iSizeLightsThunderClapDark);
  302.  
  303. engfunc(EngFunc_LightStyle, 0, g_szLightsThunderClapDark[iRandom])
  304. set_pcvar_string(g_iIDPCvarLighting, g_szLightsThunderClapDark[iRandom])
  305. }
  306. else
  307. {
  308. iRandom = random_num(0, g_iSizeLightsThunderClapBright);
  309.  
  310. engfunc(EngFunc_LightStyle, 0, g_szLightsThunderClapBright[iRandom])
  311. set_pcvar_string(g_iIDPCvarLighting, g_szLightsThunderClapBright[iRandom])
  312. }
  313.  
  314. g_iThunderLights--;
  315. }
  316. else
  317. {
  318. remove_task(iIDTask)
  319.  
  320. if (iIDTask == g_iIDTaskLightningRoundStart && get_pcvar_num(g_iIDPCvarEffects))
  321. {
  322. if (g_iDelay - 1 > g_iSizeLightsCountdownLevels)
  323. {
  324. engfunc(EngFunc_LightStyle, 0, g_szLightsCountdownLevels[g_iSizeLightsCountdownLevels])
  325. set_pcvar_string(g_iIDPCvarLighting, g_szLightsCountdownLevels[g_iSizeLightsCountdownLevels])
  326. }
  327. else
  328. {
  329. engfunc(EngFunc_LightStyle, 0, g_szLightsCountdownLevels[g_iDelay - 1])
  330. set_pcvar_string(g_iIDPCvarLighting, g_szLightsCountdownLevels[g_iDelay - 1])
  331. }
  332. }
  333. else
  334. {
  335. if (!g_szLighting[0])
  336. return;
  337.  
  338. engfunc(EngFunc_LightStyle, 0, g_szLighting)
  339. set_pcvar_string(g_iIDPCvarLighting, g_szLighting)
  340.  
  341. g_szLighting = "";
  342. }
  343. }
  344. }
  345.  
  346. public fwTaskCountDown(const iIDTask)
  347. {
  348. #if defined _zombieplaguenightmare_included || defined _zombie_plague_advance_included || defined _zombieplague_included
  349. // Check for the external "TASK_MAKEZOMBIE" from inside ZPNM, ZPA, <=ZP43
  350. if (!task_exists(3000, 1)) //2010
  351. #else
  352. #if defined _zp50_gamemodes_included
  353. // Check for the external "TASK_GAMEMODE" from inside ZP50
  354. if (!task_exists(100, 1))
  355. #endif
  356. #endif
  357. {
  358. remove_task(iIDTask)
  359.  
  360. return;
  361. }
  362.  
  363. if (g_iSeconds == g_iDelay - 1)
  364. {
  365. remove_task(g_iIDTaskLightningRoundStart)
  366. remove_task(g_iIDTaskLightningModeStart)
  367. }
  368.  
  369. set_dhudmessage(random_num(57, 255), random_num(0, 255), random_num(0, 255), -1.0, 0.3975, 2, 1.1, 1.1, 0.0, 0.0)
  370. show_dhudmessage(0, "%L", LANG_PLAYER, "ZPNM_COUNTDOWN", g_iSeconds + 1)
  371.  
  372. if (g_iSeconds <= g_iSizeSoundsCountdown)
  373. ftPlaySound(0, g_szSoCountdown[g_iSeconds], g_szSoCountdownIsMp3[g_iSeconds])//, 1
  374.  
  375. if (get_pcvar_num(g_iIDPCvarEffects))
  376. {
  377. if (g_iSeconds <= g_iSizeLightsCountdownLevels && g_szLightsCountdownLevels[g_iSeconds][0])
  378. {
  379. engfunc(EngFunc_LightStyle, 0, g_szLightsCountdownLevels[g_iSeconds])
  380. set_pcvar_string(g_iIDPCvarLighting, g_szLightsCountdownLevels[g_iSeconds])
  381. }
  382. }
  383. else
  384. {
  385. if (g_szLighting[0])
  386. {
  387. engfunc(EngFunc_LightStyle, 0, g_szLighting)
  388. set_pcvar_string(g_iIDPCvarLighting, g_szLighting)
  389.  
  390. g_szLighting = "";
  391. }
  392. }
  393.  
  394. g_iSeconds--
  395.  
  396. if (g_iSeconds < 0)
  397. remove_task(iIDTask)
  398. }
  399.  
  400. #if defined _zombieplaguenightmare_included || defined _zombie_plague_advance_included
  401. public zp_round_started(iIDMode)
  402. #endif
  403. #if defined _zombieplague_included
  404. public zp_round_started()
  405. #endif
  406. #if defined _zp50_gamemodes_included
  407. public zp_fw_gamemodes_start()
  408. #endif
  409. {
  410. remove_task(g_iIDTaskLightningRoundStart)
  411. remove_task(g_iIDTaskCountDownStart)
  412. remove_task(g_iIDTaskCountDown)
  413. remove_task(g_iIDTaskLightningModeStart)
  414.  
  415. new iRandom;
  416.  
  417. iRandom = random_num(0, g_iSizeSoundsModeStart);
  418. ftPlaySound(0, g_szSoModeStart[iRandom], g_szSoModeStartIsMp3[iRandom], 1)
  419.  
  420. #if defined _zombieplaguenightmare_included || defined _zombie_plague_advance_included
  421. if (iIDMode == MODE_ASSASSIN)
  422. return;
  423. #endif
  424.  
  425. if (!get_pcvar_num(g_iIDPCvarEffects))
  426. {
  427. if (g_szLighting[0])
  428. {
  429. engfunc(EngFunc_LightStyle, 0, g_szLighting)
  430. set_pcvar_string(g_iIDPCvarLighting, g_szLighting);
  431.  
  432. g_szLighting = "";
  433. }
  434.  
  435. return;
  436. }
  437.  
  438. iRandom = random_num(0, g_iSizeSoundsThunderModeStart);
  439. ftPlaySound(0, g_szSoThunderModeStart[iRandom], g_szSoThunderModeStartIsMp3[iRandom])
  440.  
  441. while ((g_iThunderLights = random_num(5, 19)) % 2 == 0)
  442. {
  443. // Generate a random number until it's uneven
  444. }
  445.  
  446. fwTaskThunderLightning(g_iIDTaskLightningModeStart)
  447. set_task(0.1, "fwTaskThunderLightning", g_iIDTaskLightningModeStart, _, _, "b")
  448. }
  449.  
  450. public plugin_precache()
  451. {
  452. new i, szSound[64], iPosition, iPositionTemp, szFolder[64];
  453.  
  454. for (i = 0; i <= g_iSizeSoundsRoundStart; i++)
  455. {
  456. if (!g_szSoRoundStart[i][0])
  457. continue;
  458.  
  459. if (ftSoundIsMp3(g_szSoRoundStart[i]))
  460. {
  461. formatex(szSound, charsmax(szSound), "sound/%s", g_szSoRoundStart[i])
  462.  
  463. engfunc(EngFunc_PrecacheGeneric, szSound)
  464.  
  465. g_szSoRoundStartIsMp3[i] = 1;
  466. }
  467. else
  468. {
  469. // Doesn't contain any spaces
  470. if (containi(g_szSoRoundStart[i], " ") == -1)
  471. {
  472. formatex(szSound, charsmax(szSound), "%s.wav", g_szSoRoundStart[i])
  473.  
  474. engfunc(EngFunc_PrecacheSound, szSound)
  475. }
  476. // Contains spaces
  477. else
  478. {
  479. iPosition = 0;
  480.  
  481. while ((iPositionTemp = containi(g_szSoRoundStart[i][iPosition], "/")) != -1)
  482. {
  483. #if defined g_bDebug
  484. log_to_file("CountDown.log", "Scanning ^"%s^" for ^"/^" symbols.", g_szSoRoundStart[i][iPosition])
  485. #endif
  486.  
  487. iPosition += iPositionTemp + 1;
  488.  
  489. #if defined g_bDebug
  490. log_to_file("CountDown.log", "^"/^" symbol found at position %d: ^"%s^"", iPositionTemp, g_szSoRoundStart[i][iPosition - 1])
  491. log_to_file("CountDown.log", "Remaining directories and sounds found: ^"%s^"", g_szSoRoundStart[i][iPosition])
  492. log_to_file("CountDown.log", "")
  493. #endif
  494. }
  495.  
  496. if (iPosition)
  497. {
  498. formatex(szFolder, charsmax(szFolder), g_szSoRoundStart[i])
  499. replace(szFolder, charsmax(szFolder), g_szSoRoundStart[i][iPosition], "")
  500. }
  501.  
  502. #if defined g_bDebug
  503. log_to_file("CountDown.log", "Directory found: ^"%s^"", szFolder)
  504. log_to_file("CountDown.log", "Sounds found: ^"%s^"", g_szSoRoundStart[i][iPosition])
  505. log_to_file("CountDown.log", "")
  506. #endif
  507.  
  508. while ((iPositionTemp = containi(g_szSoRoundStart[i][iPosition], " ")) != -1)
  509. {
  510. #if defined g_bDebug
  511. log_to_file("CountDown.log", "Scanning ^"%s^" for ^" ^" symbols.", g_szSoRoundStart[i][iPosition])
  512. #endif
  513.  
  514. formatex(szSound, charsmax(szSound), g_szSoRoundStart[i][iPosition])
  515.  
  516. iPosition += iPositionTemp;
  517.  
  518. #if defined g_bDebug
  519. log_to_file("CountDown.log", "^" ^" symbol found at position %d: ^"%s^"", iPositionTemp, g_szSoRoundStart[i][iPosition])
  520. #endif
  521.  
  522. replace(szSound, charsmax(szSound), g_szSoRoundStart[i][iPosition], "")
  523.  
  524. #if defined g_bDebug
  525. log_to_file("CountDown.log", "Found sound: ^"%s^"", szSound)
  526. #endif
  527.  
  528. format(szSound, charsmax(szSound), "%s%s.wav", szFolder, szSound)
  529. engfunc(EngFunc_PrecacheSound, szSound)
  530.  
  531. #if defined g_bDebug
  532. log_to_file("CountDown.log", "Precaching sound: ^"%s^"", szSound)
  533. #endif
  534.  
  535. iPosition += 1;
  536.  
  537. #if defined g_bDebug
  538. log_to_file("CountDown.log", "Remaining sounds found: ^"%s^"", g_szSoRoundStart[i][iPosition])
  539. log_to_file("CountDown.log", "")
  540. #endif
  541. }
  542.  
  543. formatex(szSound, charsmax(szSound), "%s%s.wav", szFolder, g_szSoRoundStart[i][iPosition])
  544. engfunc(EngFunc_PrecacheSound, szSound)
  545.  
  546. #if defined g_bDebug
  547. log_to_file("CountDown.log", "Precaching sound: ^"%s^"", szSound)
  548. log_to_file("CountDown.log", "")
  549. #endif
  550. }
  551. }
  552. }
  553.  
  554. for (i = 0; i <= g_iSizeSoundsThunderRoundStart; i++)
  555. {
  556. if (!g_szSoThunderRoundStart[i][0])
  557. continue;
  558.  
  559. if (ftSoundIsMp3(g_szSoThunderRoundStart[i]))
  560. {
  561. formatex(szSound, charsmax(szSound), "sound/%s", g_szSoThunderRoundStart[i])
  562.  
  563. engfunc(EngFunc_PrecacheGeneric, szSound)
  564.  
  565. g_szSoThunderRoundStartIsMp3[i] = 1;
  566. }
  567. else
  568. {
  569. // Doesn't contain any spaces
  570. if (containi(g_szSoThunderRoundStart[i], " ") == -1)
  571. {
  572. formatex(szSound, charsmax(szSound), "%s.wav", g_szSoThunderRoundStart[i])
  573.  
  574. engfunc(EngFunc_PrecacheSound, szSound)
  575. }
  576. // Contains spaces
  577. else
  578. {
  579. iPosition = 0;
  580.  
  581. while ((iPositionTemp = containi(g_szSoThunderRoundStart[i][iPosition], "/")) != -1)
  582. {
  583. #if defined g_bDebug
  584. log_to_file("CountDown.log", "Scanning ^"%s^" for ^"/^" symbols.", g_szSoThunderRoundStart[i][iPosition])
  585. #endif
  586.  
  587. iPosition += iPositionTemp + 1;
  588.  
  589. #if defined g_bDebug
  590. log_to_file("CountDown.log", "^"/^" symbol found at position %d: ^"%s^"", iPositionTemp, g_szSoThunderRoundStart[i][iPosition - 1])
  591. log_to_file("CountDown.log", "Remaining directories and sounds found: ^"%s^"", g_szSoThunderRoundStart[i][iPosition])
  592. log_to_file("CountDown.log", "")
  593. #endif
  594. }
  595.  
  596. if (iPosition)
  597. {
  598. formatex(szFolder, charsmax(szFolder), g_szSoThunderRoundStart[i])
  599. replace(szFolder, charsmax(szFolder), g_szSoThunderRoundStart[i][iPosition], "")
  600. }
  601.  
  602. #if defined g_bDebug
  603. log_to_file("CountDown.log", "Directory found: ^"%s^"", szFolder)
  604. log_to_file("CountDown.log", "Sounds found: ^"%s^"", g_szSoThunderRoundStart[i][iPosition])
  605. log_to_file("CountDown.log", "")
  606. #endif
  607.  
  608. while ((iPositionTemp = containi(g_szSoThunderRoundStart[i][iPosition], " ")) != -1)
  609. {
  610. #if defined g_bDebug
  611. log_to_file("CountDown.log", "Scanning ^"%s^" for ^" ^" symbols.", g_szSoThunderRoundStart[i][iPosition])
  612. #endif
  613.  
  614. formatex(szSound, charsmax(szSound), g_szSoThunderRoundStart[i][iPosition])
  615.  
  616. iPosition += iPositionTemp;
  617.  
  618. #if defined g_bDebug
  619. log_to_file("CountDown.log", "^" ^" symbol found at position %d: ^"%s^"", iPositionTemp, g_szSoThunderRoundStart[i][iPosition])
  620. #endif
  621.  
  622. replace(szSound, charsmax(szSound), g_szSoThunderRoundStart[i][iPosition], "")
  623.  
  624. #if defined g_bDebug
  625. log_to_file("CountDown.log", "Found sound: ^"%s^"", szSound)
  626. #endif
  627.  
  628. format(szSound, charsmax(szSound), "%s%s.wav", szFolder, szSound)
  629. engfunc(EngFunc_PrecacheSound, szSound)
  630.  
  631. #if defined g_bDebug
  632. log_to_file("CountDown.log", "Precaching sound: ^"%s^"", szSound)
  633. #endif
  634.  
  635. iPosition += 1;
  636.  
  637. #if defined g_bDebug
  638. log_to_file("CountDown.log", "Remaining sounds found: ^"%s^"", g_szSoThunderRoundStart[i][iPosition])
  639. log_to_file("CountDown.log", "")
  640. #endif
  641. }
  642.  
  643. formatex(szSound, charsmax(szSound), "%s%s.wav", szFolder, g_szSoThunderRoundStart[i][iPosition])
  644. engfunc(EngFunc_PrecacheSound, szSound)
  645.  
  646. #if defined g_bDebug
  647. log_to_file("CountDown.log", "Precaching sound: ^"%s^"", szSound)
  648. log_to_file("CountDown.log", "")
  649. #endif
  650. }
  651. }
  652. }
  653.  
  654. for (i = 0; i <= g_iSizeSoundsCountdown; i++)
  655. {
  656. if (!g_szSoCountdown[i][0])
  657. continue;
  658.  
  659. if (ftSoundIsMp3(g_szSoCountdown[i]))
  660. {
  661. formatex(szSound, charsmax(szSound), "sound/%s", g_szSoCountdown[i])
  662.  
  663. engfunc(EngFunc_PrecacheGeneric, szSound)
  664.  
  665. g_szSoCountdownIsMp3[i] = 1;
  666. }
  667. else
  668. {
  669. // Doesn't contain any spaces
  670. if (containi(g_szSoCountdown[i], " ") == -1)
  671. {
  672. formatex(szSound, charsmax(szSound), "%s.wav", g_szSoCountdown[i])
  673.  
  674. engfunc(EngFunc_PrecacheSound, szSound)
  675. }
  676. // Contains spaces
  677. else
  678. {
  679. iPosition = 0;
  680.  
  681. while ((iPositionTemp = containi(g_szSoCountdown[i][iPosition], "/")) != -1)
  682. {
  683. #if defined g_bDebug
  684. log_to_file("CountDown.log", "Scanning ^"%s^" for ^"/^" symbols.", g_szSoCountdown[i][iPosition])
  685. #endif
  686.  
  687. iPosition += iPositionTemp + 1;
  688.  
  689. #if defined g_bDebug
  690. log_to_file("CountDown.log", "^"/^" symbol found at position %d: ^"%s^"", iPositionTemp, g_szSoCountdown[i][iPosition - 1])
  691. log_to_file("CountDown.log", "Remaining directories and sounds found: ^"%s^"", g_szSoCountdown[i][iPosition])
  692. log_to_file("CountDown.log", "")
  693. #endif
  694. }
  695.  
  696. if (iPosition)
  697. {
  698. formatex(szFolder, charsmax(szFolder), g_szSoCountdown[i])
  699. replace(szFolder, charsmax(szFolder), g_szSoCountdown[i][iPosition], "")
  700. }
  701.  
  702. #if defined g_bDebug
  703. log_to_file("CountDown.log", "Directory found: ^"%s^"", szFolder)
  704. log_to_file("CountDown.log", "Sounds found: ^"%s^"", g_szSoCountdown[i][iPosition])
  705. log_to_file("CountDown.log", "")
  706. #endif
  707.  
  708. while ((iPositionTemp = containi(g_szSoCountdown[i][iPosition], " ")) != -1)
  709. {
  710. #if defined g_bDebug
  711. log_to_file("CountDown.log", "Scanning ^"%s^" for ^" ^" symbols.", g_szSoCountdown[i][iPosition])
  712. #endif
  713.  
  714. formatex(szSound, charsmax(szSound), g_szSoCountdown[i][iPosition])
  715.  
  716. iPosition += iPositionTemp;
  717.  
  718. #if defined g_bDebug
  719. log_to_file("CountDown.log", "^" ^" symbol found at position %d: ^"%s^"", iPositionTemp, g_szSoCountdown[i][iPosition])
  720. #endif
  721.  
  722. replace(szSound, charsmax(szSound), g_szSoCountdown[i][iPosition], "")
  723.  
  724. #if defined g_bDebug
  725. log_to_file("CountDown.log", "Found sound: ^"%s^"", szSound)
  726. #endif
  727.  
  728. format(szSound, charsmax(szSound), "%s%s.wav", szFolder, szSound)
  729. engfunc(EngFunc_PrecacheSound, szSound)
  730.  
  731. #if defined g_bDebug
  732. log_to_file("CountDown.log", "Precaching sound: ^"%s^"", szSound)
  733. #endif
  734.  
  735. iPosition += 1;
  736.  
  737. #if defined g_bDebug
  738. log_to_file("CountDown.log", "Remaining sounds found: ^"%s^"", g_szSoCountdown[i][iPosition])
  739. log_to_file("CountDown.log", "")
  740. #endif
  741. }
  742.  
  743. formatex(szSound, charsmax(szSound), "%s%s.wav", szFolder, g_szSoCountdown[i][iPosition])
  744. engfunc(EngFunc_PrecacheSound, szSound)
  745.  
  746. #if defined g_bDebug
  747. log_to_file("CountDown.log", "Precaching sound: ^"%s^"", szSound)
  748. log_to_file("CountDown.log", "")
  749. #endif
  750. }
  751. }
  752. }
  753.  
  754. for (i = 0; i <= g_iSizeSoundsModeStart; i++)
  755. {
  756. if (!g_szSoModeStart[i][0])
  757. continue;
  758.  
  759. if (ftSoundIsMp3(g_szSoModeStart[i]))
  760. {
  761. formatex(szSound, charsmax(szSound), "sound/%s", g_szSoModeStart[i])
  762.  
  763. engfunc(EngFunc_PrecacheGeneric, szSound)
  764.  
  765. g_szSoModeStartIsMp3[i] = 1;
  766. }
  767. else
  768. {
  769. // Doesn't contain any spaces
  770. if (containi(g_szSoModeStart[i], " ") == -1)
  771. {
  772. formatex(szSound, charsmax(szSound), "%s.wav", g_szSoModeStart[i])
  773.  
  774. engfunc(EngFunc_PrecacheSound, szSound)
  775. }
  776. // Contains spaces
  777. else
  778. {
  779. iPosition = 0;
  780.  
  781. while ((iPositionTemp = containi(g_szSoModeStart[i][iPosition], "/")) != -1)
  782. {
  783. #if defined g_bDebug
  784. log_to_file("CountDown.log", "Scanning ^"%s^" for ^"/^" symbols.", g_szSoModeStart[i][iPosition])
  785. #endif
  786.  
  787. iPosition += iPositionTemp + 1;
  788.  
  789. #if defined g_bDebug
  790. log_to_file("CountDown.log", "^"/^" symbol found at position %d: ^"%s^"", iPositionTemp, g_szSoModeStart[i][iPosition - 1])
  791. log_to_file("CountDown.log", "Remaining directories and sounds found: ^"%s^"", g_szSoModeStart[i][iPosition])
  792. log_to_file("CountDown.log", "")
  793. #endif
  794. }
  795.  
  796. if (iPosition)
  797. {
  798. formatex(szFolder, charsmax(szFolder), g_szSoModeStart[i])
  799. replace(szFolder, charsmax(szFolder), g_szSoModeStart[i][iPosition], "")
  800. }
  801.  
  802. #if defined g_bDebug
  803. log_to_file("CountDown.log", "Directory found: ^"%s^"", szFolder)
  804. log_to_file("CountDown.log", "Sounds found: ^"%s^"", g_szSoModeStart[i][iPosition])
  805. log_to_file("CountDown.log", "")
  806. #endif
  807.  
  808. while ((iPositionTemp = containi(g_szSoModeStart[i][iPosition], " ")) != -1)
  809. {
  810. #if defined g_bDebug
  811. log_to_file("CountDown.log", "Scanning ^"%s^" for ^" ^" symbols.", g_szSoModeStart[i][iPosition])
  812. #endif
  813.  
  814. formatex(szSound, charsmax(szSound), g_szSoModeStart[i][iPosition])
  815.  
  816. iPosition += iPositionTemp;
  817.  
  818. #if defined g_bDebug
  819. log_to_file("CountDown.log", "^" ^" symbol found at position %d: ^"%s^"", iPositionTemp, g_szSoModeStart[i][iPosition])
  820. #endif
  821.  
  822. replace(szSound, charsmax(szSound), g_szSoModeStart[i][iPosition], "")
  823.  
  824. #if defined g_bDebug
  825. log_to_file("CountDown.log", "Found sound: ^"%s^"", szSound)
  826. #endif
  827.  
  828. format(szSound, charsmax(szSound), "%s%s.wav", szFolder, szSound)
  829. engfunc(EngFunc_PrecacheSound, szSound)
  830.  
  831. #if defined g_bDebug
  832. log_to_file("CountDown.log", "Precaching sound: ^"%s^"", szSound)
  833. #endif
  834.  
  835. iPosition += 1;
  836.  
  837. #if defined g_bDebug
  838. log_to_file("CountDown.log", "Remaining sounds found: ^"%s^"", g_szSoModeStart[i][iPosition])
  839. log_to_file("CountDown.log", "")
  840. #endif
  841. }
  842.  
  843. formatex(szSound, charsmax(szSound), "%s%s.wav", szFolder, g_szSoModeStart[i][iPosition])
  844. engfunc(EngFunc_PrecacheSound, szSound)
  845.  
  846. #if defined g_bDebug
  847. log_to_file("CountDown.log", "Precaching sound: ^"%s^"", szSound)
  848. log_to_file("CountDown.log", "")
  849. #endif
  850. }
  851. }
  852. }
  853.  
  854. for (i = 0; i <= g_iSizeSoundsThunderModeStart; i++)
  855. {
  856. if (!g_szSoThunderModeStart[i][0])
  857. continue;
  858.  
  859. if (ftSoundIsMp3(g_szSoThunderModeStart[i]))
  860. {
  861. formatex(szSound, charsmax(szSound), "sound/%s", g_szSoThunderModeStart[i])
  862.  
  863. engfunc(EngFunc_PrecacheGeneric, szSound)
  864.  
  865. g_szSoThunderModeStartIsMp3[i] = 1;
  866. }
  867. else
  868. {
  869. // Doesn't contain any spaces
  870. if (containi(g_szSoThunderModeStart[i], " ") == -1)
  871. {
  872. formatex(szSound, charsmax(szSound), "%s.wav", g_szSoThunderModeStart[i])
  873.  
  874. engfunc(EngFunc_PrecacheSound, szSound)
  875. }
  876. // Contains spaces
  877. else
  878. {
  879. iPosition = 0;
  880.  
  881. while ((iPositionTemp = containi(g_szSoThunderModeStart[i][iPosition], "/")) != -1)
  882. {
  883. #if defined g_bDebug
  884. log_to_file("CountDown.log", "Scanning ^"%s^" for ^"/^" symbols.", g_szSoThunderModeStart[i][iPosition])
  885. #endif
  886.  
  887. iPosition += iPositionTemp + 1;
  888.  
  889. #if defined g_bDebug
  890. log_to_file("CountDown.log", "^"/^" symbol found at position %d: ^"%s^"", iPositionTemp, g_szSoThunderModeStart[i][iPosition - 1])
  891. log_to_file("CountDown.log", "Remaining directories and sounds found: ^"%s^"", g_szSoThunderModeStart[i][iPosition])
  892. log_to_file("CountDown.log", "")
  893. #endif
  894. }
  895.  
  896. if (iPosition)
  897. {
  898. formatex(szFolder, charsmax(szFolder), g_szSoThunderModeStart[i])
  899. replace(szFolder, charsmax(szFolder), g_szSoThunderModeStart[i][iPosition], "")
  900. }
  901.  
  902. #if defined g_bDebug
  903. log_to_file("CountDown.log", "Directory found: ^"%s^"", szFolder)
  904. log_to_file("CountDown.log", "Sounds found: ^"%s^"", g_szSoThunderModeStart[i][iPosition])
  905. log_to_file("CountDown.log", "")
  906. #endif
  907.  
  908. while ((iPositionTemp = containi(g_szSoThunderModeStart[i][iPosition], " ")) != -1)
  909. {
  910. #if defined g_bDebug
  911. log_to_file("CountDown.log", "Scanning ^"%s^" for ^" ^" symbols.", g_szSoThunderModeStart[i][iPosition])
  912. #endif
  913.  
  914. formatex(szSound, charsmax(szSound), g_szSoThunderModeStart[i][iPosition])
  915.  
  916. iPosition += iPositionTemp;
  917.  
  918. #if defined g_bDebug
  919. log_to_file("CountDown.log", "^" ^" symbol found at position %d: ^"%s^"", iPositionTemp, g_szSoThunderModeStart[i][iPosition])
  920. #endif
  921.  
  922. replace(szSound, charsmax(szSound), g_szSoThunderModeStart[i][iPosition], "")
  923.  
  924. #if defined g_bDebug
  925. log_to_file("CountDown.log", "Found sound: ^"%s^"", szSound)
  926. #endif
  927.  
  928. format(szSound, charsmax(szSound), "%s%s.wav", szFolder, szSound)
  929. engfunc(EngFunc_PrecacheSound, szSound)
  930.  
  931. #if defined g_bDebug
  932. log_to_file("CountDown.log", "Precaching sound: ^"%s^"", szSound)
  933. #endif
  934.  
  935. iPosition += 1;
  936.  
  937. #if defined g_bDebug
  938. log_to_file("CountDown.log", "Remaining sounds found: ^"%s^"", g_szSoThunderModeStart[i][iPosition])
  939. log_to_file("CountDown.log", "")
  940. #endif
  941. }
  942.  
  943. formatex(szSound, charsmax(szSound), "%s%s.wav", szFolder, g_szSoThunderModeStart[i][iPosition])
  944. engfunc(EngFunc_PrecacheSound, szSound)
  945.  
  946. #if defined g_bDebug
  947. log_to_file("CountDown.log", "Precaching sound: ^"%s^"", szSound)
  948. log_to_file("CountDown.log", "")
  949. #endif
  950. }
  951. }
  952. }
  953. }
Advertisement
Add Comment
Please, Sign In to add comment