L L4D2node

CWeaponCSBaseGun::SetAccuracyForThisShot

0x00442110 · 203 bytes · __thiscall

_ZN16CWeaponCSBaseGun22SetAccuracyForThisShotEv

Decompiled

undefined (1 param)

/* CWeaponCSBaseGun::SetAccuracyForThisShot() */

void __thiscall CWeaponCSBaseGun::SetAccuracyForThisShot(CWeaponCSBaseGun *this)

{
  int iVar1;
  uint uVar2;
  int iVar3;
  int iVar4;
  int iVar5;
  undefined *puVar6;
  float fVar7;
  
  iVar3 = CTerrorWeapon::GetPlayerOwner((CTerrorWeapon *)this);
  if (iVar3 != 0) {
    iVar4 = CWeaponCSBase::GetCSWpnData((CWeaponCSBase *)this);
    puVar6 = g_pEntityList;
    if (*(float *)(iVar4 + 0x9e4) != -1.0) {
      iVar1 = *(int *)(iVar3 + 0x2850);
      iVar5 = iVar1 * iVar1;
      if (*(char *)(iVar4 + 0x9e0) == '\0') {
        iVar5 = iVar5 * iVar1;
      }
      fVar7 = (float)iVar5 / *(float *)(iVar4 + 0x9e4) + *(float *)(iVar4 + 0x9e8);
      *(float *)(this + 0x14f4) = fVar7;
      uVar2 = *(uint *)(iVar3 + 0x33c4);
      if ((((uVar2 != 0xffffffff) &&
           (puVar6 = puVar6 + (uVar2 & 0xfff) * 0x10, puVar6 != (undefined *)0xfffffffc)) &&
          (*(uint *)(puVar6 + 8) == uVar2 >> 0xc)) && (*(int *)(puVar6 + 4) != 0)) {
        fVar7 = fVar7 + *(float *)(TongueVictimAccuracyPenalty._28_4_ + 0x2c);
        *(float *)(this + 0x14f4) = fVar7;
      }
      if (*(float *)(iVar4 + 0x9ec) < fVar7) {
        *(float *)(this + 0x14f4) = *(float *)(iVar4 + 0x9ec);
      }
    }
  }
  return;
}

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)