WeaponNameToIDForStats
0x008de9d0 · 289 bytes · __regparm3
_ZL22WeaponNameToIDForStatsP13CTerrorPlayerPKc
Decompiled
undefined (2 params)
/* WeaponNameToIDForStats(CTerrorPlayer*, char const*) */
int __regparm3 WeaponNameToIDForStats(CTerrorPlayer *param_1,char *param_2)
{
int iVar1;
char *pcVar2;
int iVar3;
CTerrorMeleeWeapon *this;
byte *pbVar4;
byte *pbVar5;
bool bVar6;
bool bVar7;
byte bVar8;
bVar8 = 0;
if (param_2 == (char *)0x0) {
return -1;
}
if (param_1 == (CTerrorPlayer *)0x0) {
return -1;
}
iVar1 = CBaseEntity::GetTeamNumber((CBaseEntity *)param_1);
if (iVar1 == 3) {
return -1;
}
if (param_1[0x33bc] != (CTerrorPlayer)0x0) {
return 0x13;
}
iVar1 = _V_stricmp("prop_minigun",param_2);
if (iVar1 == 0) {
return 0x13;
}
iVar1 = _V_stricmp("prop_minigun_l4d1",param_2);
bVar6 = false;
if (iVar1 == 0) {
return 0x13;
}
iVar1 = 7;
bVar7 = false;
pbVar4 = (byte *)param_2;
pbVar5 = (byte *)"weapon_";
do {
if (iVar1 == 0) break;
iVar1 = iVar1 + -1;
bVar6 = *pbVar4 < *pbVar5;
bVar7 = *pbVar4 == *pbVar5;
pbVar4 = pbVar4 + (uint)bVar8 * -2 + 1;
pbVar5 = pbVar5 + (uint)bVar8 * -2 + 1;
} while (bVar7);
if ((!bVar6 && !bVar7) == bVar6) {
param_2 = param_2 + 7;
}
iVar1 = _V_stricmp("melee",param_2);
if ((((iVar1 == 0) && (iVar1 = CTerrorPlayer::GetActiveTerrorWeapon(param_1), iVar1 != 0)) &&
(this = (CTerrorMeleeWeapon *)
__dynamic_cast(iVar1,&CBaseCombatWeapon::typeinfo,&CTerrorMeleeWeapon::typeinfo,0),
this != (CTerrorMeleeWeapon *)0x0)) &&
(iVar1 = CTerrorMeleeWeapon::GetMeleeWeaponInfo(this), iVar1 != 0)) {
param_2 = (char *)(iVar1 + 0xc50);
}
else if (param_2 == (char *)0x0) {
return -1;
}
iVar1 = 0;
pcVar2 = "pistol";
do {
iVar3 = _V_stricmp(pcVar2,param_2);
if (iVar3 == 0) {
return iVar1;
}
iVar1 = iVar1 + 1;
pcVar2 = *(char **)(L4D_WEAPON_STATS::WeaponStatsTitle + iVar1 * 4);
} while (pcVar2 != (char *)0x0);
return -1;
}
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.