Added game detection.

This commit is contained in:
Richard Helgeby 2012-08-22 12:42:30 +02:00
parent 5ccc735fd8
commit 393044aa87
2 changed files with 42 additions and 0 deletions

View File

@ -150,6 +150,8 @@ public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max)
*/
public OnPluginStart()
{
UpdateGameFolder();
// Forward event to modules.
LogInit(); // Doesn't depend on CVARs.
TranslationInit();

View File

@ -54,6 +54,46 @@ enum EligibleCondition
*/
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.
*