L L4D2node

CDirectorTacticalServices::GetRandomSurvivor

0x008c0e00 · 218 bytes · __cdecl

_ZNK25CDirectorTacticalServices17GetRandomSurvivorEv

Decompiled

undefined (0 params)

/* CDirectorTacticalServices::GetRandomSurvivor() const */

int * CDirectorTacticalServices::GetRandomSurvivor(void)

{
  char cVar1;
  int *piVar2;
  int iVar3;
  int *piVar4;
  int iVar5;
  int iVar6;
  int iVar7;
  
  iVar7 = 0;
  piVar2 = (int *)GetGlobalTeam(2);
  for (iVar6 = 0; iVar3 = (**(code **)(*piVar2 + 0x354))(piVar2), iVar6 < iVar3; iVar6 = iVar6 + 1)
  {
    piVar4 = (int *)(**(code **)(*piVar2 + 0x358))(piVar2,iVar6);
    cVar1 = (**(code **)(*piVar4 + 300))(piVar4);
    iVar7 = (iVar7 + 1) - (uint)(cVar1 == '\0');
  }
  if (iVar7 != 0) {
    iVar3 = 0;
    iVar6 = RandomInt(0,iVar7 + -1);
    for (iVar7 = 0; iVar5 = (**(code **)(*piVar2 + 0x354))(piVar2), iVar7 < iVar5; iVar7 = iVar7 + 1
        ) {
      piVar4 = (int *)(**(code **)(*piVar2 + 0x358))(piVar2,iVar7);
      cVar1 = (**(code **)(*piVar4 + 300))(piVar4);
      if (cVar1 != '\0') {
        if (iVar3 == iVar6) {
          piVar2 = (int *)(**(code **)(*piVar2 + 0x358))(piVar2,iVar7);
          if (piVar2 == (int *)0x0) {
            return (int *)0x0;
          }
          cVar1 = (**(code **)(*piVar2 + 0x16c))(piVar2);
          if (cVar1 == '\0') {
            return (int *)0x0;
          }
          return piVar2;
        }
        iVar3 = iVar3 + 1;
      }
    }
  }
  return (int *)0x0;
}

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)