Solution:
PHP Code:
g_cvASSGameMode = FindConVar("mp_gamemode");
g_cvASSGameType = FindConVar("sv_gametypes");
char sModeName[64];
g_cvASSGameMode.GetString(sModeName, sizeof(sModeName)); // Gets the size of the "mp_gamemode" string
if (StrEqual(sModeName, "coop", false)) // If the string equals "coop" mode
{
// Do stuff here
}
char sGameType[2049]; // Holds the amount of characters within a string (If for whatever reason a server owner wants to filter so many game modes through "sv_gametypes")
g_cvASSGameType.GetString(sGameType, sizeof(sGameType)); // Gets the size of the "sv_gametypes" string
char sTypes[64][32]; // First index = How many game modes buffer can hold, Second index = How many characters allowed for each game mode
ExplodeString(sGameType, ",", sTypes, sizeof(sTypes), sizeof(sTypes[])); // Separate game modes and stores them inside individual arrays
for (int iMode = 0; iMode < sizeof(sTypes); iMode++)
{
if (StrContains(sGameType, sTypes[iMode], false) != -1 && sTypes[iMode][0] != '\0') // If one of the arrays contains a game mode and it's not an empty array
{
// Do stuff here
}
}
__________________