Add initial version of safety checks for CS:GO to attempt to avoid user GSLT bans.

This commit is contained in:
Nicholas Hastings
2016-03-02 15:25:01 -05:00
parent 7bd1ed2339
commit b65de29c92
7 changed files with 124 additions and 0 deletions
+9
View File
@@ -170,6 +170,15 @@ bool SDKTools::SDK_OnLoad(char *error, size_t maxlength, bool late)
InitSDKToolsAPI();
#if SOURCE_ENGINE == SE_CSGO
m_bFollowCSGOServerGuidelines = true;
const char *pszValue = g_pSM->GetCoreConfigValue("FollowCSGOServerGuidelines");
if (pszValue && strcasecmp(pszValue, "no") == 0)
{
m_bFollowCSGOServerGuidelines = false;
}
#endif
return true;
}
+2
View File
@@ -113,8 +113,10 @@ public:
void OnServerActivate(edict_t *pEdictList, int edictCount, int clientMax);
public:
bool HasAnyLevelInited() { return m_bAnyLevelInited; }
bool ShouldFollowCSGOServerGuidelines() const { return m_bFollowCSGOServerGuidelines; }
private:
bool m_bFollowCSGOServerGuidelines = false;
bool m_bAnyLevelInited = false;
};
+14
View File
@@ -144,6 +144,20 @@ static cell_t RemovePlayerItem(IPluginContext *pContext, const cell_t *params)
class CEconItemView;
static cell_t GiveNamedItem(IPluginContext *pContext, const cell_t *params)
{
if (g_SdkTools.ShouldFollowCSGOServerGuidelines())
{
char *pWeaponName;
pContext->LocalToString(params[2], &pWeaponName);
// Don't allow knives other than weapon_knife, weapon_knifegg, and wewapon_knife_t.
// Others follow pattern weapon_knife_*
size_t len = strlen(pWeaponName);
if (len >= 14 && strnicmp(pWeaponName, "weapon_knife_", 13) == 0 && !(pWeaponName[13] == 't' && pWeaponName[14] == '\0'))
{
return pContext->ThrowNativeError("Blocked giving of %s due to core.cfg option FollowCSGOServerGuidelines", pWeaponName);
}
}
static ValveCall *pCall = NULL;
if (!pCall)
{