AverageMembersSkills
0x00035430 · 445 bytes · __cdecl
_Z20AverageMembersSkillsP9KeyValuesPKci
Decompiled
undefined (3 params)
/* AverageMembersSkills(KeyValues*, char const*, int) */
int AverageMembersSkills(KeyValues *param_1,char *param_2,int param_3)
{
int iVar1;
KeyValues *this;
int iVar2;
KeyValues *this_00;
int iVar3;
int iVar4;
int in_GS_OFFSET;
int local_148;
int local_140;
int local_13c;
CFmtStrN<256> local_12c [5];
char local_127 [263];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
iVar1 = KeyValues::GetInt(param_1,"members/numMachines",0);
if (0 < iVar1) {
local_148 = 0;
local_140 = 0;
local_13c = 0;
do {
CFmtStrN<256>::CFmtStrN(local_12c,"members/machine%d",local_148);
this = (KeyValues *)KeyValues::FindKey(param_1,local_127,false);
iVar2 = KeyValues::GetInt(this,"numPlayers",0);
if (0 < iVar2) {
iVar4 = 0;
do {
CFmtStrN<256>::CFmtStrN(local_12c,"player%d",iVar4);
this_00 = (KeyValues *)KeyValues::FindKey(this,local_127,false);
if (this_00 != (KeyValues *)0x0) {
CFmtStrN<256>::CFmtStrN(local_12c,"game/%s",param_2);
iVar3 = KeyValues::GetInt(this_00,local_127,param_3);
local_140 = local_140 + iVar3;
local_13c = local_13c + 1;
}
iVar4 = iVar4 + 1;
} while (iVar4 != iVar2);
}
local_148 = local_148 + 1;
} while (local_148 != iVar1);
if (local_13c != 0) {
param_3 = local_140 / local_13c;
}
}
if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
return param_3;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
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.