Raised This Month: $32 Target: $400
 8% 

[ZP] Countdown


Post New Thread Reply   
 
Thread Tools Display Modes
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 12-11-2019 , 10:34   Re: [ZP] Countdown
Reply With Quote #11

PHP Code:
/*
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_iIDPCvarEffectsg_iIDPCvarDelayg_iIDPCvarLightingg_iDelayg_szLighting[2], g_iSecondsg_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_LightStyle0g_szLighting)
        
set_pcvar_string(g_iIDPCvarLightingg_szLighting);
        
        
g_szLighting "";
    }
    
    new 
iRandom;
    
    
iRandom random_num(0g_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_iIDPCvarLightingg_szLightingcharsmax(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(519)) % == 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(0g_iSizeSoundsThunderRoundStart);
        
        
ftPlaySound(0g_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 == 0)
        {
            
iRandom random_num(0g_iSizeLightsThunderClapDark);
            
            
engfunc(EngFunc_LightStyle0g_szLightsThunderClapDark[iRandom])
            
set_pcvar_string(g_iIDPCvarLightingg_szLightsThunderClapDark[iRandom])
        }
        else
        {
            
iRandom random_num(0g_iSizeLightsThunderClapBright);
            
            
engfunc(EngFunc_LightStyle0g_szLightsThunderClapBright[iRandom])
            
set_pcvar_string(g_iIDPCvarLightingg_szLightsThunderClapBright[iRandom])
        }
        
        
g_iThunderLights--;
    }
    else
    {
        
remove_task(iIDTask)
        
        if (
iIDTask == g_iIDTaskLightningRoundStart && get_pcvar_num(g_iIDPCvarEffects))
        {
            if (
g_iDelay g_iSizeLightsCountdownLevels)
            {
                
engfunc(EngFunc_LightStyle0g_szLightsCountdownLevels[g_iSizeLightsCountdownLevels])
                
set_pcvar_string(g_iIDPCvarLightingg_szLightsCountdownLevels[g_iSizeLightsCountdownLevels])
            }
            else
            {
                
engfunc(EngFunc_LightStyle0g_szLightsCountdownLevels[g_iDelay 1])
                
set_pcvar_string(g_iIDPCvarLightingg_szLightsCountdownLevels[g_iDelay 1])
            }
        }
        else
        {
            if (!
g_szLighting[0])
                return;
            
            
engfunc(EngFunc_LightStyle0g_szLighting)
            
set_pcvar_string(g_iIDPCvarLightingg_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(30001)) //2010
    #else
    #if defined _zp50_gamemodes_included
    // Check for the external "TASK_GAMEMODE" from inside ZP50
    
if (!task_exists(1001))
    
#endif
    #endif
    
{
        
remove_task(iIDTask)
        
        return;
    }
    
    if (
g_iSeconds == g_iDelay 1)
    {
        
remove_task(g_iIDTaskLightningRoundStart)
        
remove_task(g_iIDTaskLightningModeStart)
    }
    
    
set_dhudmessage(random_num(57255), random_num(0255), random_num(0255), -1.00.397521.11.10.00.0)
    
show_dhudmessage(0"%L"LANG_PLAYER"ZPNM_COUNTDOWN"g_iSeconds 1)
    
    if (
g_iSeconds <= g_iSizeSoundsCountdown)
        
ftPlaySound(0g_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_LightStyle0g_szLightsCountdownLevels[g_iSeconds])
            
set_pcvar_string(g_iIDPCvarLightingg_szLightsCountdownLevels[g_iSeconds])
        }
    }
    else
    {
        if (
g_szLighting[0])
        {
            
engfunc(EngFunc_LightStyle0g_szLighting)
            
set_pcvar_string(g_iIDPCvarLightingg_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(0g_iSizeSoundsModeStart);
    
ftPlaySound(0g_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_LightStyle0g_szLighting)
            
set_pcvar_string(g_iIDPCvarLightingg_szLighting);
            
            
g_szLighting "";
        }
        
        return;
    }
    
    
iRandom random_num(0g_iSizeSoundsThunderModeStart);
    
ftPlaySound(0g_szSoThunderModeStart[iRandom], g_szSoThunderModeStartIsMp3[iRandom])
    
    while ((
g_iThunderLights random_num(519)) % == 0)
    {
        
// Generate a random number until it's uneven
    
}
    
    
fwTaskThunderLightning(g_iIDTaskLightningModeStart)
    
set_task(0.1"fwTaskThunderLightning"g_iIDTaskLightningModeStart__"b")
}

public 
plugin_precache()
{
    new 
iszSound[64], iPositioniPositionTempszFolder[64];
    
    for (
0<= g_iSizeSoundsRoundStarti++)
    {
        if (!
g_szSoRoundStart[i][0])
            continue;
        
        if (
ftSoundIsMp3(g_szSoRoundStart[i]))
        {
            
formatex(szSoundcharsmax(szSound), "sound/%s"g_szSoRoundStart[i])
            
            
engfunc(EngFunc_PrecacheGenericszSound)
            
            
g_szSoRoundStartIsMp3[i] = 1;
        }
        else
        {
            
// Doesn't contain any spaces
            
if (containi(g_szSoRoundStart[i], " ") == -1)
            {
                
formatex(szSoundcharsmax(szSound), "%s.wav"g_szSoRoundStart[i])
                
                
engfunc(EngFunc_PrecacheSoundszSound)
            }
            
// 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^""iPositionTempg_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(szFoldercharsmax(szFolder), g_szSoRoundStart[i])
                    
replace(szFoldercharsmax(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(szSoundcharsmax(szSound), g_szSoRoundStart[i][iPosition])
                    
                    
iPosition += iPositionTemp;
                    
                    
#if defined g_bDebug
                    
log_to_file("CountDown.log""^" ^" symbol found at position %d: ^"%s^""iPositionTempg_szSoRoundStart[i][iPosition])
                    
#endif
                    
                    
replace(szSoundcharsmax(szSound), g_szSoRoundStart[i][iPosition], "")
                    
                    
#if defined g_bDebug
                    
log_to_file("CountDown.log""Found sound: ^"%s^""szSound)
                    
#endif
                    
                    
format(szSoundcharsmax(szSound), "%s%s.wav"szFolderszSound)
                    
engfunc(EngFunc_PrecacheSoundszSound)
                    
                    
#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(szSoundcharsmax(szSound), "%s%s.wav"szFolderg_szSoRoundStart[i][iPosition])
                
engfunc(EngFunc_PrecacheSoundszSound)
                
                
#if defined g_bDebug
                
log_to_file("CountDown.log""Precaching sound: ^"%s^""szSound)
                
log_to_file("CountDown.log""")
                
#endif
            
}
        }
    }
    
    for (
0<= g_iSizeSoundsThunderRoundStarti++)
    {
        if (!
g_szSoThunderRoundStart[i][0])
            continue;
        
        if (
ftSoundIsMp3(g_szSoThunderRoundStart[i]))
        {
            
formatex(szSoundcharsmax(szSound), "sound/%s"g_szSoThunderRoundStart[i])
            
            
engfunc(EngFunc_PrecacheGenericszSound)
            
            
g_szSoThunderRoundStartIsMp3[i] = 1;
        }
        else
        {
            
// Doesn't contain any spaces
            
if (containi(g_szSoThunderRoundStart[i], " ") == -1)
            {
                
formatex(szSoundcharsmax(szSound), "%s.wav"g_szSoThunderRoundStart[i])
                
                
engfunc(EngFunc_PrecacheSoundszSound)
            }
            
// 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^""iPositionTempg_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(szFoldercharsmax(szFolder), g_szSoThunderRoundStart[i])
                    
replace(szFoldercharsmax(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(szSoundcharsmax(szSound), g_szSoThunderRoundStart[i][iPosition])
                    
                    
iPosition += iPositionTemp;
                    
                    
#if defined g_bDebug
                    
log_to_file("CountDown.log""^" ^" symbol found at position %d: ^"%s^""iPositionTempg_szSoThunderRoundStart[i][iPosition])
                    
#endif
                    
                    
replace(szSoundcharsmax(szSound), g_szSoThunderRoundStart[i][iPosition], "")
                    
                    
#if defined g_bDebug
                    
log_to_file("CountDown.log""Found sound: ^"%s^""szSound)
                    
#endif
                    
                    
format(szSoundcharsmax(szSound), "%s%s.wav"szFolderszSound)
                    
engfunc(EngFunc_PrecacheSoundszSound)
                    
                    
#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(szSoundcharsmax(szSound), "%s%s.wav"szFolderg_szSoThunderRoundStart[i][iPosition])
                
engfunc(EngFunc_PrecacheSoundszSound)
                
                
#if defined g_bDebug
                
log_to_file("CountDown.log""Precaching sound: ^"%s^""szSound)
                
log_to_file("CountDown.log""")
                
#endif
            
}
        }
    }
    
    for (
0<= g_iSizeSoundsCountdowni++)
    {
        if (!
g_szSoCountdown[i][0])
            continue;
        
        if (
ftSoundIsMp3(g_szSoCountdown[i]))
        {
            
formatex(szSoundcharsmax(szSound), "sound/%s"g_szSoCountdown[i])
            
            
engfunc(EngFunc_PrecacheGenericszSound)
            
            
g_szSoCountdownIsMp3[i] = 1;
        }
        else
        {
            
// Doesn't contain any spaces
            
if (containi(g_szSoCountdown[i], " ") == -1)
            {
                
formatex(szSoundcharsmax(szSound), "%s.wav"g_szSoCountdown[i])
                
                
engfunc(EngFunc_PrecacheSoundszSound)
            }
            
// 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^""iPositionTempg_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(szFoldercharsmax(szFolder), g_szSoCountdown[i])
                    
replace(szFoldercharsmax(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(szSoundcharsmax(szSound), g_szSoCountdown[i][iPosition])
                    
                    
iPosition += iPositionTemp;
                    
                    
#if defined g_bDebug
                    
log_to_file("CountDown.log""^" ^" symbol found at position %d: ^"%s^""iPositionTempg_szSoCountdown[i][iPosition])
                    
#endif
                    
                    
replace(szSoundcharsmax(szSound), g_szSoCountdown[i][iPosition], "")
                    
                    
#if defined g_bDebug
                    
log_to_file("CountDown.log""Found sound: ^"%s^""szSound)
                    
#endif
                    
                    
format(szSoundcharsmax(szSound), "%s%s.wav"szFolderszSound)
                    
engfunc(EngFunc_PrecacheSoundszSound)
                    
                    
#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(szSoundcharsmax(szSound), "%s%s.wav"szFolderg_szSoCountdown[i][iPosition])
                
engfunc(EngFunc_PrecacheSoundszSound)
                
                
#if defined g_bDebug
                
log_to_file("CountDown.log""Precaching sound: ^"%s^""szSound)
                
log_to_file("CountDown.log""")
                
#endif
            
}
        }
    }
    
    for (
0<= g_iSizeSoundsModeStarti++)
    {
        if (!
g_szSoModeStart[i][0])
            continue;
        
        if (
ftSoundIsMp3(g_szSoModeStart[i]))
        {
            
formatex(szSoundcharsmax(szSound), "sound/%s"g_szSoModeStart[i])
            
            
engfunc(EngFunc_PrecacheGenericszSound)
            
            
g_szSoModeStartIsMp3[i] = 1;
        }
        else
        {
            
// Doesn't contain any spaces
            
if (containi(g_szSoModeStart[i], " ") == -1)
            {
                
formatex(szSoundcharsmax(szSound), "%s.wav"g_szSoModeStart[i])
                
                
engfunc(EngFunc_PrecacheSoundszSound)
            }
            
// 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^""iPositionTempg_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(szFoldercharsmax(szFolder), g_szSoModeStart[i])
                    
replace(szFoldercharsmax(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(szSoundcharsmax(szSound), g_szSoModeStart[i][iPosition])
                    
                    
iPosition += iPositionTemp;
                    
                    
#if defined g_bDebug
                    
log_to_file("CountDown.log""^" ^" symbol found at position %d: ^"%s^""iPositionTempg_szSoModeStart[i][iPosition])
                    
#endif
                    
                    
replace(szSoundcharsmax(szSound), g_szSoModeStart[i][iPosition], "")
                    
                    
#if defined g_bDebug
                    
log_to_file("CountDown.log""Found sound: ^"%s^""szSound)
                    
#endif
                    
                    
format(szSoundcharsmax(szSound), "%s%s.wav"szFolderszSound)
                    
engfunc(EngFunc_PrecacheSoundszSound)
                    
                    
#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(szSoundcharsmax(szSound), "%s%s.wav"szFolderg_szSoModeStart[i][iPosition])
                
engfunc(EngFunc_PrecacheSoundszSound)
                
                
#if defined g_bDebug
                
log_to_file("CountDown.log""Precaching sound: ^"%s^""szSound)
                
log_to_file("CountDown.log""")
                
#endif
            
}
        }
    }
    
    for (
0<= g_iSizeSoundsThunderModeStarti++)
    {
        if (!
g_szSoThunderModeStart[i][0])
            continue;
        
        if (
ftSoundIsMp3(g_szSoThunderModeStart[i]))
        {
            
formatex(szSoundcharsmax(szSound), "sound/%s"g_szSoThunderModeStart[i])
            
            
engfunc(EngFunc_PrecacheGenericszSound)
            
            
g_szSoThunderModeStartIsMp3[i] = 1;
        }
        else
        {
            
// Doesn't contain any spaces
            
if (containi(g_szSoThunderModeStart[i], " ") == -1)
            {
                
formatex(szSoundcharsmax(szSound), "%s.wav"g_szSoThunderModeStart[i])
                
                
engfunc(EngFunc_PrecacheSoundszSound)
            }
            
// 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^""iPositionTempg_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(szFoldercharsmax(szFolder), g_szSoThunderModeStart[i])
                    
replace(szFoldercharsmax(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(szSoundcharsmax(szSound), g_szSoThunderModeStart[i][iPosition])
                    
                    
iPosition += iPositionTemp;
                    
                    
#if defined g_bDebug
                    
log_to_file("CountDown.log""^" ^" symbol found at position %d: ^"%s^""iPositionTempg_szSoThunderModeStart[i][iPosition])
                    
#endif
                    
                    
replace(szSoundcharsmax(szSound), g_szSoThunderModeStart[i][iPosition], "")
                    
                    
#if defined g_bDebug
                    
log_to_file("CountDown.log""Found sound: ^"%s^""szSound)
                    
#endif
                    
                    
format(szSoundcharsmax(szSound), "%s%s.wav"szFolderszSound)
                    
engfunc(EngFunc_PrecacheSoundszSound)
                    
                    
#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(szSoundcharsmax(szSound), "%s%s.wav"szFolderg_szSoThunderModeStart[i][iPosition])
                
engfunc(EngFunc_PrecacheSoundszSound)
                
                
#if defined g_bDebug
                
log_to_file("CountDown.log""Precaching sound: ^"%s^""szSound)
                
log_to_file("CountDown.log""")
                
#endif
            
}
        }
    }

__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 21:59.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode