L L4D2node

CBasePlayer::RemoveAllCommandContextsExceptNewest

0x007bad70 · 303 bytes · __thiscall

_ZN11CBasePlayer36RemoveAllCommandContextsExceptNewestEv

Decompiled

undefined (1 param)

/* CBasePlayer::RemoveAllCommandContextsExceptNewest() */

undefined4 __thiscall CBasePlayer::RemoveAllCommandContextsExceptNewest(CBasePlayer *this)

{
  int iVar1;
  int iVar2;
  undefined4 *puVar3;
  int iVar4;
  int iVar5;
  CUtlMemory<CUserCmd,int> *this_00;
  int iVar6;
  
  iVar2 = *(int *)(this + 0x1dcc);
  iVar4 = iVar2 + -1;
  if (0 < iVar4) {
    iVar2 = iVar2 + -2;
    iVar1 = iVar2 * 0x24;
    for (; iVar2 != -1; iVar2 = iVar2 + -1) {
      this_00 = (CUtlMemory<CUserCmd,int> *)(iVar1 + *(int *)(this + 0x1dc0));
      iVar5 = *(int *)(this_00 + 0xc) + -1;
      iVar6 = iVar5 * 0x58;
      if (-1 < iVar5) {
        do {
          iVar5 = iVar5 + -1;
          puVar3 = (undefined4 *)(*(int *)this_00 + iVar6);
          iVar6 = iVar6 + -0x58;
          (**(code **)*puVar3)(puVar3);
        } while (iVar5 != -1);
      }
      *(undefined4 *)(this_00 + 0xc) = 0;
      CUtlMemory<CUserCmd,int>::Purge(this_00);
      *(undefined4 *)(this_00 + 0x10) = *(undefined4 *)this_00;
      CUtlMemory<CUserCmd,int>::Purge(this_00);
      iVar1 = iVar1 + -0x24;
    }
    CUtlVector<CCommandContext,CUtlMemory<CCommandContext,int>>::ShiftElementsLeft
              ((CUtlVector<CCommandContext,CUtlMemory<CCommandContext,int>> *)(this + 0x1dc0),0,
               iVar4);
    iVar2 = *(int *)(this + 0x1dcc) - iVar4;
    *(int *)(this + 0x1dcc) = iVar2;
  }
  if (iVar2 == 0) {
    iVar4 = CUtlVector<CCommandContext,CUtlMemory<CCommandContext,int>>::InsertBefore
                      ((CUtlVector<CCommandContext,CUtlMemory<CCommandContext,int>> *)
                       (this + 0x1dc0),0);
    _V_memset((void *)(*(int *)(this + 0x1dc0) + iVar4 * 0x24),0,0x24);
  }
  return *(undefined4 *)(this + 0x1dc0);
}

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)