L L4D2node

CEventLog::PrintPlayerEvent

0x00698ae0 · 1578 bytes · __thiscall

_ZN9CEventLog16PrintPlayerEventEP10IGameEvent

Decompiled

undefined (2 params)

/* CEventLog::PrintPlayerEvent(IGameEvent*) */

undefined4 __thiscall CEventLog::PrintPlayerEvent(CEventLog *this,IGameEvent *param_1)

{
  char cVar1;
  char *pcVar2;
  int iVar3;
  int iVar4;
  undefined4 uVar5;
  undefined4 uVar6;
  undefined4 uVar7;
  CBaseEntity *pCVar8;
  int *piVar9;
  undefined1 *puVar10;
  CBaseEntity *this_00;
  undefined4 uVar11;
  int *piVar12;
  char *pcVar13;
  undefined1 *puVar14;
  undefined1 *local_24;
  
  pcVar2 = (char *)(**(code **)(*(int *)param_1 + 8))(param_1);
  iVar3 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"userid",0);
  iVar4 = _V_strlen("player_connect");
  iVar4 = V_strncmp(pcVar2,"player_connect",iVar4);
  if (iVar4 == 0) {
    uVar5 = (**(code **)(*(int *)param_1 + 0x28))(param_1,"name",&DAT_00d539c2);
    uVar6 = (**(code **)(*(int *)param_1 + 0x28))(param_1,"address",&DAT_00d539c2);
    uVar7 = (**(code **)(*(int *)param_1 + 0x28))(param_1,"networkid",&DAT_00d539c2);
    UTIL_LogPrintf("\"%s<%i><%s><>\" connected, address \"%s\"\n",uVar5,iVar3,uVar7,uVar6);
    return 1;
  }
  iVar4 = _V_strlen("player_disconnect");
  iVar4 = V_strncmp(pcVar2,"player_disconnect",iVar4);
  if (iVar4 == 0) {
    uVar5 = (**(code **)(*(int *)param_1 + 0x28))(param_1,"reason",&DAT_00d539c2);
    uVar6 = (**(code **)(*(int *)param_1 + 0x28))(param_1,"name",&DAT_00d539c2);
    uVar7 = (**(code **)(*(int *)param_1 + 0x28))(param_1,"networkid",&DAT_00d539c2);
    pCVar8 = (CBaseEntity *)UTIL_PlayerByUserId(iVar3);
    if ((pCVar8 == (CBaseEntity *)0x0) ||
       (piVar9 = (int *)CBaseEntity::GetTeam(pCVar8), piVar9 == (int *)0x0)) {
      puVar10 = &DAT_00d539c2;
    }
    else {
      puVar10 = (undefined1 *)(**(code **)(*piVar9 + 0x32c))(piVar9);
    }
    UTIL_LogPrintf("\"%s<%i><%s><%s>\" disconnected (reason \"%s\")\n",uVar6,iVar3,uVar7,puVar10,
                   uVar5);
    return 1;
  }
  pCVar8 = (CBaseEntity *)UTIL_PlayerByUserId(iVar3);
  if (pCVar8 == (CBaseEntity *)0x0) {
    DevMsg("CEventLog::PrintPlayerEvent: Failed to find player (userid: %i, event: %s)\n",iVar3,
           pcVar2);
    return 0;
  }
  iVar4 = _V_strlen("player_team");
  iVar4 = V_strncmp(pcVar2,"player_team",iVar4);
  if (iVar4 == 0) {
    cVar1 = (**(code **)(*(int *)param_1 + 0x18))(param_1,"disconnect",0);
    if (cVar1 == '\0') {
      iVar3 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"team",0);
      iVar4 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"oldteam",0);
      piVar9 = (int *)GetGlobalTeam(iVar3);
      piVar12 = (int *)GetGlobalTeam(iVar4);
      uVar5 = (**(code **)(*(int *)pCVar8 + 0xb8))(pCVar8);
      iVar3 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(pCVar8 + 0x30));
      if (0 < iVar3) {
        uVar6 = CBasePlayer::GetNetworkIDString((CBasePlayer *)pCVar8);
        pcVar2 = "Unassigned";
        if (piVar12 != (int *)0x0) {
          pcVar2 = (char *)(**(code **)(*piVar12 + 0x32c))(piVar12);
        }
        pcVar13 = "Unassigned";
        if (piVar9 != (int *)0x0) {
          pcVar13 = (char *)(**(code **)(*piVar9 + 0x32c))(piVar9);
        }
        UTIL_LogPrintf("\"%s<%i><%s><%s>\" joined team \"%s\"\n",uVar5,iVar3,uVar6,pcVar2,pcVar13);
        return 1;
      }
    }
    return 1;
  }
  iVar4 = _V_strlen("player_death");
  iVar4 = V_strncmp(pcVar2,"player_death",iVar4);
  if (iVar4 != 0) {
    iVar4 = _V_strlen("player_activate");
    iVar4 = V_strncmp(pcVar2,"player_activate",iVar4);
    if (iVar4 == 0) {
      uVar5 = CBasePlayer::GetNetworkIDString((CBasePlayer *)pCVar8);
      uVar6 = (**(code **)(*(int *)pCVar8 + 0xb8))(pCVar8);
      UTIL_LogPrintf("\"%s<%i><%s><>\" entered the game\n",uVar6,iVar3,uVar5);
      return 1;
    }
    iVar4 = _V_strlen("player_changename");
    iVar4 = V_strncmp(pcVar2,"player_changename",iVar4);
    if (iVar4 != 0) {
      return 0;
    }
    uVar5 = (**(code **)(*(int *)param_1 + 0x28))(param_1,"newname",&DAT_00d539c2);
    uVar6 = (**(code **)(*(int *)param_1 + 0x28))(param_1,"oldname",&DAT_00d539c2);
    piVar9 = (int *)CBaseEntity::GetTeam(pCVar8);
    puVar10 = &DAT_00d539c2;
    if (piVar9 != (int *)0x0) {
      puVar10 = (undefined1 *)(**(code **)(*piVar9 + 0x32c))(piVar9);
    }
    uVar7 = CBasePlayer::GetNetworkIDString((CBasePlayer *)pCVar8);
    UTIL_LogPrintf("\"%s<%i><%s><%s>\" changed name to \"%s\"\n",uVar6,iVar3,uVar7,puVar10,uVar5);
    return 1;
  }
  iVar4 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"attacker",0);
  this_00 = (CBaseEntity *)UTIL_PlayerByUserId(iVar4);
  piVar9 = (int *)CBaseEntity::GetTeam(pCVar8);
  if (this_00 == (CBaseEntity *)0x0) {
    puVar10 = &DAT_00d539c2;
    if (piVar9 != (int *)0x0) {
      puVar10 = (undefined1 *)(**(code **)(*piVar9 + 0x32c))(piVar9);
    }
    uVar5 = CBasePlayer::GetNetworkIDString((CBasePlayer *)pCVar8);
    uVar6 = (**(code **)(*(int *)pCVar8 + 0xb8))(pCVar8);
    UTIL_LogPrintf("\"%s<%i><%s><%s>\" committed suicide with \"world\"\n",uVar6,iVar3,uVar5,puVar10
                  );
    return 1;
  }
  CBaseEntity::GetTeam(this_00);
  if (pCVar8 != this_00) {
    piVar12 = (int *)CBaseEntity::GetTeam(this_00);
    local_24 = &DAT_00d539c2;
    if (piVar9 != (int *)0x0) {
      local_24 = (undefined1 *)(**(code **)(*piVar9 + 0x32c))(piVar9);
    }
    uVar5 = CBasePlayer::GetNetworkIDString((CBasePlayer *)pCVar8);
    uVar6 = (**(code **)(*(int *)pCVar8 + 0xb8))(pCVar8);
    puVar10 = &DAT_00d539c2;
    if (piVar12 != (int *)0x0) {
      puVar10 = (undefined1 *)(**(code **)(*piVar12 + 0x32c))(piVar12);
    }
    uVar7 = CBasePlayer::GetNetworkIDString((CBasePlayer *)this_00);
    uVar11 = (**(code **)(*(int *)this_00 + 0xb8))(this_00);
    UTIL_LogPrintf("\"%s<%i><%s><%s>\" killed \"%s<%i><%s><%s>\"\n",uVar11,iVar4,uVar7,puVar10,uVar6
                   ,iVar3,uVar5,local_24);
    return 1;
  }
  puVar14 = &DAT_00d539c2;
  puVar10 = &DAT_00d539c2;
  if (*(undefined1 **)(pCVar8 + 0x7c) != (undefined1 *)0x0) {
    puVar10 = *(undefined1 **)(pCVar8 + 0x7c);
  }
  if (piVar9 != (int *)0x0) {
    puVar14 = (undefined1 *)(**(code **)(*piVar9 + 0x32c))(piVar9);
  }
  uVar5 = CBasePlayer::GetNetworkIDString((CBasePlayer *)pCVar8);
  uVar6 = (**(code **)(*(int *)pCVar8 + 0xb8))(pCVar8);
  UTIL_LogPrintf("\"%s<%i><%s><%s>\" committed suicide with \"%s\"\n",uVar6,iVar3,uVar5,puVar14,
                 puVar10);
  return 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)