Add 2 CSGO gamerules netprops to CSGO blocklist if FollowCSGOServerGuidelines is enabled. (#514)

* Add m_bIsValveDS and m_bIsQuestEligible

* Fix compile
This commit is contained in:
WildCard65 2017-02-04 08:18:58 -05:00 committed by Nicholas Hastings
parent 9e27a867dd
commit 90b3df1181
3 changed files with 44 additions and 3 deletions

View File

@ -177,6 +177,9 @@ bool SDKTools::SDK_OnLoad(char *error, size_t maxlength, bool late)
{
m_bFollowCSGOServerGuidelines = false;
}
m_CSGOBadList.add("m_bIsValveDS");
m_CSGOBadList.add("m_bIsQuestEligible");
#endif
return true;

View File

@ -50,6 +50,10 @@
#include <convar.h>
#include <iserver.h>
#include <cdll_int.h>
#if SOURCE_ENGINE == SE_CSGO
#include <am-hashset.h>
#include <sm_stringhashmap.h>
#endif
#include "SoundEmitterSystem/isoundemittersystembase.h"
#if SOURCE_ENGINE >= SE_ORANGEBOX
@ -111,10 +115,15 @@ public:
void OnServerActivate(edict_t *pEdictList, int edictCount, int clientMax);
public:
bool HasAnyLevelInited() { return m_bAnyLevelInited; }
#if SOURCE_ENGINE == SE_CSGO
public:
bool ShouldFollowCSGOServerGuidelines() const { return m_bFollowCSGOServerGuidelines; }
bool CanSetCSGOEntProp(const char *pszPropName) { return !ShouldFollowCSGOServerGuidelines() || !m_CSGOBadList.has(pszPropName); }
private:
ke::HashSet<ke::AString, detail::StringHashMapPolicy> m_CSGOBadList;
bool m_bFollowCSGOServerGuidelines = false;
#endif
private:
bool m_bAnyLevelInited = false;
};

View File

@ -46,7 +46,7 @@ static CBaseEntity *FindEntityByNetClass(int start, const char *classname)
for (int i = start; i < maxEntities; i++)
{
edict_t *current = gamehelpers->EdictOfIndex(i);
if (current == NULL || current->IsFree())
if (current == NULL || current->IsFree())
continue;
IServerNetworkable *network = current->GetNetworkable();
@ -183,7 +183,8 @@ static cell_t GameRules_GetProp(IPluginContext *pContext, const cell_t *params)
bit_count = sizeof(int) * 8;
}
#endif
if (bit_count < 1)
if (bit_count < 1)
{
bit_count = params[2] * 8;
}
@ -240,6 +241,13 @@ static cell_t GameRules_SetProp(IPluginContext *pContext, const cell_t *params)
pContext->LocalToString(params[1], &prop);
#if SOURCE_ENGINE == SE_CSGO
if (!g_SdkTools.CanSetCSGOEntProp(prop))
{
return pContext->ThrowNativeError("Cannot set ent prop %s with core.cfg option \"FollowCSGOServerGuidelines\" enabled.", prop);
}
#endif
FIND_PROP_SEND(DPT_Int, "integer");
#if SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_TF2 \
@ -318,6 +326,13 @@ static cell_t GameRules_SetPropFloat(IPluginContext *pContext, const cell_t *par
pContext->LocalToString(params[1], &prop);
#if SOURCE_ENGINE == SE_CSGO
if (!g_SdkTools.CanSetCSGOEntProp(prop))
{
return pContext->ThrowNativeError("Cannot set ent prop %s with core.cfg option \"FollowCSGOServerGuidelines\" enabled.", prop);
}
#endif
FIND_PROP_SEND(DPT_Float, "float");
float newVal = sp_ctof(params[2]);
@ -376,6 +391,13 @@ static cell_t GameRules_SetPropEnt(IPluginContext *pContext, const cell_t *param
pContext->LocalToString(params[1], &prop);
#if SOURCE_ENGINE == SE_CSGO
if (!g_SdkTools.CanSetCSGOEntProp(prop))
{
return pContext->ThrowNativeError("Cannot set ent prop %s with core.cfg option \"FollowCSGOServerGuidelines\" enabled.", prop);
}
#endif
FIND_PROP_SEND(DPT_Int, "integer");
CBaseHandle &hndl = *(CBaseHandle *)((intptr_t)pGameRules + offset);
@ -451,6 +473,13 @@ static cell_t GameRules_SetPropVector(IPluginContext *pContext, const cell_t *pa
pContext->LocalToString(params[1], &prop);
#if SOURCE_ENGINE == SE_CSGO
if (!g_SdkTools.CanSetCSGOEntProp(prop))
{
return pContext->ThrowNativeError("Cannot set ent prop %s with core.cfg option \"FollowCSGOServerGuidelines\" enabled.", prop);
}
#endif
FIND_PROP_SEND(DPT_Vector, "vector");
Vector *v = (Vector *)((intptr_t)pGameRules + offset);