CCSPlayer::FirePlayerHurtEvent
0x00651350 · 1095 bytes · __thiscall
_ZN9CCSPlayer19FirePlayerHurtEventERK15CTakeDamageInfo
Decompiled
undefined (2 params)
/* CCSPlayer::FirePlayerHurtEvent(CTakeDamageInfo const&) */
void __thiscall CCSPlayer::FirePlayerHurtEvent(CCSPlayer *this,CTakeDamageInfo *param_1)
{
code *pcVar1;
uint uVar2;
CBaseCombatCharacter *pCVar3;
char cVar4;
int *piVar5;
undefined4 uVar6;
int iVar7;
undefined *puVar8;
char *pcVar9;
CBaseCombatCharacter *this_00;
CBaseEntity *this_01;
char *pcVar10;
undefined1 uVar11;
bool bVar12;
byte bVar13;
char *local_20;
bVar13 = 0;
piVar5 = (int *)(**(code **)(*gameeventmanager + 0x1c))(gameeventmanager,"player_hurt",0,0);
if (piVar5 == (int *)0x0) {
return;
}
pcVar1 = *(code **)(*piVar5 + 0x30);
uVar6 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(this + 0x30));
(*pcVar1)(piVar5,"userid",uVar6);
uVar6 = 0;
if (-1 < *(int *)(this + 0x100)) {
uVar6 = *(undefined4 *)(this + 0x100);
}
(**(code **)(*piVar5 + 0x30))(piVar5,"health",uVar6);
uVar6 = 0;
if (-1 < *(int *)(this + 0x1f70)) {
uVar6 = *(undefined4 *)(this + 0x1f70);
}
(**(code **)(*piVar5 + 0x30))(piVar5,"armor",uVar6);
(**(code **)(*piVar5 + 0x30))(piVar5,"dmg_health",*(undefined4 *)(this + 0x2984));
(**(code **)(*piVar5 + 0x30))(piVar5,"dmg_armor",*(undefined4 *)(this + 0x2988));
(**(code **)(*piVar5 + 0x30))(piVar5,"type",*(undefined4 *)(param_1 + 0x48));
if (((byte)param_1[0x48] & 0x40) == 0) {
(**(code **)(*piVar5 + 0x30))(piVar5,"hitgroup",*(undefined4 *)(this + 0x1838));
}
else {
(**(code **)(*piVar5 + 0x30))(piVar5,"hitgroup",0);
}
uVar2 = *(uint *)(param_1 + 0x34);
uVar11 = true;
if (uVar2 == 0xffffffff) {
LAB_006514a5:
(**(code **)(*piVar5 + 0x30))(piVar5,"attacker",0);
(**(code **)(*piVar5 + 0x30))(piVar5,"attackerentid",0);
local_20 = "";
}
else {
puVar8 = g_pEntityList + (uVar2 & 0xfff) * 0x10;
uVar11 = true;
if ((puVar8 == (undefined *)0xfffffffc) ||
(uVar11 = *(uint *)(puVar8 + 8) == uVar2 >> 0xc, !(bool)uVar11)) goto LAB_006514a5;
pCVar3 = *(CBaseCombatCharacter **)(puVar8 + 4);
uVar11 = true;
if (pCVar3 == (CBaseCombatCharacter *)0x0) goto LAB_006514a5;
cVar4 = (**(code **)(*(int *)pCVar3 + 0x16c))(pCVar3);
if (cVar4 == '\0') {
(**(code **)(*piVar5 + 0x30))(piVar5,"attacker",0);
if (*(int *)(pCVar3 + 0x30) == 0) {
iVar7 = 0;
uVar11 = true;
}
else {
iVar7 = *(int *)(pCVar3 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
uVar11 = iVar7 == 0;
}
(**(code **)(*piVar5 + 0x30))(piVar5,"attackerentid",iVar7);
LAB_0065165a:
local_20 = "";
}
else {
cVar4 = (**(code **)(*(int *)pCVar3 + 0x16c))(pCVar3);
this_00 = (CBaseCombatCharacter *)0x0;
if (cVar4 != '\0') {
this_00 = pCVar3;
}
pcVar1 = *(code **)(*piVar5 + 0x30);
uVar6 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(this_00 + 0x30));
(*pcVar1)(piVar5,"attacker",uVar6);
if (*(int *)(pCVar3 + 0x30) == 0) {
iVar7 = 0;
}
else {
iVar7 = *(int *)(pCVar3 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
}
(**(code **)(*piVar5 + 0x30))(piVar5,"attackerentid",iVar7);
uVar2 = *(uint *)(param_1 + 0x30);
uVar11 = 1;
if (uVar2 == 0xffffffff) goto LAB_0065165a;
puVar8 = g_pEntityList + (uVar2 & 0xfff) * 0x10;
uVar11 = 1;
if ((puVar8 == (undefined *)0xfffffffc) ||
(uVar11 = *(uint *)(puVar8 + 8) == uVar2 >> 0xc, !(bool)uVar11)) goto LAB_0065165a;
pCVar3 = *(CBaseCombatCharacter **)(puVar8 + 4);
uVar11 = 1;
if (pCVar3 == (CBaseCombatCharacter *)0x0) goto LAB_0065165a;
if (this_00 == pCVar3) {
iVar7 = CBaseCombatCharacter::GetActiveWeapon(this_00);
uVar11 = iVar7 == 0;
if (!(bool)uVar11) {
iVar7 = CBaseCombatCharacter::GetActiveWeapon(this_00);
local_20 = *(char **)(iVar7 + 0x7c);
if (local_20 != (char *)0x0) goto LAB_0065171b;
uVar11 = 1;
}
goto LAB_0065165a;
}
cVar4 = (**(code **)(*(int *)pCVar3 + 0x16c))(pCVar3);
if (cVar4 == '\0') {
LAB_0065170d:
local_20 = *(char **)(pCVar3 + 0x7c);
uVar11 = 1;
if (local_20 == (char *)0x0) goto LAB_0065165a;
LAB_0065171b:
iVar7 = strncmp(local_20,"weapon_",7);
uVar11 = 0;
if (iVar7 == 0) {
pcVar9 = local_20 + 7;
goto LAB_006514f4;
}
}
else {
cVar4 = (**(code **)(*(int *)pCVar3 + 0x16c))(pCVar3);
this_01 = (CBaseEntity *)0x0;
if (cVar4 != '\0') {
this_01 = (CBaseEntity *)pCVar3;
}
iVar7 = CBaseEntity::GetTeamNumber(this_01);
if (iVar7 != 3) goto LAB_0065170d;
iVar7 = (**(code **)(*(int *)this_01 + 0x544))(this_01);
uVar11 = iVar7 == 2;
if (!(bool)uVar11) goto LAB_0065170d;
local_20 = "boomer";
}
}
}
iVar7 = 9;
pcVar9 = local_20;
pcVar10 = "hegrenade";
do {
if (iVar7 == 0) break;
iVar7 = iVar7 + -1;
uVar11 = *pcVar9 == *pcVar10;
pcVar9 = pcVar9 + (uint)bVar13 * -2 + 1;
pcVar10 = pcVar10 + (uint)bVar13 * -2 + 1;
} while ((bool)uVar11);
if ((bool)uVar11) {
local_20 = "hegrenade";
pcVar9 = local_20;
}
else {
iVar7 = 9;
pcVar9 = local_20;
pcVar10 = "pipe_bomb";
do {
if (iVar7 == 0) break;
iVar7 = iVar7 + -1;
uVar11 = *pcVar9 == *pcVar10;
pcVar9 = pcVar9 + (uint)bVar13 * -2 + 1;
pcVar10 = pcVar10 + (uint)bVar13 * -2 + 1;
} while ((bool)uVar11);
if ((bool)uVar11) {
local_20 = "pipe_bomb";
pcVar9 = local_20;
}
else {
iVar7 = 9;
bVar12 = false;
pcVar9 = local_20;
pcVar10 = "flashbang";
do {
if (iVar7 == 0) break;
iVar7 = iVar7 + -1;
bVar12 = *pcVar9 == *pcVar10;
pcVar9 = pcVar9 + (uint)bVar13 * -2 + 1;
pcVar10 = pcVar10 + (uint)bVar13 * -2 + 1;
} while (bVar12);
if (bVar12) {
local_20 = "flashbang";
pcVar9 = local_20;
}
else {
iVar7 = 0xc;
pcVar9 = local_20;
pcVar10 = "smokegrenade";
do {
if (iVar7 == 0) break;
iVar7 = iVar7 + -1;
bVar12 = *pcVar9 == *pcVar10;
pcVar9 = pcVar9 + (uint)bVar13 * -2 + 1;
pcVar10 = pcVar10 + (uint)bVar13 * -2 + 1;
} while (bVar12);
pcVar9 = "smokegrenade";
if (!bVar12) {
pcVar9 = local_20;
}
}
}
}
LAB_006514f4:
local_20 = pcVar9;
(**(code **)(*piVar5 + 0x3c))(piVar5,"weapon",local_20);
(**(code **)(*piVar5 + 0x30))(piVar5,"priority",5);
(**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar5,0);
return;
}
SourceMod gamedata
paste intoaddons/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.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.