L L4D2node

CL4DGameStats::FindOrCreateStatReport

0x008e0cb0 · 230 bytes · __thiscall

_ZN13CL4DGameStats22FindOrCreateStatReportEP13CTerrorPlayer

Decompiled

undefined (2 params)

/* CL4DGameStats::FindOrCreateStatReport(CTerrorPlayer*) */

int * __thiscall CL4DGameStats::FindOrCreateStatReport(CL4DGameStats *this,CTerrorPlayer *param_1)

{
  undefined4 *puVar1;
  int *piVar2;
  int iVar3;
  int iVar4;
  L4D_PlayerStatData *local_10 [2];
  
  if (param_1 == (CTerrorPlayer *)0x0) {
    local_10[0] = (L4D_PlayerStatData *)0x0;
  }
  else {
    local_10[0] = (L4D_PlayerStatData *)0x0;
    iVar3 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(param_1 + 0x30));
    if (CL4D_GameStats._916_2_ != -1) {
      puVar1 = (undefined4 *)(CL4D_GameStats._904_4_ + (uint)(ushort)CL4D_GameStats._916_2_ * 8);
      piVar2 = (int *)*puVar1;
      iVar4 = *piVar2;
      while( true ) {
        if (iVar4 == iVar3) {
          return piVar2;
        }
        if (*(ushort *)((int)puVar1 + 6) == 0xffff) break;
        puVar1 = (undefined4 *)(CL4D_GameStats._904_4_ + (uint)*(ushort *)((int)puVar1 + 6) * 8);
        piVar2 = (int *)*puVar1;
        iVar4 = *piVar2;
      }
    }
    if (local_10[0] == (L4D_PlayerStatData *)0x0) {
      local_10[0] = ::operator_new(0xa8);
      iVar4 = 0;
      do {
        *(undefined4 *)(local_10[0] + iVar4 * 4 + 8) = 0;
        iVar4 = iVar4 + 1;
      } while (iVar4 != 0x28);
      *(int *)(local_10[0] + 4) = 0;
      iVar4 = 0;
      do {
        *(undefined4 *)(local_10[0] + iVar4 * 4 + 8) = 0;
        iVar4 = iVar4 + 1;
      } while (iVar4 != 0x28);
      *(int *)local_10[0] = iVar3;
      CUtlLinkedList<L4D_PlayerStatData*,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<L4D_PlayerStatData*,unsigned_short>,unsigned_short>>
      ::InsertBefore((CUtlLinkedList<L4D_PlayerStatData*,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<L4D_PlayerStatData*,unsigned_short>,unsigned_short>>
                      *)(CL4D_GameStats + 0x388),0xffff,local_10);
    }
  }
  return (int *)local_10[0];
}

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)