adding game description and map name override

This commit is contained in:
neon 2020-01-20 18:46:33 +01:00
parent f0731ceee2
commit 5055096c86
2 changed files with 17 additions and 6 deletions

View File

@ -85,7 +85,9 @@ SMEXT_LINK(&g_Connect);
ConVar g_ConnectVersion("connect_version", SMEXT_CONF_VERSION, FCVAR_REPLICATED|FCVAR_NOTIFY, SMEXT_CONF_DESCRIPTION " Version");
ConVar g_SvNoSteam("sv_nosteam", "0", FCVAR_NOTIFY, "Disable steam validation and force steam authentication.");
ConVar g_SvForceSteam("sv_forcesteam", "0", FCVAR_NOTIFY, "Force steam authentication.");
ConVar g_SvLogging("sv_connect_logging", "1", FCVAR_NOTIFY, "Log connection checks");
ConVar g_SvLogging("sv_connect_logging", "0", FCVAR_NOTIFY, "Log connection checks.");
ConVar g_SvGameDesc("sv_gamedesc_override", "default", FCVAR_NOTIFY, "Overwrite the default game description. Set to 'default' to keep default description.");
ConVar g_SvMapName("sv_mapname_override", "default", FCVAR_NOTIFY, "Overwrite the map name. Set to 'default' to keep default name.");
ConVar *g_pSvVisibleMaxPlayers;
ConVar *g_pSvTags;
@ -577,8 +579,17 @@ void UpdateQueryCache()
{
CQueryCache::CInfo &info = g_QueryCache.info;
info.aHostNameLen = strlcpy(info.aHostName, iserver->GetName(), sizeof(info.aHostName));
info.aMapNameLen = strlcpy(info.aMapName, iserver->GetMapName(), sizeof(info.aMapName));
info.aGameDescriptionLen = strlcpy(info.aGameDescription, gamedll->GetGameDescription(), sizeof(info.aGameDescription));
if(strcmp(g_SvMapName.GetString(), "default") == 0)
info.aMapNameLen = strlcpy(info.aMapName, iserver->GetMapName(), sizeof(info.aMapName));
else
info.aMapNameLen = strlcpy(info.aMapName, g_SvMapName.GetString(), sizeof(info.aMapName));
if(strcmp(g_SvGameDesc.GetString(), "default") == 0)
info.aGameDescriptionLen = strlcpy(info.aGameDescription, gamedll->GetGameDescription(), sizeof(info.aGameDescription));
else
info.aGameDescriptionLen = strlcpy(info.aGameDescription, g_SvGameDesc.GetString(), sizeof(info.aGameDescription));
if(g_pSvVisibleMaxPlayers->GetInt() >= 0)
info.nMaxClients = g_pSvVisibleMaxPlayers->GetInt();
else
@ -1195,7 +1206,7 @@ void ConnectEvents::FireGameEvent(IGameEvent *event)
const bool bot = event->GetBool("bot");
const char *name = event->GetString("name");
if (g_SvLogging.GetInt())
g_pSM->LogMessage(myself, "player_connect(client=%d, userid=%d, bot=%d, name=%s)", client, userid, bot, name);

View File

@ -40,8 +40,8 @@
/* Basic information exposed publicly */
#define SMEXT_CONF_NAME "Connect"
#define SMEXT_CONF_DESCRIPTION "Forward for early connection"
#define SMEXT_CONF_VERSION "2.5-SANITY-CHECK"
#define SMEXT_CONF_AUTHOR "Asher \"asherkin\" Baker + BotoX"
#define SMEXT_CONF_VERSION "2.6-SANITY-CHECK"
#define SMEXT_CONF_AUTHOR "Asher \"asherkin\" Baker + BotoX + Neon"
#define SMEXT_CONF_URL "https://github.com/CSSZombieEscape/sm-ext-connect"
#define SMEXT_CONF_LOGTAG "CONNECT"
#define SMEXT_CONF_LICENSE "GPL"