1.1 --- a/extensions/cstrike/util_cstrike.cpp Fri Dec 14 15:07:47 2012 -0500
1.2 +++ b/extensions/cstrike/util_cstrike.cpp Fri Dec 14 15:12:22 2012 -0500
1.3 @@ -129,6 +129,35 @@
1.4 pWrapper->Execute(vstk, &weaponID);
1.5
1.6 return weaponID;
1.7 +}
1.8 +
1.9 +const char *WeaponIDToAlias(int weaponID)
1.10 +{
1.11 + static ICallWrapper *pWrapper = NULL;
1.12 +
1.13 + if (!pWrapper)
1.14 + {
1.15 + REGISTER_ADDR("WeaponIDToAlias", 0,
1.16 + PassInfo pass[1]; \
1.17 + PassInfo retpass; \
1.18 + pass[0].flags = PASSFLAG_BYVAL; \
1.19 + pass[0].type = PassType_Basic; \
1.20 + pass[0].size = sizeof(int); \
1.21 + retpass.flags = PASSFLAG_BYVAL; \
1.22 + retpass.type = PassType_Basic; \
1.23 + retpass.size = sizeof(const char *); \
1.24 + pWrapper = g_pBinTools->CreateCall(addr, CallConv_Cdecl, &retpass, pass, 1))
1.25 + }
1.26 + const char *ret = NULL;
1.27 +
1.28 + unsigned char vstk[sizeof(int)];
1.29 + unsigned char *vptr = vstk;
1.30 +
1.31 + *(int *)vptr = GetRealWeaponID(weaponID);
1.32 +
1.33 + pWrapper->Execute(vstk, &ret);
1.34 +
1.35 + return ret;
1.36 }
1.37 int GetRealWeaponID(int weaponId)
1.38 {