Skip to content

Commit

Permalink
formatting and stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
ASpoonPlaysGames committed Sep 15, 2023
1 parent e7c5251 commit 74c756b
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions NorthstarDLL/shared/exploit_fixes/servercommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,24 @@ ON_DLL_LOAD("engine.dll", ServerCommands, (CModule module))
{
GetBaseLocalClient = module.Offset(0x78200).RCast<GetBaseLocalClientType>();

Cvar_ns_restrict_commands = new ConVar("ns_restrict_commands", "1", FCVAR_GAMEDLL, "", 0, 0, 0, 0, [](ConVar* cvar, const char* pOldValue, float flOldValue) {
Cvar_ns_restrict_commands = new ConVar(
"ns_restrict_commands",
"1",
FCVAR_GAMEDLL,
"Whether or not server/client commands should be restricted.",
false,
0,
false,
0,
[](ConVar * cvar, const char* pOldValue, float flOldValue)
{
// this callback runs even if there was no actual change, so filter that out
if (!strcmp(pOldValue, Cvar_ns_restrict_commands->GetString()))
return;

spdlog::info("ns_restrict_commands was changed from {} to {}", pOldValue, Cvar_ns_restrict_commands->GetString());

R2::Cbuf_AddText(
R2::Cbuf_GetCurrentPlayer(),
"disconnect \"Command restrictions were changed\"",
R2::cmd_source_t::kCommandSrcCode);
R2::Cbuf_AddText(R2::Cbuf_GetCurrentPlayer(), "disconnect \"Command restrictions were changed\"", R2::cmd_source_t::kCommandSrcCode);

bool shouldRestrict = Cvar_ns_restrict_commands->GetBool();
bool* localClientBase = (bool*)(*GetBaseLocalClient)();
Expand Down

0 comments on commit 74c756b

Please sign in to comment.