L L4D2node

CCvarUtilities::IsValidToggleCommand

0x00128990 · 357 bytes · __thiscall

_ZN14CCvarUtilities20IsValidToggleCommandEPKc

Decompiled

undefined (2 params)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CCvarUtilities::IsValidToggleCommand(char const*) */

undefined4 __thiscall CCvarUtilities::IsValidToggleCommand(CCvarUtilities *this,char *param_1)

{
  char cVar1;
  int *piVar2;
  int iVar3;
  undefined1 *puVar4;
  undefined4 uVar5;
  undefined4 uVar6;
  
  piVar2 = (int *)(**(code **)(*g_pCVar + 0x30))(g_pCVar,param_1);
  if (piVar2 == (int *)0x0) {
    ConMsg("%s is not a valid cvar\n",param_1);
    return 0;
  }
  cVar1 = (**(code **)(*piVar2 + 0xc))(piVar2,2);
  if ((cVar1 != '\0') || (cVar1 = (**(code **)(*piVar2 + 0xc))(piVar2,0x10), cVar1 != '\0')) {
    return 0;
  }
  (**(code **)(*piVar2 + 0xc))(piVar2,0x40);
  (**(code **)(*piVar2 + 0xc))(piVar2,0x400000);
  cVar1 = (**(code **)(*piVar2 + 0xc))(piVar2,0x4000);
  if ((cVar1 == '\0') || (cVar1 = Host_IsSinglePlayerGame(), cVar1 != '\0')) goto LAB_00128a29;
  cVar1 = ConVar::IsFlagSet((ConVar *)sv_hosting_lobby,2);
  if (cVar1 == '\0') {
    puVar4 = sv_cheats;
LAB_00128ac5:
    if (*(int *)(*(int *)(puVar4 + 0x1c) + 0x30) != 0) goto LAB_00128a29;
  }
  else {
    if ((g_pMatchFramework == (int *)0x0) ||
       (iVar3 = (**(code **)(*g_pMatchFramework + 0x24))(g_pMatchFramework), iVar3 == 0)) {
      puVar4 = sv_cheats;
    }
    else {
      puVar4 = (undefined1 *)0x0;
    }
    if (((DAT_003b80d0 == 0 && _DAT_003b80cc == 0) &&
        (*(int *)(sv_hosting_lobby._28_4_ + 0x30) == 0)) && (puVar4 != (undefined1 *)0x0))
    goto LAB_00128ac5;
  }
  uVar5 = Cmd_IsRptActive();
  if ((char)uVar5 == '\0') {
    uVar6 = (**(code **)(*piVar2 + 0x1c))(piVar2);
    ConMsg("Can\'t use cheat cvar %s in multiplayer, unless the server has sv_cheats set to 1.\n",
           uVar6);
    return uVar5;
  }
LAB_00128a29:
  (**(code **)(*piVar2 + 0xc))(piVar2,0x2000);
  return 1;
}

SourceMod gamedata

paste into addons/sourcemod/gamedata/<your_plugin>.txt
used as the SourceMod key — change to fit your plugin's convention
SourceMod library name (server / engine / matchmaking)

Just a Signatures{} block, ready to drop into a gamedata file. Wire it up in your plugin however you like - SDKCall, DHooks, raw memory ops, or anything else.



        

        

          

Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.

Return-type handling cheatsheet (DHookReturn)