Added a load-block for incorrect mods to TF2 and cstrike extensions.

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%402173
This commit is contained in:
Matt Woodrow 2008-05-24 04:08:29 +00:00
parent 13cf254f08
commit dea6b06e2c
2 changed files with 13 additions and 3 deletions

View File

@ -54,6 +54,12 @@ extern sp_nativeinfo_t g_CSNatives[];
bool CStrike::SDK_OnLoad(char *error, size_t maxlength, bool late)
{
if (strcmp(g_pSM->GetGameFolderName(), "cstrike") != 0)
{
snprintf(error, maxlength, "Cannot Load Cstrike Extension on mods other than CS:S");
return false;
}
sharesys->AddDependency(myself, "bintools.ext", true, true);
char conf_error[255];

View File

@ -63,11 +63,16 @@ SH_DECL_HOOK3_void(IServerGameDLL, ServerActivate, SH_NOATTRIB, 0, edict_t *, in
bool TF2Tools::SDK_OnLoad(char *error, size_t maxlength, bool late)
{
if (strcmp(g_pSM->GetGameFolderName(), "tf") != 0)
{
snprintf(error, maxlength, "Cannot Load TF2 Extension on mods other than TF2");
return false;
}
ServerClass *sc = UTIL_FindServerClass("CTFPlayer");
if (sc == NULL)
{
snprintf(error, maxlength, "Could not find CTFPlayer server class");
return false;
}
@ -76,7 +81,6 @@ bool TF2Tools::SDK_OnLoad(char *error, size_t maxlength, bool late)
if (!UTIL_FindDataTable(sc->m_pTable, "DT_TFPlayerShared", playerSharedOffset, 0))
{
snprintf(error, maxlength, "Could not find DT_TFPlayerShared data table");
return false;
}
@ -85,7 +89,7 @@ bool TF2Tools::SDK_OnLoad(char *error, size_t maxlength, bool late)
char conf_error[255];
if (!gameconfs->LoadGameConfigFile("sm-tf2.games", &g_pGameConf, conf_error, sizeof(conf_error)))
{
if (error)
if (conf_error)
{
snprintf(error, maxlength, "Could not read sm-tf2.games.txt: %s", conf_error);
}