WeaponTypeFromWeaponID
0x0043bd10 · 174 bytes · __cdecl
_Z22WeaponTypeFromWeaponID10CSWeaponID
Decompiled
undefined (1 param)
/* WeaponTypeFromWeaponID(CSWeaponID) */
undefined4 WeaponTypeFromWeaponID(int param_1)
{
ushort uVar1;
ushort uVar2;
undefined4 uVar3;
int iVar4;
int in_GS_OFFSET;
char local_90 [128];
int local_10;
local_10 = *(int *)(in_GS_OFFSET + 0x14);
uVar3 = WeaponIDToAlias(param_1);
V_snprintf(local_90,0x80,"weapon_%s",uVar3);
uVar1 = LookupWeaponInfoSlot(local_90);
uVar2 = GetInvalidWeaponInfoHandle();
if (uVar1 != uVar2) {
iVar4 = GetFileWeaponInfoFromHandle(uVar1);
if (iVar4 != 0) {
iVar4 = __dynamic_cast(iVar4,&FileWeaponInfo_t::typeinfo,&CCSWeaponInfo::typeinfo,0);
if (iVar4 != 0) {
uVar3 = *(undefined4 *)(iVar4 + 0x894);
goto LAB_0043bd6c;
}
}
}
uVar3 = 0x10;
LAB_0043bd6c:
if (local_10 == *(int *)(in_GS_OFFSET + 0x14)) {
return uVar3;
}
/* 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.