L L4D2node

CBaseCombatCharacter::Weapon_GetSlot

0x003fe350 · 161 bytes · __thiscall

_ZNK20CBaseCombatCharacter14Weapon_GetSlotEi

Decompiled

undefined (2 params)

/* CBaseCombatCharacter::Weapon_GetSlot(int) const */

undefined4 __thiscall CBaseCombatCharacter::Weapon_GetSlot(CBaseCombatCharacter *this,int param_1)

{
  uint uVar1;
  int *piVar2;
  int iVar3;
  undefined *puVar4;
  CBaseCombatCharacter *pCVar5;
  int iVar6;
  
  iVar6 = 0;
  pCVar5 = this + 0x18f4;
  while ((((uVar1 = *(uint *)pCVar5, uVar1 == 0xffffffff ||
           (puVar4 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar4 == (undefined *)0xfffffffc)) ||
          (*(uint *)(puVar4 + 8) != uVar1 >> 0xc)) ||
         ((piVar2 = *(int **)(puVar4 + 4), piVar2 == (int *)0x0 ||
          (iVar3 = (**(code **)(*piVar2 + 0x530))(piVar2), param_1 != iVar3))))) {
    iVar6 = iVar6 + 1;
    pCVar5 = pCVar5 + 4;
    if (iVar6 == 0x38) {
      return 0;
    }
  }
  uVar1 = *(uint *)pCVar5;
  if (uVar1 == 0xffffffff) {
    return 0;
  }
  puVar4 = g_pEntityList + (uVar1 & 0xfff) * 0x10;
  if (puVar4 == (undefined *)0xfffffffc) {
    return 0;
  }
  if (*(uint *)(puVar4 + 8) != uVar1 >> 0xc) {
    return 0;
  }
  return *(undefined4 *)(puVar4 + 4);
}

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)