CTeamplayRules::TeamWithFewestPlayers
0x004d1620 · 179 bytes · __thiscall
_ZN14CTeamplayRules21TeamWithFewestPlayersEv
Decompiled
undefined (1 param)
/* CTeamplayRules::TeamWithFewestPlayers() */
undefined4 * __thiscall CTeamplayRules::TeamWithFewestPlayers(CTeamplayRules *this)
{
int *piVar1;
code *pcVar2;
CBaseEntity *this_00;
undefined4 uVar3;
int iVar4;
undefined4 *puVar5;
int iVar6;
undefined4 *puVar7;
int *piVar8;
int local_9c [35];
piVar8 = local_9c;
for (iVar6 = 0x20; iVar6 != 0; iVar6 = iVar6 + -1) {
*piVar8 = 0;
piVar8 = piVar8 + 1;
}
iVar6 = 1;
if (0 < *(int *)(gpGlobals + 0x14)) {
do {
this_00 = (CBaseEntity *)UTIL_PlayerByIndex(iVar6);
if (this_00 != (CBaseEntity *)0x0) {
pcVar2 = *(code **)(*(int *)this + 0x1b0);
uVar3 = CBaseEntity::TeamID(this_00);
iVar4 = (*pcVar2)(this,uVar3);
if (-1 < iVar4) {
local_9c[iVar4] = local_9c[iVar4] + 1;
}
}
iVar6 = iVar6 + 1;
} while (iVar6 <= *(int *)(gpGlobals + 0x14));
}
if (num_teams < 1) {
puVar5 = (undefined4 *)0x0;
}
else {
piVar8 = local_9c;
puVar7 = &team_names;
iVar6 = 0x20;
piVar1 = piVar8 + num_teams;
puVar5 = (undefined4 *)0x0;
do {
if (*piVar8 < iVar6) {
puVar5 = puVar7;
iVar6 = *piVar8;
}
piVar8 = piVar8 + 1;
puVar7 = puVar7 + 4;
} while (piVar8 != piVar1);
}
return puVar5;
}
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.