L L4D2node

CMultiplayRules::FShouldSwitchWeapon

0x0046e620 · 139 bytes · __thiscall

_ZN15CMultiplayRules19FShouldSwitchWeaponEP11CBasePlayerP17CBaseCombatWeapon

Decompiled

undefined (3 params)

/* CMultiplayRules::FShouldSwitchWeapon(CBasePlayer*, CBaseCombatWeapon*) */

bool __thiscall
CMultiplayRules::FShouldSwitchWeapon
          (CMultiplayRules *this,CBasePlayer *param_1,CBaseCombatWeapon *param_2)

{
  char cVar1;
  int iVar2;
  int *piVar3;
  int iVar4;
  
  cVar1 = (**(code **)(*(int *)param_1 + 0x47c))(param_1,param_2);
  if (cVar1 != '\0') {
    iVar2 = CBaseCombatCharacter::GetActiveWeapon((CBaseCombatCharacter *)param_1);
    if (iVar2 == 0) {
      return (bool)cVar1;
    }
    cVar1 = (**(code **)(*(int *)param_2 + 0x524))(param_2);
    if (cVar1 != '\0') {
      piVar3 = (int *)CBaseCombatCharacter::GetActiveWeapon((CBaseCombatCharacter *)param_1);
      cVar1 = (**(code **)(*piVar3 + 0x528))(piVar3);
      if (cVar1 != '\0') {
        iVar2 = (**(code **)(*(int *)param_2 + 0x520))(param_2);
        piVar3 = (int *)CBaseCombatCharacter::GetActiveWeapon((CBaseCombatCharacter *)param_1);
        iVar4 = (**(code **)(*piVar3 + 0x520))(piVar3);
        return iVar4 < iVar2;
      }
    }
  }
  return false;
}

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)