L L4D2node

CWeaponSpawn::GiveItem

0x008d6f30 · 360 bytes · __thiscall

_ZN12CWeaponSpawn8GiveItemEP13CTerrorPlayerPKc

Decompiled

undefined (3 params)

/* CWeaponSpawn::GiveItem(CTerrorPlayer*, char const*) */

int * __thiscall CWeaponSpawn::GiveItem(CWeaponSpawn *this,CTerrorPlayer *param_1,char *param_2)

{
  CBaseEdict *this_00;
  int *piVar1;
  int iVar2;
  int iVar3;
  int iVar4;
  int *piVar5;
  
  piVar1 = (int *)(**(code **)(*(int *)param_1 + 0x6c0))(param_1,param_2,0,1,0);
  if (((-1 < *(int *)(this + 0x1450)) && (piVar1 != (int *)0x0)) &&
     (iVar2 = (**(code **)(*piVar1 + 0xf0))(piVar1), iVar2 != 0)) {
    iVar3 = (**(code **)(*piVar1 + 0xf0))(piVar1);
    iVar2 = *(int *)(this + 0x1450);
    if (iVar2 != *(int *)(iVar3 + 0x458)) {
      if (*(char *)(iVar3 + 0x6c) == '\0') {
        this_00 = *(CBaseEdict **)(iVar3 + 0x30);
        if (this_00 != (CBaseEdict *)0x0) {
          *(uint *)this_00 = *(uint *)this_00 | 0x101;
          iVar4 = CBaseEdict::GetChangeAccessor(this_00);
          *(undefined2 *)(iVar4 + 2) = 0;
        }
      }
      else {
        *(byte *)(iVar3 + 0x70) = *(byte *)(iVar3 + 0x70) | 1;
      }
      *(int *)(iVar3 + 0x458) = iVar2;
    }
    piVar5 = (int *)__dynamic_cast(piVar1,&CBaseEntity::typeinfo,&CBaseCombatWeapon::typeinfo,0);
    if (piVar5 != (int *)0x0) {
      (**(code **)(*piVar5 + 0x3fc))(piVar5);
    }
    if (*(int *)(this + 0x1450) == 1) {
      if ((param_2 != "crowbar") && (iVar2 = _V_stricmp("crowbar",param_2), iVar2 != 0)) {
        return piVar1;
      }
      iVar2 = (**(code **)(*gameeventmanager + 0x1c))(gameeventmanager,"golden_crowbar_pickup",0,0);
      if (iVar2 != 0) {
        (**(code **)(*gameeventmanager + 0x20))(gameeventmanager,iVar2,0);
        return piVar1;
      }
    }
  }
  return piVar1;
}

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)