L L4D2node

CTerrorWeapon::OnSwingEnd

0x0056d640 · 373 bytes · __cdecl

_ZN13CTerrorWeapon10OnSwingEndEb

Decompiled

undefined (1 param)

/* CTerrorWeapon::OnSwingEnd(bool) */

void CTerrorWeapon::OnSwingEnd(bool param_1)

{
  uint uVar1;
  int *piVar2;
  code *pcVar3;
  CBaseEntity *pCVar4;
  int *piVar5;
  undefined4 uVar6;
  int iVar7;
  undefined *puVar8;
  undefined3 in_stack_00000005;
  CTakeDamageInfo local_7c [108];
  
  if (_param_1[0x1791] != (CTerrorWeapon)0x0) {
    uVar1 = *(uint *)(_param_1 + 0x1794);
    if ((((uVar1 != 0xffffffff) &&
         (puVar8 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar8 != (undefined *)0xfffffffc)) &&
        (*(uint *)(puVar8 + 8) == uVar1 >> 0xc)) &&
       (piVar2 = *(int **)(puVar8 + 4), piVar2 != (int *)0x0)) {
      pCVar4 = (CBaseEntity *)GetPlayerOwner(_param_1);
      if (pCVar4 != (CBaseEntity *)0x0) {
        CTakeDamageInfo::CTakeDamageInfo(local_7c,pCVar4,pCVar4,(float)piVar2[0x40] + 1.0,0x80,0);
        (**(code **)(*piVar2 + 0x124))(piVar2,local_7c);
        piVar5 = (int *)(**(code **)(*gameeventmanager + 0x1c))(gameeventmanager,"melee_kill",0,0);
        if (piVar5 != (int *)0x0) {
          pcVar3 = *(code **)(*piVar5 + 0x30);
          uVar6 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(pCVar4 + 0x30));
          (*pcVar3)(piVar5,"userid",uVar6);
          if (piVar2[0xc] == 0) {
            iVar7 = 0;
          }
          else {
            iVar7 = piVar2[0xc] - *(int *)(gpGlobals + 0x58) >> 4;
          }
          (**(code **)(*piVar5 + 0x30))(piVar5,"entityid",iVar7);
          (**(code **)(*piVar5 + 0x2c))(piVar5,"ambush",0);
          (**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar5,0);
          return;
        }
      }
    }
  }
  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)