L L4D2node

CTerrorGameRules::GetChatPrefix

0x00503a20 · 249 bytes · __thiscall

_ZN16CTerrorGameRules13GetChatPrefixEbP11CBasePlayer

Decompiled

undefined (3 params)

/* CTerrorGameRules::GetChatPrefix(bool, CBasePlayer*) */

char * __thiscall
CTerrorGameRules::GetChatPrefix(CTerrorGameRules *this,bool param_1,CBasePlayer *param_2)

{
  char cVar1;
  int iVar2;
  char *pcVar3;
  
  if (param_2 == (CBasePlayer *)0x0) {
LAB_00503ad3:
    return "";
  }
  if (param_1) {
    iVar2 = CBaseEntity::GetTeamNumber((CBaseEntity *)param_2);
    if (iVar2 == 3) {
      if ((param_2[0x104] != (CBasePlayer)0x0) ||
         (cVar1 = (**(code **)(*(int *)param_2 + 0x558))(param_2), cVar1 != '\0')) {
        return "*DEAD*(Infected)";
      }
      pcVar3 = "(Infected)";
    }
    else {
      iVar2 = CBaseEntity::GetTeamNumber((CBaseEntity *)param_2);
      cVar1 = IsASurvivorTeam(iVar2);
      if (cVar1 == '\0') {
        iVar2 = CBaseEntity::GetTeamNumber((CBaseEntity *)param_2);
        pcVar3 = (char *)0x0;
        if (iVar2 == 1) {
          pcVar3 = "(Spectator)";
        }
      }
      else {
        pcVar3 = "(Survivor)";
        if (param_2[0x104] != (CBasePlayer)0x0) {
          pcVar3 = "*DEAD*(Survivor)";
        }
      }
    }
  }
  else {
    if ((param_2[0x104] == (CBasePlayer)0x0) &&
       (cVar1 = (**(code **)(*(int *)param_2 + 0x558))(param_2), cVar1 == '\0')) goto LAB_00503ad3;
    iVar2 = CBaseEntity::GetTeamNumber((CBaseEntity *)param_2);
    if (iVar2 != 3) {
      iVar2 = CBaseEntity::GetTeamNumber((CBaseEntity *)param_2);
      cVar1 = IsASurvivorTeam(iVar2);
      if (cVar1 == '\0') {
        return "*SPEC*";
      }
    }
    pcVar3 = "*DEAD*";
  }
  return pcVar3;
}

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)