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
+22
View File
@@ -93,6 +93,15 @@ enum PropFieldType
PropField_String_T, /**< Valid for Data fields. Read only! */
};
inline bool CanSetPropName(const char *pszPropName)
{
#if SOURCE_ENGINE == SE_CSGO
return g_HL2.CanSetCSGOEntProp(pszPropName);
#else
return true;
#endif
}
inline edict_t *BaseEntityToEdict(CBaseEntity *pEntity)
{
IServerUnknown *pUnk = (IServerUnknown *)pEntity;
@@ -1351,6 +1360,10 @@ static cell_t SetEntProp(IPluginContext *pContext, const cell_t *params)
case Prop_Send:
{
FIND_PROP_SEND(DPT_Int, "integer");
if (!CanSetPropName(prop))
{
return pContext->ThrowNativeError("Cannot set %s with \"FollowCSGOServerGuidelines\" option enabled.", prop);
}
// This isn't in CS:S yet, but will be, doesn't hurt to add now, and will save us a build later
#if SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS \
@@ -1503,6 +1516,10 @@ static cell_t SetEntPropFloat(IPluginContext *pContext, const cell_t *params)
case Prop_Send:
{
FIND_PROP_SEND(DPT_Float, "float");
if (!CanSetPropName(prop))
{
return pContext->ThrowNativeError("Cannot set %s with \"FollowCSGOServerGuidelines\" option enabled.", prop);
}
break;
}
default:
@@ -2088,6 +2105,11 @@ static cell_t SetEntPropString(IPluginContext *pContext, const cell_t *params)
}
}
if (!CanSetPropName(prop))
{
return pContext->ThrowNativeError("Cannot set %s with \"FollowCSGOServerGuidelines\" option enabled.", prop);
}
if (bIsStringIndex)
{
offset += (element * (td->fieldSizeInBytes / td->fieldSize));