L L4D2node

CTerrorPlayer::ScriptSwitchToItem

0x009965a0 · 155 bytes · __thiscall

_ZN13CTerrorPlayer18ScriptSwitchToItemEPKc

Decompiled

undefined (2 params)

/* CTerrorPlayer::ScriptSwitchToItem(char const*) */

undefined4 __thiscall CTerrorPlayer::ScriptSwitchToItem(CTerrorPlayer *this,char *param_1)

{
  char cVar1;
  int iVar2;
  int iVar3;
  int *piVar4;
  undefined4 uVar5;
  
  if ((((param_1 != (char *)0x0) && (iVar2 = (**(code **)(*(int *)this + 0x648))(this), iVar2 == 0))
      && (iVar2 = CBaseCombatCharacter::Weapon_OwnsThisType((CBaseCombatCharacter *)this,param_1,0),
         iVar2 != 0)) && (cVar1 = (**(code **)(*(int *)this + 0x5d4))(this,iVar2), cVar1 != '\0')) {
    iVar3 = CBaseCombatCharacter::GetActiveWeapon((CBaseCombatCharacter *)this);
    if (iVar3 != 0) {
      piVar4 = (int *)CBaseCombatCharacter::GetActiveWeapon((CBaseCombatCharacter *)this);
      cVar1 = (**(code **)(*piVar4 + 0x418))(piVar4);
      if (cVar1 == '\0') {
        return 0;
      }
      CBasePlayer::ResetAutoaim((CBasePlayer *)this);
    }
    uVar5 = (**(code **)(*(int *)this + 0x474))(this,iVar2,0);
    return uVar5;
  }
  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)