Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- To do:
- T = needs testing
- X = done
- - = cancelled
- [X] latest zp43 and older support
- [X] zp5 support
- [X] speak instead of spk command so that the sound sentences won't overlap
- [X] optimize the way the sounds are played
- [T] zpa support
- [T] amxx >= 1.8.3 support
- [T] fix mp3 sounds not precaching or playing(add sound folder first)
- [T] only check for TASK_MAKEZOMBIE for zpnm, zpa, zp43 and lower
- [T] cache if sounds are mp3 instead of checking in file name all the time
- [T] play sound function check if there is any string and add option to use spk instead of speak
- [T] independent thunder effects
- [T] single thunder lightning task for both round and mode start
- [T] random thunder lightning counts
- [-] make sure the IDs of the pcvars are gotten on round start
- v1.7.1
- [T] fix countdown not showing on the first round after map change
- [T] fix wrong zp_lighting value being set on first round start with only 1 player
- v1.7.3
- [T] only manually trigger round start forward after 0.5 seconds if the running mod is 4 based
- [T] use spk instead of speak for countdown sentences
- (if sentence is too long, the sounds will overlap, but it's better left to the user's decision anyway)
- v1.7.5
- [T] fix 1 second delay causing runtime error
- v1.7.6
- [ ] full customization by external file(s)
- [ ] add more cvars for customizing
- [ ] fully customizable thunder effects
- [ ] custom countdown message(+color, position & effect) for each second
- [ ] custom round & mode start message
- [ ] ability to choose between dhud, hud, print_center, print_chat, print_notify and teammate aim info
- [ ] separate the thunder effects from the plugin?
- [ ] zp50 assassin mode support
- [ ] only remove lightning tasks on countdown start if effects cvar is 1 and current second has an assigned light level?
- [ ]
- */
- // Modules
- #include <amxmodx>
- #include <fakemeta>
- // Plug-in APIs
- // Uncomment the zombie plague mod version you want to use and comment the others
- //#include <zombieplague>
- //#include <zombie_plague_advance>
- #include <zombieplaguenightmare>
- //#include <zp50_gamemodes>
- // Stocks
- #if AMXX_VERSION_NUM <= 182
- #include <dhudmessage>
- #endif
- //#define g_bDebug;
- enum
- {
- g_iIDTaskLightningRoundStart = 75000,
- g_iIDTaskCountDownStart,
- g_iIDTaskCountDown,
- g_iIDTaskLightningModeStart
- }
- new const g_szSoRoundStart[][] =
- {
- ""
- }
- const g_iSizeSoundsRoundStart = sizeof g_szSoRoundStart - 1;
- new g_szSoRoundStartIsMp3[sizeof g_szSoRoundStart];
- new const g_szSoThunderRoundStart[][] =
- {
- "de_torn/torn_thndrstrike",
- "ambience/thunder_clap"
- }
- const g_iSizeSoundsThunderRoundStart = sizeof g_szSoThunderRoundStart - 1;
- new g_szSoThunderRoundStartIsMp3[sizeof g_szSoThunderRoundStart];
- new const g_szLightsThunderClapBright[][] =
- {
- "v", "w", "x", "y", "z"
- }
- const g_iSizeLightsThunderClapBright = sizeof g_szLightsThunderClapBright - 1;
- new const g_szLightsThunderClapDark[][] =
- {
- "a", "b", "c", "d", "e"
- }
- const g_iSizeLightsThunderClapDark = sizeof g_szLightsThunderClapDark - 1;
- new const g_szSoCountdown[][] =
- {
- "fvox/one",
- "fvox/two",
- "fvox/three",
- "fvox/four",
- "fvox/five",
- "fvox/six",
- "fvox/seven",
- "fvox/eight",
- "fvox/nine",
- "fvox/ten",
- /*
- "fvox/eleven",
- "fvox/twelve",
- "fvox/thirteen",
- "fvox/fourteen",
- */
- "", "", "", "",
- "fvox/fifteen seconds remaining",
- /*
- "fvox/sixteen",
- "fvox/seventeen",
- "fvox/eighteen",
- "fvox/nineteen",
- */
- "", "", "", "",
- "fvox/twenty seconds remaining",
- "", "", "", "",
- // "fvox/twentyfive",
- "",
- "", "", "", "",
- "fvox/thirty seconds remaining",
- "", "", "", "", "", "", "", "", "",
- // "fvox/fourty",
- "",
- "", "", "", "", "", "", "", "", "",
- // "fvox/fifty",
- "",
- "", "", "", "", "", "", "", "", "",
- "fvox/one minutes remaining",
- "", "", "", "", "", "", "", "", "",
- // "fvox/seventy",
- "",
- "", "", "", "", "", "", "", "", "",
- // "fvox/eighty",
- "",
- "", "", "", "", "", "", "", "", "",
- "fvox/one minutes thirty seconds remaining",
- // "fvox/ninety",
- "", "", "", "", "", "", "", "", "",
- // "fvox/onehundred",
- "",
- "", "", "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "", "",
- "fvox/two minutes remaining"
- }
- const g_iSizeSoundsCountdown = sizeof g_szSoCountdown - 1;
- new g_szSoCountdownIsMp3[sizeof g_szSoCountdown];
- new const g_szLightsCountdownLevels[][] =
- {
- "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m"
- }
- const g_iSizeLightsCountdownLevels = sizeof g_szLightsCountdownLevels - 1;
- new const g_szSoModeStart[][] =
- {
- "fvox/biohazard_detected"
- }
- const g_iSizeSoundsModeStart = sizeof g_szSoModeStart - 1;
- new g_szSoModeStartIsMp3[sizeof g_szSoModeStart];
- new const g_szSoThunderModeStart[][] =
- {
- "de_torn/torn_thndrstrike",
- "ambience/thunder_clap"
- }
- const g_iSizeSoundsThunderModeStart = sizeof g_szSoThunderModeStart - 1;
- new g_szSoThunderModeStartIsMp3[sizeof g_szSoThunderModeStart];
- new g_iIDPCvarEffects, g_iIDPCvarDelay, g_iIDPCvarLighting, g_iDelay, g_szLighting[2], g_iSeconds, g_iThunderLights;
- public plugin_init()
- {
- register_plugin("[ZPNM] Countdown Lights", "1.7.6", "D i 5 7 i n c T")
- register_dictionary("zpnm_countdown.txt")
- register_event("HLTV", "fwEvHLTVRoundStart", "a", "1=0", "2=0")
- g_iIDPCvarEffects = register_cvar("zpnm_countdown_effects", "1");
- }
- public plugin_cfg()
- {
- #if defined _zombieplaguenightmare_included || defined _zombie_plague_advance_included || defined _zombieplague_included
- g_iIDPCvarDelay = get_cvar_pointer("zp_delay");
- set_task(0.5, "fwEvHLTVRoundStart", g_iIDTaskCountDownStart)
- #else
- #if defined _zp50_gamemodes_included
- g_iIDPCvarDelay = get_cvar_pointer("zp_gamemode_delay");
- #endif
- #endif
- g_iIDPCvarLighting = get_cvar_pointer("zp_lighting");
- }
- stock ftSoundIsMp3(const szSound[])
- return equali(szSound[strlen(szSound) - 4], ".mp3");
- stock ftPlaySound(const iID = 0, const szSound[], bIsMp3 = -1, const bSpeak = 0)
- {
- if (!szSound[0])
- return;
- if (bIsMp3 < 0)
- bIsMp3 = ftSoundIsMp3(szSound);
- client_cmd(iID, "%s ^"%s%s^"", !bIsMp3 ? !bSpeak ? "spk" : "speak" : "mp3 play", !bIsMp3 ? "" : "sound/", szSound)
- }
- public fwEvHLTVRoundStart()
- {
- //if (!g_iIDPCvarDelay)
- //plugin_cfg();
- g_iDelay = floatround(get_pcvar_float(g_iIDPCvarDelay), floatround_floor);
- if (g_iDelay <= 0)
- return;
- remove_task(g_iIDTaskLightningRoundStart)
- remove_task(g_iIDTaskCountDownStart)
- remove_task(g_iIDTaskCountDown)
- remove_task(g_iIDTaskLightningModeStart)
- if (g_szLighting[0])
- {
- engfunc(EngFunc_LightStyle, 0, g_szLighting)
- set_pcvar_string(g_iIDPCvarLighting, g_szLighting);
- g_szLighting = "";
- }
- new iRandom;
- iRandom = random_num(0, g_iSizeSoundsRoundStart);
- ftPlaySound(_, g_szSoRoundStart[iRandom], g_szSoRoundStartIsMp3[iRandom], 1)
- #if defined _zombieplaguenightmare_included || defined _zombie_plague_advance_included || defined _zombieplague_included
- set_task(2.0, "fwTaskCountDownStart", g_iIDTaskCountDownStart)
- #else
- #if defined _zp50_gamemodes_included
- set_task(0.2, "fwTaskCountDownStart", g_iIDTaskCountDownStart)
- #endif
- #endif
- if (get_pcvar_num(g_iIDPCvarEffects))
- {
- get_pcvar_string(g_iIDPCvarLighting, g_szLighting, charsmax(g_szLighting))
- //set_pcvar_string(g_iIDPCvarLighting, "0")
- #if defined _zombieplaguenightmare_included || defined _zombie_plague_advance_included || defined _zombieplague_included
- while ((g_iThunderLights = random_num(5, 19)) % 2 == 0)
- {
- // Generate a random number until it's uneven
- }
- #else
- #if defined _zp50_gamemodes_included
- g_iThunderLights = 1
- #endif
- #endif
- fwTaskThunderLightning(g_iIDTaskLightningRoundStart)
- set_task(0.1, "fwTaskThunderLightning", g_iIDTaskLightningRoundStart, _, _, "b")
- iRandom = random_num(0, g_iSizeSoundsThunderRoundStart);
- ftPlaySound(0, g_szSoThunderRoundStart[iRandom], g_szSoThunderRoundStartIsMp3[iRandom])
- }
- }
- public fwTaskCountDownStart()
- {
- g_iSeconds = g_iDelay - 1;
- fwTaskCountDown(g_iIDTaskCountDown)
- if (g_iSeconds >= 0)
- set_task(1.0, "fwTaskCountDown", g_iIDTaskCountDown, _, _, "b")
- }
- public fwTaskThunderLightning(const iIDTask)
- {
- if (g_iThunderLights)
- {
- new iRandom;
- if (g_iThunderLights % 2 == 0)
- {
- iRandom = random_num(0, g_iSizeLightsThunderClapDark);
- engfunc(EngFunc_LightStyle, 0, g_szLightsThunderClapDark[iRandom])
- set_pcvar_string(g_iIDPCvarLighting, g_szLightsThunderClapDark[iRandom])
- }
- else
- {
- iRandom = random_num(0, g_iSizeLightsThunderClapBright);
- engfunc(EngFunc_LightStyle, 0, g_szLightsThunderClapBright[iRandom])
- set_pcvar_string(g_iIDPCvarLighting, g_szLightsThunderClapBright[iRandom])
- }
- g_iThunderLights--;
- }
- else
- {
- remove_task(iIDTask)
- if (iIDTask == g_iIDTaskLightningRoundStart && get_pcvar_num(g_iIDPCvarEffects))
- {
- if (g_iDelay - 1 > g_iSizeLightsCountdownLevels)
- {
- engfunc(EngFunc_LightStyle, 0, g_szLightsCountdownLevels[g_iSizeLightsCountdownLevels])
- set_pcvar_string(g_iIDPCvarLighting, g_szLightsCountdownLevels[g_iSizeLightsCountdownLevels])
- }
- else
- {
- engfunc(EngFunc_LightStyle, 0, g_szLightsCountdownLevels[g_iDelay - 1])
- set_pcvar_string(g_iIDPCvarLighting, g_szLightsCountdownLevels[g_iDelay - 1])
- }
- }
- else
- {
- if (!g_szLighting[0])
- return;
- engfunc(EngFunc_LightStyle, 0, g_szLighting)
- set_pcvar_string(g_iIDPCvarLighting, g_szLighting)
- g_szLighting = "";
- }
- }
- }
- public fwTaskCountDown(const iIDTask)
- {
- #if defined _zombieplaguenightmare_included || defined _zombie_plague_advance_included || defined _zombieplague_included
- // Check for the external "TASK_MAKEZOMBIE" from inside ZPNM, ZPA, <=ZP43
- if (!task_exists(3000, 1)) //2010
- #else
- #if defined _zp50_gamemodes_included
- // Check for the external "TASK_GAMEMODE" from inside ZP50
- if (!task_exists(100, 1))
- #endif
- #endif
- {
- remove_task(iIDTask)
- return;
- }
- if (g_iSeconds == g_iDelay - 1)
- {
- remove_task(g_iIDTaskLightningRoundStart)
- remove_task(g_iIDTaskLightningModeStart)
- }
- 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)
- show_dhudmessage(0, "%L", LANG_PLAYER, "ZPNM_COUNTDOWN", g_iSeconds + 1)
- if (g_iSeconds <= g_iSizeSoundsCountdown)
- ftPlaySound(0, g_szSoCountdown[g_iSeconds], g_szSoCountdownIsMp3[g_iSeconds])//, 1
- if (get_pcvar_num(g_iIDPCvarEffects))
- {
- if (g_iSeconds <= g_iSizeLightsCountdownLevels && g_szLightsCountdownLevels[g_iSeconds][0])
- {
- engfunc(EngFunc_LightStyle, 0, g_szLightsCountdownLevels[g_iSeconds])
- set_pcvar_string(g_iIDPCvarLighting, g_szLightsCountdownLevels[g_iSeconds])
- }
- }
- else
- {
- if (g_szLighting[0])
- {
- engfunc(EngFunc_LightStyle, 0, g_szLighting)
- set_pcvar_string(g_iIDPCvarLighting, g_szLighting)
- g_szLighting = "";
- }
- }
- g_iSeconds--
- if (g_iSeconds < 0)
- remove_task(iIDTask)
- }
- #if defined _zombieplaguenightmare_included || defined _zombie_plague_advance_included
- public zp_round_started(iIDMode)
- #endif
- #if defined _zombieplague_included
- public zp_round_started()
- #endif
- #if defined _zp50_gamemodes_included
- public zp_fw_gamemodes_start()
- #endif
- {
- remove_task(g_iIDTaskLightningRoundStart)
- remove_task(g_iIDTaskCountDownStart)
- remove_task(g_iIDTaskCountDown)
- remove_task(g_iIDTaskLightningModeStart)
- new iRandom;
- iRandom = random_num(0, g_iSizeSoundsModeStart);
- ftPlaySound(0, g_szSoModeStart[iRandom], g_szSoModeStartIsMp3[iRandom], 1)
- #if defined _zombieplaguenightmare_included || defined _zombie_plague_advance_included
- if (iIDMode == MODE_ASSASSIN)
- return;
- #endif
- if (!get_pcvar_num(g_iIDPCvarEffects))
- {
- if (g_szLighting[0])
- {
- engfunc(EngFunc_LightStyle, 0, g_szLighting)
- set_pcvar_string(g_iIDPCvarLighting, g_szLighting);
- g_szLighting = "";
- }
- return;
- }
- iRandom = random_num(0, g_iSizeSoundsThunderModeStart);
- ftPlaySound(0, g_szSoThunderModeStart[iRandom], g_szSoThunderModeStartIsMp3[iRandom])
- while ((g_iThunderLights = random_num(5, 19)) % 2 == 0)
- {
- // Generate a random number until it's uneven
- }
- fwTaskThunderLightning(g_iIDTaskLightningModeStart)
- set_task(0.1, "fwTaskThunderLightning", g_iIDTaskLightningModeStart, _, _, "b")
- }
- public plugin_precache()
- {
- new i, szSound[64], iPosition, iPositionTemp, szFolder[64];
- for (i = 0; i <= g_iSizeSoundsRoundStart; i++)
- {
- if (!g_szSoRoundStart[i][0])
- continue;
- if (ftSoundIsMp3(g_szSoRoundStart[i]))
- {
- formatex(szSound, charsmax(szSound), "sound/%s", g_szSoRoundStart[i])
- engfunc(EngFunc_PrecacheGeneric, szSound)
- g_szSoRoundStartIsMp3[i] = 1;
- }
- else
- {
- // Doesn't contain any spaces
- if (containi(g_szSoRoundStart[i], " ") == -1)
- {
- formatex(szSound, charsmax(szSound), "%s.wav", g_szSoRoundStart[i])
- engfunc(EngFunc_PrecacheSound, szSound)
- }
- // Contains spaces
- else
- {
- iPosition = 0;
- while ((iPositionTemp = containi(g_szSoRoundStart[i][iPosition], "/")) != -1)
- {
- #if defined g_bDebug
- log_to_file("CountDown.log", "Scanning ^"%s^" for ^"/^" symbols.", g_szSoRoundStart[i][iPosition])
- #endif
- iPosition += iPositionTemp + 1;
- #if defined g_bDebug
- log_to_file("CountDown.log", "^"/^" symbol found at position %d: ^"%s^"", iPositionTemp, g_szSoRoundStart[i][iPosition - 1])
- log_to_file("CountDown.log", "Remaining directories and sounds found: ^"%s^"", g_szSoRoundStart[i][iPosition])
- log_to_file("CountDown.log", "")
- #endif
- }
- if (iPosition)
- {
- formatex(szFolder, charsmax(szFolder), g_szSoRoundStart[i])
- replace(szFolder, charsmax(szFolder), g_szSoRoundStart[i][iPosition], "")
- }
- #if defined g_bDebug
- log_to_file("CountDown.log", "Directory found: ^"%s^"", szFolder)
- log_to_file("CountDown.log", "Sounds found: ^"%s^"", g_szSoRoundStart[i][iPosition])
- log_to_file("CountDown.log", "")
- #endif
- while ((iPositionTemp = containi(g_szSoRoundStart[i][iPosition], " ")) != -1)
- {
- #if defined g_bDebug
- log_to_file("CountDown.log", "Scanning ^"%s^" for ^" ^" symbols.", g_szSoRoundStart[i][iPosition])
- #endif
- formatex(szSound, charsmax(szSound), g_szSoRoundStart[i][iPosition])
- iPosition += iPositionTemp;
- #if defined g_bDebug
- log_to_file("CountDown.log", "^" ^" symbol found at position %d: ^"%s^"", iPositionTemp, g_szSoRoundStart[i][iPosition])
- #endif
- replace(szSound, charsmax(szSound), g_szSoRoundStart[i][iPosition], "")
- #if defined g_bDebug
- log_to_file("CountDown.log", "Found sound: ^"%s^"", szSound)
- #endif
- format(szSound, charsmax(szSound), "%s%s.wav", szFolder, szSound)
- engfunc(EngFunc_PrecacheSound, szSound)
- #if defined g_bDebug
- log_to_file("CountDown.log", "Precaching sound: ^"%s^"", szSound)
- #endif
- iPosition += 1;
- #if defined g_bDebug
- log_to_file("CountDown.log", "Remaining sounds found: ^"%s^"", g_szSoRoundStart[i][iPosition])
- log_to_file("CountDown.log", "")
- #endif
- }
- formatex(szSound, charsmax(szSound), "%s%s.wav", szFolder, g_szSoRoundStart[i][iPosition])
- engfunc(EngFunc_PrecacheSound, szSound)
- #if defined g_bDebug
- log_to_file("CountDown.log", "Precaching sound: ^"%s^"", szSound)
- log_to_file("CountDown.log", "")
- #endif
- }
- }
- }
- for (i = 0; i <= g_iSizeSoundsThunderRoundStart; i++)
- {
- if (!g_szSoThunderRoundStart[i][0])
- continue;
- if (ftSoundIsMp3(g_szSoThunderRoundStart[i]))
- {
- formatex(szSound, charsmax(szSound), "sound/%s", g_szSoThunderRoundStart[i])
- engfunc(EngFunc_PrecacheGeneric, szSound)
- g_szSoThunderRoundStartIsMp3[i] = 1;
- }
- else
- {
- // Doesn't contain any spaces
- if (containi(g_szSoThunderRoundStart[i], " ") == -1)
- {
- formatex(szSound, charsmax(szSound), "%s.wav", g_szSoThunderRoundStart[i])
- engfunc(EngFunc_PrecacheSound, szSound)
- }
- // Contains spaces
- else
- {
- iPosition = 0;
- while ((iPositionTemp = containi(g_szSoThunderRoundStart[i][iPosition], "/")) != -1)
- {
- #if defined g_bDebug
- log_to_file("CountDown.log", "Scanning ^"%s^" for ^"/^" symbols.", g_szSoThunderRoundStart[i][iPosition])
- #endif
- iPosition += iPositionTemp + 1;
- #if defined g_bDebug
- log_to_file("CountDown.log", "^"/^" symbol found at position %d: ^"%s^"", iPositionTemp, g_szSoThunderRoundStart[i][iPosition - 1])
- log_to_file("CountDown.log", "Remaining directories and sounds found: ^"%s^"", g_szSoThunderRoundStart[i][iPosition])
- log_to_file("CountDown.log", "")
- #endif
- }
- if (iPosition)
- {
- formatex(szFolder, charsmax(szFolder), g_szSoThunderRoundStart[i])
- replace(szFolder, charsmax(szFolder), g_szSoThunderRoundStart[i][iPosition], "")
- }
- #if defined g_bDebug
- log_to_file("CountDown.log", "Directory found: ^"%s^"", szFolder)
- log_to_file("CountDown.log", "Sounds found: ^"%s^"", g_szSoThunderRoundStart[i][iPosition])
- log_to_file("CountDown.log", "")
- #endif
- while ((iPositionTemp = containi(g_szSoThunderRoundStart[i][iPosition], " ")) != -1)
- {
- #if defined g_bDebug
- log_to_file("CountDown.log", "Scanning ^"%s^" for ^" ^" symbols.", g_szSoThunderRoundStart[i][iPosition])
- #endif
- formatex(szSound, charsmax(szSound), g_szSoThunderRoundStart[i][iPosition])
- iPosition += iPositionTemp;
- #if defined g_bDebug
- log_to_file("CountDown.log", "^" ^" symbol found at position %d: ^"%s^"", iPositionTemp, g_szSoThunderRoundStart[i][iPosition])
- #endif
- replace(szSound, charsmax(szSound), g_szSoThunderRoundStart[i][iPosition], "")
- #if defined g_bDebug
- log_to_file("CountDown.log", "Found sound: ^"%s^"", szSound)
- #endif
- format(szSound, charsmax(szSound), "%s%s.wav", szFolder, szSound)
- engfunc(EngFunc_PrecacheSound, szSound)
- #if defined g_bDebug
- log_to_file("CountDown.log", "Precaching sound: ^"%s^"", szSound)
- #endif
- iPosition += 1;
- #if defined g_bDebug
- log_to_file("CountDown.log", "Remaining sounds found: ^"%s^"", g_szSoThunderRoundStart[i][iPosition])
- log_to_file("CountDown.log", "")
- #endif
- }
- formatex(szSound, charsmax(szSound), "%s%s.wav", szFolder, g_szSoThunderRoundStart[i][iPosition])
- engfunc(EngFunc_PrecacheSound, szSound)
- #if defined g_bDebug
- log_to_file("CountDown.log", "Precaching sound: ^"%s^"", szSound)
- log_to_file("CountDown.log", "")
- #endif
- }
- }
- }
- for (i = 0; i <= g_iSizeSoundsCountdown; i++)
- {
- if (!g_szSoCountdown[i][0])
- continue;
- if (ftSoundIsMp3(g_szSoCountdown[i]))
- {
- formatex(szSound, charsmax(szSound), "sound/%s", g_szSoCountdown[i])
- engfunc(EngFunc_PrecacheGeneric, szSound)
- g_szSoCountdownIsMp3[i] = 1;
- }
- else
- {
- // Doesn't contain any spaces
- if (containi(g_szSoCountdown[i], " ") == -1)
- {
- formatex(szSound, charsmax(szSound), "%s.wav", g_szSoCountdown[i])
- engfunc(EngFunc_PrecacheSound, szSound)
- }
- // Contains spaces
- else
- {
- iPosition = 0;
- while ((iPositionTemp = containi(g_szSoCountdown[i][iPosition], "/")) != -1)
- {
- #if defined g_bDebug
- log_to_file("CountDown.log", "Scanning ^"%s^" for ^"/^" symbols.", g_szSoCountdown[i][iPosition])
- #endif
- iPosition += iPositionTemp + 1;
- #if defined g_bDebug
- log_to_file("CountDown.log", "^"/^" symbol found at position %d: ^"%s^"", iPositionTemp, g_szSoCountdown[i][iPosition - 1])
- log_to_file("CountDown.log", "Remaining directories and sounds found: ^"%s^"", g_szSoCountdown[i][iPosition])
- log_to_file("CountDown.log", "")
- #endif
- }
- if (iPosition)
- {
- formatex(szFolder, charsmax(szFolder), g_szSoCountdown[i])
- replace(szFolder, charsmax(szFolder), g_szSoCountdown[i][iPosition], "")
- }
- #if defined g_bDebug
- log_to_file("CountDown.log", "Directory found: ^"%s^"", szFolder)
- log_to_file("CountDown.log", "Sounds found: ^"%s^"", g_szSoCountdown[i][iPosition])
- log_to_file("CountDown.log", "")
- #endif
- while ((iPositionTemp = containi(g_szSoCountdown[i][iPosition], " ")) != -1)
- {
- #if defined g_bDebug
- log_to_file("CountDown.log", "Scanning ^"%s^" for ^" ^" symbols.", g_szSoCountdown[i][iPosition])
- #endif
- formatex(szSound, charsmax(szSound), g_szSoCountdown[i][iPosition])
- iPosition += iPositionTemp;
- #if defined g_bDebug
- log_to_file("CountDown.log", "^" ^" symbol found at position %d: ^"%s^"", iPositionTemp, g_szSoCountdown[i][iPosition])
- #endif
- replace(szSound, charsmax(szSound), g_szSoCountdown[i][iPosition], "")
- #if defined g_bDebug
- log_to_file("CountDown.log", "Found sound: ^"%s^"", szSound)
- #endif
- format(szSound, charsmax(szSound), "%s%s.wav", szFolder, szSound)
- engfunc(EngFunc_PrecacheSound, szSound)
- #if defined g_bDebug
- log_to_file("CountDown.log", "Precaching sound: ^"%s^"", szSound)
- #endif
- iPosition += 1;
- #if defined g_bDebug
- log_to_file("CountDown.log", "Remaining sounds found: ^"%s^"", g_szSoCountdown[i][iPosition])
- log_to_file("CountDown.log", "")
- #endif
- }
- formatex(szSound, charsmax(szSound), "%s%s.wav", szFolder, g_szSoCountdown[i][iPosition])
- engfunc(EngFunc_PrecacheSound, szSound)
- #if defined g_bDebug
- log_to_file("CountDown.log", "Precaching sound: ^"%s^"", szSound)
- log_to_file("CountDown.log", "")
- #endif
- }
- }
- }
- for (i = 0; i <= g_iSizeSoundsModeStart; i++)
- {
- if (!g_szSoModeStart[i][0])
- continue;
- if (ftSoundIsMp3(g_szSoModeStart[i]))
- {
- formatex(szSound, charsmax(szSound), "sound/%s", g_szSoModeStart[i])
- engfunc(EngFunc_PrecacheGeneric, szSound)
- g_szSoModeStartIsMp3[i] = 1;
- }
- else
- {
- // Doesn't contain any spaces
- if (containi(g_szSoModeStart[i], " ") == -1)
- {
- formatex(szSound, charsmax(szSound), "%s.wav", g_szSoModeStart[i])
- engfunc(EngFunc_PrecacheSound, szSound)
- }
- // Contains spaces
- else
- {
- iPosition = 0;
- while ((iPositionTemp = containi(g_szSoModeStart[i][iPosition], "/")) != -1)
- {
- #if defined g_bDebug
- log_to_file("CountDown.log", "Scanning ^"%s^" for ^"/^" symbols.", g_szSoModeStart[i][iPosition])
- #endif
- iPosition += iPositionTemp + 1;
- #if defined g_bDebug
- log_to_file("CountDown.log", "^"/^" symbol found at position %d: ^"%s^"", iPositionTemp, g_szSoModeStart[i][iPosition - 1])
- log_to_file("CountDown.log", "Remaining directories and sounds found: ^"%s^"", g_szSoModeStart[i][iPosition])
- log_to_file("CountDown.log", "")
- #endif
- }
- if (iPosition)
- {
- formatex(szFolder, charsmax(szFolder), g_szSoModeStart[i])
- replace(szFolder, charsmax(szFolder), g_szSoModeStart[i][iPosition], "")
- }
- #if defined g_bDebug
- log_to_file("CountDown.log", "Directory found: ^"%s^"", szFolder)
- log_to_file("CountDown.log", "Sounds found: ^"%s^"", g_szSoModeStart[i][iPosition])
- log_to_file("CountDown.log", "")
- #endif
- while ((iPositionTemp = containi(g_szSoModeStart[i][iPosition], " ")) != -1)
- {
- #if defined g_bDebug
- log_to_file("CountDown.log", "Scanning ^"%s^" for ^" ^" symbols.", g_szSoModeStart[i][iPosition])
- #endif
- formatex(szSound, charsmax(szSound), g_szSoModeStart[i][iPosition])
- iPosition += iPositionTemp;
- #if defined g_bDebug
- log_to_file("CountDown.log", "^" ^" symbol found at position %d: ^"%s^"", iPositionTemp, g_szSoModeStart[i][iPosition])
- #endif
- replace(szSound, charsmax(szSound), g_szSoModeStart[i][iPosition], "")
- #if defined g_bDebug
- log_to_file("CountDown.log", "Found sound: ^"%s^"", szSound)
- #endif
- format(szSound, charsmax(szSound), "%s%s.wav", szFolder, szSound)
- engfunc(EngFunc_PrecacheSound, szSound)
- #if defined g_bDebug
- log_to_file("CountDown.log", "Precaching sound: ^"%s^"", szSound)
- #endif
- iPosition += 1;
- #if defined g_bDebug
- log_to_file("CountDown.log", "Remaining sounds found: ^"%s^"", g_szSoModeStart[i][iPosition])
- log_to_file("CountDown.log", "")
- #endif
- }
- formatex(szSound, charsmax(szSound), "%s%s.wav", szFolder, g_szSoModeStart[i][iPosition])
- engfunc(EngFunc_PrecacheSound, szSound)
- #if defined g_bDebug
- log_to_file("CountDown.log", "Precaching sound: ^"%s^"", szSound)
- log_to_file("CountDown.log", "")
- #endif
- }
- }
- }
- for (i = 0; i <= g_iSizeSoundsThunderModeStart; i++)
- {
- if (!g_szSoThunderModeStart[i][0])
- continue;
- if (ftSoundIsMp3(g_szSoThunderModeStart[i]))
- {
- formatex(szSound, charsmax(szSound), "sound/%s", g_szSoThunderModeStart[i])
- engfunc(EngFunc_PrecacheGeneric, szSound)
- g_szSoThunderModeStartIsMp3[i] = 1;
- }
- else
- {
- // Doesn't contain any spaces
- if (containi(g_szSoThunderModeStart[i], " ") == -1)
- {
- formatex(szSound, charsmax(szSound), "%s.wav", g_szSoThunderModeStart[i])
- engfunc(EngFunc_PrecacheSound, szSound)
- }
- // Contains spaces
- else
- {
- iPosition = 0;
- while ((iPositionTemp = containi(g_szSoThunderModeStart[i][iPosition], "/")) != -1)
- {
- #if defined g_bDebug
- log_to_file("CountDown.log", "Scanning ^"%s^" for ^"/^" symbols.", g_szSoThunderModeStart[i][iPosition])
- #endif
- iPosition += iPositionTemp + 1;
- #if defined g_bDebug
- log_to_file("CountDown.log", "^"/^" symbol found at position %d: ^"%s^"", iPositionTemp, g_szSoThunderModeStart[i][iPosition - 1])
- log_to_file("CountDown.log", "Remaining directories and sounds found: ^"%s^"", g_szSoThunderModeStart[i][iPosition])
- log_to_file("CountDown.log", "")
- #endif
- }
- if (iPosition)
- {
- formatex(szFolder, charsmax(szFolder), g_szSoThunderModeStart[i])
- replace(szFolder, charsmax(szFolder), g_szSoThunderModeStart[i][iPosition], "")
- }
- #if defined g_bDebug
- log_to_file("CountDown.log", "Directory found: ^"%s^"", szFolder)
- log_to_file("CountDown.log", "Sounds found: ^"%s^"", g_szSoThunderModeStart[i][iPosition])
- log_to_file("CountDown.log", "")
- #endif
- while ((iPositionTemp = containi(g_szSoThunderModeStart[i][iPosition], " ")) != -1)
- {
- #if defined g_bDebug
- log_to_file("CountDown.log", "Scanning ^"%s^" for ^" ^" symbols.", g_szSoThunderModeStart[i][iPosition])
- #endif
- formatex(szSound, charsmax(szSound), g_szSoThunderModeStart[i][iPosition])
- iPosition += iPositionTemp;
- #if defined g_bDebug
- log_to_file("CountDown.log", "^" ^" symbol found at position %d: ^"%s^"", iPositionTemp, g_szSoThunderModeStart[i][iPosition])
- #endif
- replace(szSound, charsmax(szSound), g_szSoThunderModeStart[i][iPosition], "")
- #if defined g_bDebug
- log_to_file("CountDown.log", "Found sound: ^"%s^"", szSound)
- #endif
- format(szSound, charsmax(szSound), "%s%s.wav", szFolder, szSound)
- engfunc(EngFunc_PrecacheSound, szSound)
- #if defined g_bDebug
- log_to_file("CountDown.log", "Precaching sound: ^"%s^"", szSound)
- #endif
- iPosition += 1;
- #if defined g_bDebug
- log_to_file("CountDown.log", "Remaining sounds found: ^"%s^"", g_szSoThunderModeStart[i][iPosition])
- log_to_file("CountDown.log", "")
- #endif
- }
- formatex(szSound, charsmax(szSound), "%s%s.wav", szFolder, g_szSoThunderModeStart[i][iPosition])
- engfunc(EngFunc_PrecacheSound, szSound)
- #if defined g_bDebug
- log_to_file("CountDown.log", "Precaching sound: ^"%s^"", szSound)
- log_to_file("CountDown.log", "")
- #endif
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment