L L4D2node

CTerrorGun::RemoveSecondWeapon

0x00565dc0 · 391 bytes · __thiscall

_ZN10CTerrorGun18RemoveSecondWeaponEb

Decompiled

undefined (2 params)

/* CTerrorGun::RemoveSecondWeapon(bool) */

CTerrorGun __thiscall CTerrorGun::RemoveSecondWeapon(CTerrorGun *this,bool param_1)

{
  CTerrorGun CVar1;
  CBaseEdict *pCVar2;
  code *pcVar3;
  int iVar4;
  undefined4 uVar5;
  int iVar6;
  CTerrorGun CVar7;
  
  CVar1 = this[0x17e1];
  if (CVar1 == (CTerrorGun)0x0) {
    return (CTerrorGun)0x0;
  }
  if ((!param_1) &&
     ((this[0x1459] != (CTerrorGun)0x0 ||
      (*(float *)(gpGlobals + 0xc) <= *(float *)(this + 0x13fc) &&
       *(float *)(this + 0x13fc) != *(float *)(gpGlobals + 0xc))))) {
    return (CTerrorGun)0x0;
  }
  if (this[0x17e0] != (CTerrorGun)0x0) {
    CVar7 = this[0x6c];
    if (CVar7 == (CTerrorGun)0x0) {
      pCVar2 = *(CBaseEdict **)(this + 0x30);
      CVar7 = this[0x17e0];
      if (pCVar2 != (CBaseEdict *)0x0) {
        *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
        iVar4 = CBaseEdict::GetChangeAccessor(pCVar2);
        *(undefined2 *)(iVar4 + 2) = 0;
        CVar7 = this[0x17e1];
      }
    }
    else {
      this[0x70] = (CTerrorGun)((byte)this[0x70] | 1);
    }
    this[0x17e0] = (CTerrorGun)0x0;
    if (CVar7 == (CTerrorGun)0x0) goto LAB_00565e23;
  }
  if (this[0x6c] == (CTerrorGun)0x0) {
    pCVar2 = *(CBaseEdict **)(this + 0x30);
    if (pCVar2 != (CBaseEdict *)0x0) {
      *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
      iVar4 = CBaseEdict::GetChangeAccessor(pCVar2);
      *(undefined2 *)(iVar4 + 2) = 0;
    }
  }
  else {
    this[0x70] = (CTerrorGun)((byte)this[0x70] | 1);
  }
  this[0x17e1] = (CTerrorGun)0x0;
LAB_00565e23:
  (**(code **)(*(int *)this + 0x3fc))(this);
  pcVar3 = *(code **)(*(int *)this + 0x70);
  uVar5 = (**(code **)(*(int *)this + 0x504))(this,0);
  (*pcVar3)(this,uVar5);
  pcVar3 = *(code **)(*(int *)this + 0x3f0);
  uVar5 = (**(code **)(*(int *)this + 0x484))(this);
  (*pcVar3)(this,uVar5);
  SetNextAttackTimes(this,1.0);
  iVar4 = *(int *)(this + 0x1420) / 2;
  if (*(int *)(this + 0x1420) != iVar4) {
    if (this[0x6c] == (CTerrorGun)0x0) {
      pCVar2 = *(CBaseEdict **)(this + 0x30);
      if (pCVar2 != (CBaseEdict *)0x0) {
        *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
        iVar6 = CBaseEdict::GetChangeAccessor(pCVar2);
        *(undefined2 *)(iVar6 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CTerrorGun)((byte)this[0x70] | 1);
    }
    *(int *)(this + 0x1420) = iVar4;
  }
  return CVar1;
}

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)