reset that one global int
This commit is contained in:
parent
b38426245c
commit
1e1eed7242
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user