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:
parent
9e27a867dd
commit
90b3df1181
@ -177,6 +177,9 @@ bool SDKTools::SDK_OnLoad(char *error, size_t maxlength, bool late)
|
|||||||
{
|
{
|
||||||
m_bFollowCSGOServerGuidelines = false;
|
m_bFollowCSGOServerGuidelines = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_CSGOBadList.add("m_bIsValveDS");
|
||||||
|
m_CSGOBadList.add("m_bIsQuestEligible");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -50,6 +50,10 @@
|
|||||||
#include <convar.h>
|
#include <convar.h>
|
||||||
#include <iserver.h>
|
#include <iserver.h>
|
||||||
#include <cdll_int.h>
|
#include <cdll_int.h>
|
||||||
|
#if SOURCE_ENGINE == SE_CSGO
|
||||||
|
#include <am-hashset.h>
|
||||||
|
#include <sm_stringhashmap.h>
|
||||||
|
#endif
|
||||||
#include "SoundEmitterSystem/isoundemittersystembase.h"
|
#include "SoundEmitterSystem/isoundemittersystembase.h"
|
||||||
|
|
||||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
@ -111,10 +115,15 @@ public:
|
|||||||
void OnServerActivate(edict_t *pEdictList, int edictCount, int clientMax);
|
void OnServerActivate(edict_t *pEdictList, int edictCount, int clientMax);
|
||||||
public:
|
public:
|
||||||
bool HasAnyLevelInited() { return m_bAnyLevelInited; }
|
bool HasAnyLevelInited() { return m_bAnyLevelInited; }
|
||||||
|
#if SOURCE_ENGINE == SE_CSGO
|
||||||
|
public:
|
||||||
bool ShouldFollowCSGOServerGuidelines() const { return m_bFollowCSGOServerGuidelines; }
|
bool ShouldFollowCSGOServerGuidelines() const { return m_bFollowCSGOServerGuidelines; }
|
||||||
|
bool CanSetCSGOEntProp(const char *pszPropName) { return !ShouldFollowCSGOServerGuidelines() || !m_CSGOBadList.has(pszPropName); }
|
||||||
private:
|
private:
|
||||||
|
ke::HashSet<ke::AString, detail::StringHashMapPolicy> m_CSGOBadList;
|
||||||
bool m_bFollowCSGOServerGuidelines = false;
|
bool m_bFollowCSGOServerGuidelines = false;
|
||||||
|
#endif
|
||||||
|
private:
|
||||||
bool m_bAnyLevelInited = false;
|
bool m_bAnyLevelInited = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ static CBaseEntity *FindEntityByNetClass(int start, const char *classname)
|
|||||||
for (int i = start; i < maxEntities; i++)
|
for (int i = start; i < maxEntities; i++)
|
||||||
{
|
{
|
||||||
edict_t *current = gamehelpers->EdictOfIndex(i);
|
edict_t *current = gamehelpers->EdictOfIndex(i);
|
||||||
if (current == NULL || current->IsFree())
|
if (current == NULL || current->IsFree())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
IServerNetworkable *network = current->GetNetworkable();
|
IServerNetworkable *network = current->GetNetworkable();
|
||||||
@ -183,7 +183,8 @@ static cell_t GameRules_GetProp(IPluginContext *pContext, const cell_t *params)
|
|||||||
bit_count = sizeof(int) * 8;
|
bit_count = sizeof(int) * 8;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (bit_count < 1)
|
|
||||||
|
if (bit_count < 1)
|
||||||
{
|
{
|
||||||
bit_count = params[2] * 8;
|
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);
|
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");
|
FIND_PROP_SEND(DPT_Int, "integer");
|
||||||
|
|
||||||
#if SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_TF2 \
|
#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);
|
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");
|
FIND_PROP_SEND(DPT_Float, "float");
|
||||||
|
|
||||||
float newVal = sp_ctof(params[2]);
|
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);
|
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");
|
FIND_PROP_SEND(DPT_Int, "integer");
|
||||||
|
|
||||||
CBaseHandle &hndl = *(CBaseHandle *)((intptr_t)pGameRules + offset);
|
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);
|
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");
|
FIND_PROP_SEND(DPT_Vector, "vector");
|
||||||
|
|
||||||
Vector *v = (Vector *)((intptr_t)pGameRules + offset);
|
Vector *v = (Vector *)((intptr_t)pGameRules + offset);
|
||||||
|
Loading…
Reference in New Issue
Block a user