CTerrorPlayer::GetNearbyFriendCount
0x009a6770 · 401 bytes · __thiscall
_ZN13CTerrorPlayer20GetNearbyFriendCountEfb
Decompiled
undefined (3 params)
/* CTerrorPlayer::GetNearbyFriendCount(float, bool) */
int __thiscall CTerrorPlayer::GetNearbyFriendCount(CTerrorPlayer *this,float param_1,bool param_2)
{
CBaseEntity CVar1;
char cVar2;
CBaseEntity *this_00;
int iVar3;
int iVar4;
int iVar5;
int local_20;
if (*(int *)(gpGlobals + 0x14) < 1) {
local_20 = 0;
}
else {
iVar5 = 1;
local_20 = 0;
do {
this_00 = (CBaseEntity *)UTIL_PlayerByIndex(iVar5);
if ((this_00 != (CBaseEntity *)0x0) &&
(cVar2 = (**(code **)(*(int *)this_00 + 0x16c))(this_00), cVar2 != '\0')) {
if (*(int *)(this_00 + 0x30) == 0) {
iVar4 = 0;
}
else {
iVar4 = *(int *)(this_00 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
}
if (*(int *)(this + 0x30) == 0) {
iVar3 = 0;
}
else {
iVar3 = *(int *)(this + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
}
if (((iVar4 != iVar3) &&
(cVar2 = (**(code **)(*(int *)this_00 + 300))(this_00), cVar2 != '\0')) &&
(cVar2 = CBaseEntity::InSameTeam(this_00,(CBaseEntity *)this), cVar2 != '\0')) {
if (((byte)this[0x14d] & 8) == 0) {
CVar1 = this_00[0x14d];
}
else {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
CVar1 = this_00[0x14d];
}
if (((byte)CVar1 & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(this_00);
}
if ((SQRT((*(float *)(this_00 + 0x2e4) - *(float *)(this + 0x2e4)) *
(*(float *)(this_00 + 0x2e4) - *(float *)(this + 0x2e4)) +
(*(float *)(this_00 + 0x2e8) - *(float *)(this + 0x2e8)) *
(*(float *)(this_00 + 0x2e8) - *(float *)(this + 0x2e8)) +
(*(float *)(this_00 + 0x2e0) - *(float *)(this + 0x2e0)) *
(*(float *)(this_00 + 0x2e0) - *(float *)(this + 0x2e0))) < param_1) &&
((!param_2 ||
(cVar2 = CBaseCombatCharacter::IsAbleToSee((CBaseCombatCharacter *)this,this_00,1),
cVar2 != '\0')))) {
local_20 = local_20 + 1;
}
}
}
iVar5 = iVar5 + 1;
} while (iVar5 <= *(int *)(gpGlobals + 0x14));
}
return local_20;
}
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.