UTIL_GetPlayerConnectionInfo
0x00b2b130 · 406 bytes · __cdecl
_Z28UTIL_GetPlayerConnectionInfoiRiS_
Decompiled
undefined (3 params)
/* UTIL_GetPlayerConnectionInfo(int, int&, int&) */
void UTIL_GetPlayerConnectionInfo(int param_1,int *param_2,int *param_3)
{
char cVar1;
CBasePlayer *this;
int *piVar2;
char *pcVar3;
int iVar4;
int iVar5;
longdouble lVar6;
float fVar7;
this = (CBasePlayer *)UTIL_PlayerByIndex(param_1);
cVar1 = CBasePlayer::IsSplitScreenPlayer(this);
if (cVar1 != '\0') {
iVar4 = CBasePlayer::GetSplitScreenPlayerOwner(this);
if (iVar4 != 0) {
this = (CBasePlayer *)CBasePlayer::GetSplitScreenPlayerOwner(this);
if (*(int *)(this + 0x30) == 0) {
param_1 = 0;
}
else {
param_1 = *(int *)(this + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
}
}
}
piVar2 = (int *)(**(code **)(*engine + 0x54))(engine,param_1);
if ((this != (CBasePlayer *)0x0) && (piVar2 != (int *)0x0)) {
cVar1 = (**(code **)(*(int *)this + 0x778))(this);
if (cVar1 == '\0') {
lVar6 = (longdouble)(**(code **)(*piVar2 + 0x28))(piVar2,0);
pcVar3 = (char *)(**(code **)(*engine + 0xe0))(engine,param_1,"cl_cmdrate");
iVar4 = V_atoi(pcVar3);
if (iVar4 < 1) {
fVar7 = 0.5;
}
else {
iVar4 = V_atoi(pcVar3);
fVar7 = 0.5 / (float)iVar4;
}
iVar4 = (int)((((float)lVar6 -
(*(float *)(gpGlobals + 0x1c) * 0.5 + *(float *)(gpGlobals + 0x1c))) - fVar7) *
1000.0);
if (iVar4 < 5) {
iVar4 = 5;
}
iVar5 = 1000;
if (iVar4 < 0x3e9) {
iVar5 = iVar4;
}
*param_2 = iVar5;
lVar6 = (longdouble)(**(code **)(*piVar2 + 0x2c))(piVar2,1);
iVar4 = (int)((float)lVar6 * 100.0);
if (iVar4 < 0) {
iVar4 = 0;
}
iVar5 = 100;
if (iVar4 < 0x65) {
iVar5 = iVar4;
}
*param_3 = iVar5;
return;
}
}
*param_2 = 0;
*param_3 = 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.