L L4D2node

CBasePlayer::ShouldAutoaim

0x007a88b0 · 301 bytes · __thiscall

_ZN11CBasePlayer13ShouldAutoaimEv

Decompiled

undefined (1 param)

/* CBasePlayer::ShouldAutoaim() */

bool __thiscall CBasePlayer::ShouldAutoaim(CBasePlayer *this)

{
  char cVar1;
  bool bVar2;
  byte bVar3;
  int iVar4;
  char *pcVar5;
  long lVar6;
  long lVar7;
  
  cVar1 = (**(code **)(*(int *)this + 0x778))(this);
  if ((cVar1 != '\0') || (iVar4 = CBaseEntity::GetTeamNumber((CBaseEntity *)this), iVar4 != 2)) {
    return false;
  }
  cVar1 = (**(code **)(*engine + 0x1f8))(engine);
  if (cVar1 != '\0') {
    return (bool)cVar1;
  }
  if (*(int *)(this + 0x30) == 0) {
    iVar4 = 0;
  }
  else {
    iVar4 = *(int *)(this + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
  }
  pcVar5 = (char *)(**(code **)(*engine + 0xe0))(engine,iVar4,"cl_autoaim");
  lVar6 = strtol(pcVar5,(char **)0x0,10);
  if (*(int *)(this + 0x30) == 0) {
    iVar4 = 0;
  }
  else {
    iVar4 = *(int *)(this + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
  }
  pcVar5 = (char *)(**(code **)(*engine + 0xe0))(engine,iVar4,"cl_inputmode");
  lVar7 = strtol(pcVar5,(char **)0x0,10);
  bVar2 = 0 < lVar7 && lVar6 == 1;
  if (0 < lVar7 && lVar6 == 1) {
    return bVar2;
  }
  if (1 < *(int *)(gpGlobals + 0x14)) {
    return bVar2;
  }
  bVar3 = (**(code **)(*g_pGameRules + 0xb8))(g_pGameRules,3);
  return (bool)(bVar3 ^ 1);
}

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)