L L4D2node

SurvivorTeamSituation::GetRandomVisibleFriend

0x00966a30 · 217 bytes · __thiscall

_ZNK21SurvivorTeamSituation22GetRandomVisibleFriendEv

Decompiled

undefined (1 param)

/* SurvivorTeamSituation::GetRandomVisibleFriend() const */

undefined4 __thiscall SurvivorTeamSituation::GetRandomVisibleFriend(SurvivorTeamSituation *this)

{
  uint uVar1;
  int iVar2;
  undefined *puVar3;
  int iVar4;
  longdouble lVar5;
  
  iVar4 = 4;
  while( true ) {
    iVar2 = RandomInt(0,*(int *)(this + 0xd6f8) + -1);
    iVar2 = iVar2 * 0xc;
    uVar1 = *(uint *)(this + iVar2 + 0xd6d4);
    if ((((uVar1 != 0xffffffff) &&
         (puVar3 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar3 != (undefined *)0xfffffffc)) &&
        (*(uint *)(puVar3 + 8) == uVar1 >> 0xc)) &&
       (((*(int *)(puVar3 + 4) != 0 && (0.0 < *(float *)(this + iVar2 + 0xd6dc))) &&
        (lVar5 = (longdouble)IntervalTimer::Now(),
        (float)lVar5 - *(float *)(this + iVar2 + 0xd6dc) < 0.5)))) break;
    iVar4 = iVar4 + -1;
    if (iVar4 == 0) {
      return 0;
    }
  }
  uVar1 = *(uint *)(this + iVar2 + 0xd6d4);
  if (uVar1 == 0xffffffff) {
    return 0;
  }
  puVar3 = g_pEntityList + (uVar1 & 0xfff) * 0x10;
  if (puVar3 == (undefined *)0xfffffffc) {
    return 0;
  }
  if (*(uint *)(puVar3 + 8) != uVar1 >> 0xc) {
    return 0;
  }
  return *(undefined4 *)(puVar3 + 4);
}

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)