Extend: support for running without gameover gamedata

This commit is contained in:
BotoX 2018-08-07 21:50:57 +02:00
parent 5fc9f08665
commit 0257c3d626

View File

@ -14,6 +14,7 @@ ConVar g_cvarMpFragLimit = null;
ConVar g_cvarMpWinLimit = null;
ConVar g_cvarMpTimeLimit = null;
bool g_bGameOver = false;
Address g_pGameOver;
public Plugin myinfo =
@ -71,17 +72,21 @@ public void OnPluginStart()
Handle hGameConf = LoadGameConfigFile("Extend.games");
if(hGameConf == INVALID_HANDLE)
{
SetFailState("Couldn't load Extend.games game config!");
g_bGameOver = false;
LogError("Couldn't load Extend.games game config! GameOver cancel disabled.");
return;
}
if(!(g_pGameOver = GameConfGetAddress(hGameConf, "GameOver")))
{
g_bGameOver = false;
CloseHandle(hGameConf);
SetFailState("Couldn't get GameOver address from game config!");
LogError("Couldn't get GameOver address from game config! GameOver cancel disabled.");
return;
}
CloseHandle(hGameConf);
g_bGameOver = true;
}
public Action Command_Extend_Rounds(int client, int argc)
@ -364,6 +369,9 @@ public int Handler_VoteCallback(Menu menu, MenuAction action, int param1, int pa
void CancelGameOver()
{
if (!g_bGameOver)
return;
StoreToAddress(g_pGameOver, 0, NumberType_Int8);
for (int client = 1; client <= MaxClients; client++)