L L4D2node

Infected::OnAmbushed

0x00a11180 · 342 bytes · __thiscall

_ZN8Infected10OnAmbushedEP13CTerrorPlayer

Decompiled

undefined (2 params)

/* Infected::OnAmbushed(CTerrorPlayer*) */

void __thiscall Infected::OnAmbushed(Infected *this,CTerrorPlayer *param_1)

{
  code *pcVar1;
  undefined1 uVar2;
  int *piVar3;
  undefined4 uVar4;
  int iVar5;
  CTakeDamageInfo local_7c [108];
  
  if ((((param_1 != (CTerrorPlayer *)0x0) && ((*(uint *)(this + 0x1c74) & 0x800) == 0)) &&
      ((*(uint *)(this + 0x1c74) & 0x10) == 0)) && (this[0x1d90] == (Infected)0x0)) {
    this[0x1d08] = (Infected)0x1;
    uVar2 = IsNeutral(this);
    CTakeDamageInfo::CTakeDamageInfo
              (local_7c,(CBaseEntity *)param_1,(CBaseEntity *)param_1,
               (float)*(int *)(this + 0x100) + 1.0,0x80,0);
    (**(code **)(*(int *)this + 0x124))(this,local_7c);
    piVar3 = (int *)(**(code **)(*gameeventmanager + 0x1c))(gameeventmanager,"melee_kill",0,0);
    if (piVar3 != (int *)0x0) {
      pcVar1 = *(code **)(*piVar3 + 0x30);
      uVar4 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(param_1 + 0x30));
      (*pcVar1)(piVar3,"userid",uVar4);
      if (*(int *)(this + 0x30) == 0) {
        iVar5 = 0;
      }
      else {
        iVar5 = *(int *)(this + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
      }
      (**(code **)(*piVar3 + 0x30))(piVar3,"entityid",iVar5);
      (**(code **)(*piVar3 + 0x2c))(piVar3,"ambush",uVar2);
      (**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar3,0);
    }
  }
  return;
}

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)