ForEachTerrorPlayer<ClosestSurvivorScan>
0x008c2010 · 543 bytes · __cdecl
_Z19ForEachTerrorPlayerI19ClosestSurvivorScanEbRT_
Decompiled
bool (1 param)
/* bool ForEachTerrorPlayer<ClosestSurvivorScan>(ClosestSurvivorScan&) */
bool ForEachTerrorPlayer<ClosestSurvivorScan>(ClosestSurvivorScan *param_1)
{
uint uVar1;
char cVar2;
CBaseEntity *this;
int iVar3;
float *pfVar4;
undefined *puVar5;
int iVar6;
float fVar7;
iVar6 = 1;
if (0 < *(int *)(gpGlobals + 0x14)) {
do {
this = (CBaseEntity *)UTIL_PlayerByIndex(iVar6);
if ((((((this != (CBaseEntity *)0x0) && (*(int *)(this + 0x30) != 0)) &&
(*(int *)(this + 0x30) - *(int *)(gpGlobals + 0x58) >> 4 != 0)) &&
(((cVar2 = (**(code **)(*(int *)this + 0x16c))(this), cVar2 != '\0' &&
(*(int *)(this + 0x1f6c) != 2)) &&
((this != *(CBaseEntity **)(param_1 + 0x14) &&
((cVar2 = (**(code **)(*(int *)this + 300))(this), cVar2 != '\0' &&
(iVar3 = CBaseEntity::GetTeamNumber(this), iVar3 == 2)))))))) &&
(((((cVar2 = (**(code **)(*(int *)this + 0x7e8))(this), cVar2 == '\0' &&
((((uVar1 = *(uint *)(this + 0x3e68), uVar1 == 0xffffffff ||
(puVar5 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar5 == (undefined *)0xfffffffc
)) || (*(uint *)(puVar5 + 8) != uVar1 >> 0xc)) || (*(int *)(puVar5 + 4) == 0)))) &&
(((uVar1 = *(uint *)(this + 0x33c4), uVar1 == 0xffffffff ||
(puVar5 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar5 == (undefined *)0xfffffffc))
|| ((*(uint *)(puVar5 + 8) != uVar1 >> 0xc || (*(int *)(puVar5 + 4) == 0)))))) &&
(((((uVar1 = *(uint *)(this + 0x3e48), uVar1 == 0xffffffff ||
(puVar5 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar5 == (undefined *)0xfffffffc)
) || (*(uint *)(puVar5 + 8) != uVar1 >> 0xc)) || (*(int *)(puVar5 + 4) == 0)) &&
((((uVar1 = *(uint *)(this + 0x3ee0), uVar1 == 0xffffffff ||
(puVar5 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar5 == (undefined *)0xfffffffc)
) || (*(uint *)(puVar5 + 8) != uVar1 >> 0xc)) || (*(int *)(puVar5 + 4) == 0)))))) ||
(param_1[0x18] != (ClosestSurvivorScan)0x0)))) &&
(((param_1[0x19] == (ClosestSurvivorScan)0x0 ||
(iVar3 = (**(code **)(*(int *)this + 0x52c))(this), iVar3 == 0)) ||
((*(byte *)(iVar3 + 0x12d) & 0x80) == 0)))) {
pfVar4 = (float *)(**(code **)(*(int *)this + 0x288))(this);
fVar7 = (*pfVar4 - *(float *)param_1) * (*pfVar4 - *(float *)param_1) +
(pfVar4[1] - *(float *)(param_1 + 4)) * (pfVar4[1] - *(float *)(param_1 + 4)) +
(pfVar4[2] - *(float *)(param_1 + 8)) * (pfVar4[2] - *(float *)(param_1 + 8));
if (fVar7 < *(float *)(param_1 + 0x10)) {
*(float *)(param_1 + 0x10) = fVar7;
*(CBaseEntity **)(param_1 + 0xc) = this;
}
}
iVar6 = iVar6 + 1;
} while (iVar6 <= *(int *)(gpGlobals + 0x14));
}
return true;
}
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.