Added game detection.
This commit is contained in:
parent
5ccc735fd8
commit
393044aa87
|
@ -150,6 +150,8 @@ public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max)
|
||||||
*/
|
*/
|
||||||
public OnPluginStart()
|
public OnPluginStart()
|
||||||
{
|
{
|
||||||
|
UpdateGameFolder();
|
||||||
|
|
||||||
// Forward event to modules.
|
// Forward event to modules.
|
||||||
LogInit(); // Doesn't depend on CVARs.
|
LogInit(); // Doesn't depend on CVARs.
|
||||||
TranslationInit();
|
TranslationInit();
|
||||||
|
|
|
@ -54,6 +54,46 @@ enum EligibleCondition
|
||||||
*/
|
*/
|
||||||
new bool:g_bZombieSpawned;
|
new bool:g_bZombieSpawned;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Supported games.
|
||||||
|
*/
|
||||||
|
enum Game
|
||||||
|
{
|
||||||
|
Game_Unknown = -1,
|
||||||
|
Game_CSS,
|
||||||
|
Game_CSGO
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Current game.
|
||||||
|
*/
|
||||||
|
new Game:g_game = Game_Unknown;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates g_game. Will log a warning if a unsupported game is detected.
|
||||||
|
*/
|
||||||
|
UpdateGameFolder()
|
||||||
|
{
|
||||||
|
new String:gameFolder[PLATFORM_MAX_PATH];
|
||||||
|
GetGameFolderName(gameFolder, sizeof(gameFolder));
|
||||||
|
|
||||||
|
if (StrEqual(gameFolder, "cstrike", false))
|
||||||
|
{
|
||||||
|
g_game = Game_CSS;
|
||||||
|
PrintToServer("Game detected: cstrike");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (StrEqual(gameFolder, "csgo", false))
|
||||||
|
{
|
||||||
|
g_game = Game_CSGO;
|
||||||
|
PrintToServer("Game detected: csgo");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
LogError("Warning: Zombie:Reloaded doesn't support this game: %s", gameFolder);
|
||||||
|
g_game = Game_Unknown;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to convert numbers to defined units.
|
* Function to convert numbers to defined units.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue
Block a user