L L4D2node

CItemDefibrillator::ShouldStartAction

0x00541c60 · 359 bytes · __thiscall

_ZN18CItemDefibrillator17ShouldStartActionEN17CBaseBackpackItem22BackpackItemActionTypeEP13CTerrorPlayerP11CBaseEntity

Decompiled

undefined (4 params)

/* CItemDefibrillator::ShouldStartAction(CBaseBackpackItem::BackpackItemActionType, CTerrorPlayer*,
   CBaseEntity*) */

undefined4 __thiscall
CItemDefibrillator::ShouldStartAction(CItemDefibrillator *this,int param_2,int param_3,int *param_4)

{
  code *pcVar1;
  char cVar2;
  int iVar3;
  int *piVar4;
  undefined4 uVar5;
  int *piVar6;
  
  cVar2 = (**(code **)(*param_4 + 0x16c))(param_4);
  if ((cVar2 == '\0') || (param_2 == 1)) {
    iVar3 = __dynamic_cast(param_4,&CBaseEntity::typeinfo,&CSurvivorDeathModel::typeinfo,0);
    if (iVar3 != 0) {
      uVar5 = CBaseBackpackItem::ShouldStartAction();
      return uVar5;
    }
  }
  else if (*(float *)(this + 0x17f8) <= *(float *)(gpGlobals + 0xc) &&
           *(float *)(gpGlobals + 0xc) != *(float *)(this + 0x17f8)) {
    piVar4 = (int *)(**(code **)(*gameeventmanager + 0x1c))
                              (gameeventmanager,"defibrillator_used_fail",0,0);
    if (piVar4 != (int *)0x0) {
      pcVar1 = *(code **)(*piVar4 + 0x30);
      uVar5 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(param_3 + 0x30));
      (*pcVar1)(piVar4,"userid",uVar5);
      pcVar1 = *(code **)(*piVar4 + 0x30);
      cVar2 = (**(code **)(*param_4 + 0x16c))(param_4);
      piVar6 = (int *)0x0;
      if (cVar2 != '\0') {
        piVar6 = param_4;
      }
      uVar5 = (**(code **)(*engine + 0x40))(engine,piVar6[0xc]);
      (*pcVar1)(piVar4,"subject",uVar5);
      (**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar4,0);
    }
    *(float *)(this + 0x17f8) = *(float *)(gpGlobals + 0xc) + 5.0;
    return 0;
  }
  return 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)