L L4D2node

CTerrorGameRules::FPlayerCanRespawn

0x00509580 · 399 bytes · __thiscall

_ZN16CTerrorGameRules17FPlayerCanRespawnEP11CBasePlayer

Decompiled

undefined (2 params)

/* CTerrorGameRules::FPlayerCanRespawn(CBasePlayer*) */

uint __thiscall CTerrorGameRules::FPlayerCanRespawn(CTerrorGameRules *this,CBasePlayer *param_1)

{
  char cVar1;
  int *piVar2;
  undefined4 uVar3;
  int iVar4;
  uint uVar5;
  uint uVar6;
  color32_s local_34;
  undefined1 local_33;
  undefined1 local_32;
  undefined1 local_31;
  float local_30 [8];
  
  if ((param_1 == (CBasePlayer *)0x0) ||
     (cVar1 = (**(code **)(*(int *)param_1 + 0x16c))(param_1), cVar1 == '\0')) {
    param_1 = (CBasePlayer *)0x0;
    Error("FPlayerCanRespawn: pPlayer=0");
  }
  piVar2 = (int *)GetGlobalTeam(3);
  uVar3 = (**(code **)(*piVar2 + 0x354))(piVar2);
  *(undefined4 *)(this + 0x270) = uVar3;
  piVar2 = (int *)GetGlobalTeam(2);
  iVar4 = (**(code **)(*piVar2 + 0x354))(piVar2);
  *(int *)(this + 0x26c) = iVar4;
  if (0 < iVar4) {
    iVar4 = CBaseEntity::GetTeamNumber((CBaseEntity *)param_1);
    if (iVar4 == 2) {
      if (*(int *)(this + 0x26c) == 1) {
        return 1;
      }
      iVar4 = CBaseEntity::GetTeamNumber((CBaseEntity *)param_1);
    }
    else {
      iVar4 = CBaseEntity::GetTeamNumber((CBaseEntity *)param_1);
    }
    if (iVar4 == 2) {
      uVar6 = CDirector::IsAnySurvivorInStartArea();
      if (((char)uVar6 != '\0') ||
         (uVar5 = CDirector::HasAnySurvivorLeftSafeArea(TheDirector), (char)uVar5 == '\0')) {
        return 1;
      }
      local_30[0] = 1e+09;
      local_30[1] = 2.8026e-45;
      local_30[2] = 0.0;
      local_30[3] = 0.0;
      local_30[4] = 0.0;
      ForEachTerrorPlayer<LowestFlowDistance>((LowestFlowDistance *)local_30);
      if (local_30[0] < *(float *)(ZombieSpawnFlowLimit._28_4_ + 0x2c)) {
        return uVar5;
      }
      local_34 = (color32_s)0x0;
      local_33 = 0;
      local_32 = 0;
      local_31 = 0;
      if (*(int *)(mp_fadetoblack._28_4_ + 0x30) == 0) {
        return uVar6;
      }
      UTIL_ScreenFade((CBaseEntity *)param_1,&local_34,3.0,3.0,10);
      return uVar6;
    }
  }
  uVar6 = 1;
  if (0 < *(int *)(param_1 + 0x23e4)) {
    uVar6 = (byte)this[0x27c] ^ 1;
  }
  return uVar6;
}

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)