mirror of
https://github.com/dashr9230/SA-MP.git
synced 2024-12-22 22:47:29 +08:00
[server] Implement CNetGame::GetNextScriptFile()
This commit is contained in:
parent
b75e98217d
commit
2fecf6f0ae
@ -208,10 +208,42 @@ void CNetGame::LoadAllFilterscripts()
|
|||||||
logprintf(" Loaded %d filterscripts.\n", iScriptCount);
|
logprintf(" Loaded %d filterscripts.\n", iScriptCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------
|
||||||
|
// Handles rotation and setting of the current
|
||||||
|
// script file to be used. If szFile is NULL, it
|
||||||
|
// will attempt to rotate scripts as per configuration.
|
||||||
|
// returns FALSE if it was not able to set the script,
|
||||||
|
// true otherwise.
|
||||||
|
|
||||||
|
// Returns the name of the next gamemode
|
||||||
|
// Code taken from SetNextScriptFile but required by "gmx" (easiest way without major re-write)
|
||||||
|
char *CNetGame::GetNextScriptFile()
|
||||||
|
{
|
||||||
|
char *szTemp;
|
||||||
|
char szCurGameModeConsoleVar[64];
|
||||||
|
|
||||||
|
m_iCurrentGameModeIndex++;
|
||||||
|
|
||||||
|
sprintf(szCurGameModeConsoleVar,"gamemode%u",m_iCurrentGameModeIndex);
|
||||||
|
szTemp = strtok(pConsole->GetStringVariable(szCurGameModeConsoleVar), " ");
|
||||||
|
|
||||||
|
// if the var isn't there then cycle back to 0
|
||||||
|
if(!szTemp || !strlen(szTemp)) {
|
||||||
|
m_iCurrentGameModeIndex = 0;
|
||||||
|
sprintf(szCurGameModeConsoleVar,"gamemode%u",m_iCurrentGameModeIndex);
|
||||||
|
szTemp = strtok(pConsole->GetStringVariable(szCurGameModeConsoleVar), " ");
|
||||||
|
}
|
||||||
|
|
||||||
|
// if it's still NULL then we've got an error.
|
||||||
|
if(!szTemp || !strlen(szTemp)) return NULL;
|
||||||
|
return szTemp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//----------------------------------------------------
|
||||||
|
|
||||||
void CNetGame::Init(BOOL bFirst)
|
void CNetGame::Init(BOOL bFirst)
|
||||||
{
|
{
|
||||||
m_iSpawnsAvailable = 0;
|
m_iSpawnsAvailable = 0;
|
||||||
|
@ -80,6 +80,7 @@ public:
|
|||||||
CGameMode * GetGameMode() { return m_pGameMode; };
|
CGameMode * GetGameMode() { return m_pGameMode; };
|
||||||
CFilterScripts * GetFilterScripts() { return m_pFilterScripts; };
|
CFilterScripts * GetFilterScripts() { return m_pFilterScripts; };
|
||||||
|
|
||||||
|
char *GetNextScriptFile();
|
||||||
void LoadAllFilterscripts();
|
void LoadAllFilterscripts();
|
||||||
|
|
||||||
void Process();
|
void Process();
|
||||||
|
Loading…
Reference in New Issue
Block a user