Skip to content

Commit

Permalink
Merge Use static intiailizer for sv_stateBagStrictMode ConVar (mr-666)
Browse files Browse the repository at this point in the history
  • Loading branch information
neptunium-cfx committed Feb 7, 2025
2 parents bfb85b3 + b5fa26b commit 0ec3c8f
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,10 @@ struct CommandObject
MSGPACK_DEFINE_MAP(name, resource, arity);
};

namespace fx
{
ConVar<bool> g_stateBagStrictMode("sv_stateBagStrictMode", ConVar_Replicated, false);
}

static InitFunction initFunction([] ()
{
static ConVar<bool> stateBagStrictModeVar("sv_stateBagStrictMode", ConVar_Replicated, false);

fx::ScriptEngine::RegisterNativeHandler("GET_CURRENT_RESOURCE_NAME", [] (fx::ScriptContext& context)
{
fx::OMPtr<IScriptRuntime> runtime;
Expand Down Expand Up @@ -366,7 +363,7 @@ static InitFunction initFunction([] ()
auto keySize = context.GetArgument<uint32_t>(3);
auto replicated = context.GetArgument<bool>(4);

if (replicated && fx::g_stateBagStrictMode.GetValue())
if (replicated && stateBagStrictModeVar.GetValue())
{
fx::scripting::Warningf("natives", "StateBags can't be modified from the client, because the StateBag strict mode is enabled. Disable it using setr sv_stateBagStrictMode false\n");
return;
Expand Down

0 comments on commit 0ec3c8f

Please sign in to comment.