L L4D2node

CCSGameRules::PlayerKilled

0x00433750 · 973 bytes · __thiscall

_ZN12CCSGameRules12PlayerKilledEP11CBasePlayerRK15CTakeDamageInfo

Decompiled

undefined (3 params)

/* CCSGameRules::PlayerKilled(CBasePlayer*, CTakeDamageInfo const&) */

void __thiscall
CCSGameRules::PlayerKilled(CCSGameRules *this,CBasePlayer *param_1,CTakeDamageInfo *param_2)

{
  uint uVar1;
  code *pcVar2;
  char cVar3;
  CCSPlayer *this_00;
  int iVar4;
  undefined4 uVar5;
  undefined *puVar6;
  CBaseEntity *pCVar7;
  int in_GS_OFFSET;
  char *pcVar8;
  char *pcVar9;
  char *pcVar10;
  CBaseEntity *local_74;
  char local_60 [64];
  int local_20;
  
  local_74 = (CBaseEntity *)0x0;
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  uVar1 = *(uint *)(param_2 + 0x30);
  if (((uVar1 != 0xffffffff) &&
      (puVar6 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar6 != (undefined *)0xfffffffc)) &&
     (*(uint *)(puVar6 + 8) == uVar1 >> 0xc)) {
    local_74 = *(CBaseEntity **)(puVar6 + 4);
  }
  pCVar7 = (CBaseEntity *)0x0;
  uVar1 = *(uint *)(param_2 + 0x34);
  if (((uVar1 != 0xffffffff) &&
      (puVar6 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar6 != (undefined *)0xfffffffc)) &&
     (*(uint *)(puVar6 + 8) == uVar1 >> 0xc)) {
    pCVar7 = *(CBaseEntity **)(puVar6 + 4);
  }
  this_00 = (CCSPlayer *)CMultiplayRules::GetDeathScorer((CMultiplayRules *)this,pCVar7,local_74);
  pcVar9 = "";
  if (*(char **)(pCVar7 + 0x7c) != (char *)0x0) {
    pcVar9 = *(char **)(pCVar7 + 0x7c);
  }
  iVar4 = _V_strcmp(pcVar9,"planted_c4");
  pcVar9 = (char *)param_1;
  if (iVar4 == 0) {
    pcVar8 = "game_playerdie";
    pcVar10 = (char *)param_1;
    FireTargets("game_playerdie",param_1,param_1,3,0);
  }
  else {
    pcVar8 = (char *)this;
    CTeamplayRules::PlayerKilled((CTeamplayRules *)this,param_1,param_2);
    pcVar10 = (char *)param_2;
  }
  if (this_00 != (CCSPlayer *)0x0) {
    iVar4 = (**(code **)(*(int *)this + 0x134))(this,this_00,param_1);
    pcVar8 = (char *)this_00;
    if (iVar4 < 0) {
      CCSPlayer::AddAccount((int)this_00,true);
      this_00[0x23f8] = (CCSPlayer)0x1;
      *(int *)(this_00 + 0x23fc) = *(int *)(this_00 + 0x23fc) + 1;
      pcVar10 = "#Killed_Teammate";
      pcVar9 = (char *)0x4;
      ClientPrint((CBasePlayer *)this_00,4,"#Killed_Teammate",(char *)0x0,(char *)0x0,(char *)0x0,
                  (char *)0x0);
      if (*(int *)(mp_autokick._28_4_ + 0x30) != 0) {
        V_snprintf(local_60,0x40,"%d",*(undefined4 *)(this_00 + 0x23fc));
        pcVar10 = "#Game_teammate_kills";
        pcVar9 = (char *)0x2;
        pcVar8 = (char *)this_00;
        ClientPrint((CBasePlayer *)this_00,2,"#Game_teammate_kills",local_60,(char *)0x0,(char *)0x0
                    ,(char *)0x0);
      }
      if (((2 < *(int *)(this_00 + 0x23fc)) && (*(int *)(mp_autokick._28_4_ + 0x30) != 0)) ||
         ((0 < *(int *)(mp_spawnprotectiontime._28_4_ + 0x30) &&
          (*(float *)(gpGlobals + 0xc) - *(float *)(this + 0x244) <
           (float)*(int *)(mp_spawnprotectiontime._28_4_ + 0x30))))) {
        pcVar10 = "#Banned_For_Killing_Teammates";
        ClientPrint((CBasePlayer *)this_00,2,"#Banned_For_Killing_Teammates",(char *)0x0,(char *)0x0
                    ,(char *)0x0,(char *)0x0);
        pcVar2 = *(code **)(*(int *)engine + 0x94);
        uVar5 = (**(code **)(*(int *)engine + 0x40))(engine,*(undefined4 *)(this_00 + 0x30));
        pcVar9 = (char *)UTIL_VarArgs("kickid %d\n",uVar5);
        pcVar8 = (char *)engine;
        (*pcVar2)(engine,pcVar9);
      }
      if ((*(uint *)(this_00 + 0x2390) & 0x400) == 0) {
        *(uint *)(this_00 + 0x2390) = *(uint *)(this_00 + 0x2390) | 0x400;
        pcVar10 = (char *)0x0;
        pcVar9 = "#Hint_careful_around_teammates";
        CCSPlayer::HintMessage(this_00,"#Hint_careful_around_teammates",false,false,false);
        pcVar8 = (char *)this_00;
      }
    }
    else {
      cVar3 = CCSPlayer::IsVIP((CCSPlayer *)param_1);
      if (cVar3 == '\0') {
        pcVar10 = (char *)0x1;
        pcVar9 = (char *)0x12c;
        CCSPlayer::AddAccount((int)this_00,true);
      }
      else {
        CCSPlayer::HintMessage(this_00,"#Hint_reward_for_killing_vip",true,false,false);
        pcVar10 = (char *)0x1;
        pcVar9 = (char *)0x9c4;
        CCSPlayer::AddAccount((int)this_00,true);
      }
      if ((*(uint *)(this_00 + 0x2390) & 0x800) == 0) {
        *(uint *)(this_00 + 0x2390) = *(uint *)(this_00 + 0x2390) | 0x800;
        pcVar10 = (char *)0x0;
        pcVar9 = "#Hint_win_round_by_killing_enemy";
        CCSPlayer::HintMessage(this_00,"#Hint_win_round_by_killing_enemy",false,false,false);
        pcVar8 = (char *)this_00;
      }
    }
  }
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail(pcVar8,pcVar9,pcVar10);
  }
  return;
}

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)