From 1e1eed7242699e913ac6ac7c6c1f30ea5f7b8abf Mon Sep 17 00:00:00 2001 From: jenz Date: Sun, 4 Feb 2024 22:15:55 +0100 Subject: [PATCH] reset that one global int --- ZombieRiot/scripting/unloze_zr.sp | 163 +++++++++++++++--------------- 1 file changed, 83 insertions(+), 80 deletions(-) diff --git a/ZombieRiot/scripting/unloze_zr.sp b/ZombieRiot/scripting/unloze_zr.sp index 94f73903..556e01df 100644 --- a/ZombieRiot/scripting/unloze_zr.sp +++ b/ZombieRiot/scripting/unloze_zr.sp @@ -801,89 +801,92 @@ public Action AddDownloadContent() //---------------------------------------------------------------------------------------------------- public void LoadExtraSettings() { - Handle l_hFile = INVALID_HANDLE; - char l_cLine[g_dLength]; - if (!FileExists(g_cPathsExtra)) - { + g_iSoundIndexes = 0; //forgot to reset, would run out bounds as well. + + + Handle l_hFile = INVALID_HANDLE; + char l_cLine[g_dLength]; + if (!FileExists(g_cPathsExtra)) + { delete l_hFile; LogError("create a extrasettings.txt file!"); return; - } - l_hFile = OpenFile(g_cPathsExtra, "r"); - while (!IsEndOfFile(l_hFile) && ReadFileLine(l_hFile, l_cLine, sizeof(l_cLine))) - { - if (StrContains(l_cLine, "Respawn Time") > -1) - { - ReplaceStrings(l_cLine, "Respawn Time"); - if (StringToFloat(l_cLine) > 0.0) - g_fRespawnTimer = StringToFloat(l_cLine); - else - g_fRespawnTimer = 5.0; - } - if (StrContains(l_cLine, "Global command") > -1) - { - ReplaceStrings(l_cLine, "Global command"); - if (strlen(l_cLine) > 1) - ServerCommand(l_cLine); - } - if (StrContains(l_cLine, "round start zclass time") > -1) - { - ReplaceStrings(l_cLine, "round start zclass time"); - if (StringToFloat(l_cLine) > 0.0) - g_fSwitchingTimer = StringToFloat(l_cLine); - else - g_fSwitchingTimer = 15.0; - } - if (StrContains(l_cLine, "zm spawn protection") > -1) - { - ReplaceStrings(l_cLine, "zm spawn protection"); - if (StringToFloat(l_cLine) > 0.0) - g_fZMSpawnProtection = StringToFloat(l_cLine); - else - g_fZMSpawnProtection = 1.0; - } - if (StrContains(l_cLine, "human spawn protection") > -1) - { - ReplaceStrings(l_cLine, "human spawn protection"); - if (StringToFloat(l_cLine) > 0.0) - g_fHumanSpawnProtection = StringToFloat(l_cLine); - else - g_fHumanSpawnProtection = 4.0; - } - if (StrContains(l_cLine, "zmsoundInterval") > -1) - { - ReplaceStrings(l_cLine, "zmsoundInterval"); - if (StringToFloat(l_cLine) > 0.0) - g_fZMSounds = StringToFloat(l_cLine); - else - g_fZMSounds = 15.0; - } - if (StrContains(l_cLine, "botStuckCount") > -1) - { - ReplaceStrings(l_cLine, "botStuckCount"); - if (StringToInt(l_cLine) > 1) - g_iBotStuckCounts = StringToInt(l_cLine); - else - g_iBotStuckCounts = 3; - } - if (StrContains(l_cLine, "botStuckPush") > -1) - { - ReplaceStrings(l_cLine, "botStuckPush"); - if (StringToInt(l_cLine) > 1) - g_fBotStuckPush = StringToFloat(l_cLine); - else - g_fBotStuckPush = 250.0; - } - if (StrContains(l_cLine, "zmsoundsFile") > -1) - { - ReplaceStrings(l_cLine, "zmsoundsFile"); - ReplaceString(l_cLine, sizeof(l_cLine), "sound/", "*/"); - Format(g_cZMSounds[g_iSoundIndexes][g_iLength], sizeof(g_cZMSounds), l_cLine); - FakePrecacheSound(g_cZMSounds[g_iSoundIndexes][g_iLength]); - g_iSoundIndexes++; - } - } - delete l_hFile; + } + l_hFile = OpenFile(g_cPathsExtra, "r"); + while (!IsEndOfFile(l_hFile) && ReadFileLine(l_hFile, l_cLine, sizeof(l_cLine))) + { + if (StrContains(l_cLine, "Respawn Time") > -1) + { + ReplaceStrings(l_cLine, "Respawn Time"); + if (StringToFloat(l_cLine) > 0.0) + g_fRespawnTimer = StringToFloat(l_cLine); + else + g_fRespawnTimer = 5.0; + } + if (StrContains(l_cLine, "Global command") > -1) + { + ReplaceStrings(l_cLine, "Global command"); + if (strlen(l_cLine) > 1) + ServerCommand(l_cLine); + } + if (StrContains(l_cLine, "round start zclass time") > -1) + { + ReplaceStrings(l_cLine, "round start zclass time"); + if (StringToFloat(l_cLine) > 0.0) + g_fSwitchingTimer = StringToFloat(l_cLine); + else + g_fSwitchingTimer = 15.0; + } + if (StrContains(l_cLine, "zm spawn protection") > -1) + { + ReplaceStrings(l_cLine, "zm spawn protection"); + if (StringToFloat(l_cLine) > 0.0) + g_fZMSpawnProtection = StringToFloat(l_cLine); + else + g_fZMSpawnProtection = 1.0; + } + if (StrContains(l_cLine, "human spawn protection") > -1) + { + ReplaceStrings(l_cLine, "human spawn protection"); + if (StringToFloat(l_cLine) > 0.0) + g_fHumanSpawnProtection = StringToFloat(l_cLine); + else + g_fHumanSpawnProtection = 4.0; + } + if (StrContains(l_cLine, "zmsoundInterval") > -1) + { + ReplaceStrings(l_cLine, "zmsoundInterval"); + if (StringToFloat(l_cLine) > 0.0) + g_fZMSounds = StringToFloat(l_cLine); + else + g_fZMSounds = 15.0; + } + if (StrContains(l_cLine, "botStuckCount") > -1) + { + ReplaceStrings(l_cLine, "botStuckCount"); + if (StringToInt(l_cLine) > 1) + g_iBotStuckCounts = StringToInt(l_cLine); + else + g_iBotStuckCounts = 3; + } + if (StrContains(l_cLine, "botStuckPush") > -1) + { + ReplaceStrings(l_cLine, "botStuckPush"); + if (StringToInt(l_cLine) > 1) + g_fBotStuckPush = StringToFloat(l_cLine); + else + g_fBotStuckPush = 250.0; + } + if (StrContains(l_cLine, "zmsoundsFile") > -1) + { + ReplaceStrings(l_cLine, "zmsoundsFile"); + ReplaceString(l_cLine, sizeof(l_cLine), "sound/", "*/"); + Format(g_cZMSounds[g_iSoundIndexes][g_iLength], sizeof(g_cZMSounds), l_cLine); + FakePrecacheSound(g_cZMSounds[g_iSoundIndexes][g_iLength]); + g_iSoundIndexes++; + } + } + delete l_hFile; } //---------------------------------------------------------------------------------------------------- // Purpose: