L L4D2node

CTerrorPlayer::Weapon_CanUse

0x00995ab0 · 306 bytes · __thiscall

_ZN13CTerrorPlayer13Weapon_CanUseEP17CBaseCombatWeapon

Decompiled

undefined (2 params)

/* CTerrorPlayer::Weapon_CanUse(CBaseCombatWeapon*) */

bool __thiscall CTerrorPlayer::Weapon_CanUse(CTerrorPlayer *this,CBaseCombatWeapon *param_1)

{
  int iVar1;
  char cVar2;
  undefined1 uVar3;
  int *piVar4;
  undefined4 uVar5;
  int iVar6;
  
  if (param_1 != (CBaseCombatWeapon *)0x0) {
    piVar4 = (int *)__dynamic_cast(param_1,&CBaseCombatWeapon::typeinfo,&CWeaponCSBase::typeinfo,0);
    if (piVar4 != (int *)0x0) {
      uVar5 = (**(code **)(*piVar4 + 0x638))(piVar4);
      cVar2 = CanUseWeapon(this,uVar5);
      if (cVar2 != '\0') {
        uVar3 = (**(code **)(*piVar4 + 0x670))(piVar4);
        iVar6 = piVar4[0x53f];
        iVar1 = piVar4[0x508];
        uVar5 = (**(code **)(*piVar4 + 0x638))(piVar4);
        iVar6 = GetUseTypeForWeapon(this,uVar5,iVar1,iVar6,0,uVar3);
        if (iVar6 != 0) goto LAB_00995b79;
      }
      return false;
    }
  }
LAB_00995b79:
  iVar6 = GetActiveTerrorWeapon(this);
  if (iVar6 != 0) {
    piVar4 = (int *)GetActiveTerrorWeapon(this);
    iVar6 = (**(code **)(*piVar4 + 0x638))(piVar4);
    if (iVar6 == 0x14) {
      iVar6 = GetActiveTerrorWeapon(this);
      if (iVar6 == 0) {
        iVar6 = 0;
      }
      else {
        iVar6 = __dynamic_cast(iVar6,&CTerrorWeapon::typeinfo,&CChainsaw::typeinfo,0);
      }
      return *(int *)(iVar6 + 0x17e0) != 3;
    }
  }
  return true;
}

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)