Add initial version of safety checks for CS:GO to attempt to avoid user GSLT bans.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user