L L4D2node

CTerrorPlayer::CanAttack

0x004f3230 · 493 bytes · __thiscall

_ZNK13CTerrorPlayer9CanAttackEv

Decompiled

undefined (1 param)

/* CTerrorPlayer::CanAttack() const */

undefined4 __thiscall CTerrorPlayer::CanAttack(CTerrorPlayer *this)

{
  uint uVar1;
  char cVar2;
  int iVar3;
  undefined4 uVar4;
  undefined *puVar5;
  float fVar6;
  
  iVar3 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
  cVar2 = IsASurvivorTeam(iVar3);
  if ((((((cVar2 == '\0') ||
         (fVar6 = *(float *)(ZombieRoundStartAttackPrevention._28_4_ + 0x2c) +
                  *(float *)(this + 0x30cc),
         fVar6 < *(float *)(gpGlobals + 0xc) || fVar6 == *(float *)(gpGlobals + 0xc))) &&
        ((iVar3 = CBaseEntity::GetTeamNumber((CBaseEntity *)this), iVar3 != 3 ||
         ((iVar3 = (**(code **)(*(int *)this + 0x544))(this), iVar3 != 3 ||
          (((byte)this[0x150] & 1) != 0)))))) && (this[0x33dc] == (CTerrorPlayer)0x0)) &&
      ((((cVar2 = IsGettingUp(this), cVar2 == '\0' || (*(int *)(this + 0x3f28) != 2)) &&
        (iVar3 = GetStaggerDir(this), iVar3 == 0)) &&
       (((uVar1 = *(uint *)(this + 0x3e68), uVar1 == 0xffffffff ||
         (puVar5 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar5 == (undefined *)0xfffffffc)) ||
        ((*(uint *)(puVar5 + 8) != uVar1 >> 0xc || (*(int *)(puVar5 + 4) == 0)))))))) &&
     (((((uVar1 = *(uint *)(this + 0x3ee0), uVar1 == 0xffffffff ||
         (puVar5 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar5 == (undefined *)0xfffffffc)) ||
        (*(uint *)(puVar5 + 8) != uVar1 >> 0xc)) || (*(int *)(puVar5 + 4) == 0)) &&
      ((((uVar1 = *(uint *)(this + 0x3e48), uVar1 == 0xffffffff ||
         (puVar5 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar5 == (undefined *)0xfffffffc)) ||
        (*(uint *)(puVar5 + 8) != uVar1 >> 0xc)) || (*(int *)(puVar5 + 4) == 0)))))) {
    uVar4 = CMultiPlayerAnimState::GetMainActivity(*(CMultiPlayerAnimState **)(this + 0x2910));
    cVar2 = IsMotionControlledXY(this,uVar4);
    if (((cVar2 == '\0') && (cVar2 = IsPerformingAction(this,10), cVar2 == '\0')) &&
       (uVar4 = IsPerformingAction(this,0xb), (char)uVar4 == '\0')) {
      iVar3 = CMultiPlayerAnimState::GetMainActivity(*(CMultiPlayerAnimState **)(this + 0x2910));
      if (0x208 < iVar3) {
        if (iVar3 < 0x20f) {
          return uVar4;
        }
        if (iVar3 == 0x303) {
          return uVar4;
        }
      }
      return 1;
    }
  }
  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)