Code:
#include <amxmodx>
#include <hamsandwich>
new const g_szWeaponList[][] =
{
"weapon_usp",
"weapon_glock18",
"weapon_deagle",
"weapon_p228",
"weapon_elite",
"weapon_fiveseven",
"weapon_m3",
"weapon_xm1014",
"weapon_mp5navy",
"weapon_tmp",
"weapon_p90",
"weapon_mac10",
"weapon_ump45",
"weapon_famas",
"weapon_sg552",
"weapon_ak47",
"weapon_m4a1",
"weapon_aug",
"weapon_scout",
"weapon_awp",
"weapon_g3sg1",
"weapon_sg550",
"weapon_galil",
"weapon_m249",
"weapon_hegrenade",
"weapon_smokegrenade",
"weapon_flashbang",
"weapon_c4",
"weapon_shield"
};
// Extra offsets
#define linux_weapons_diff 4
#define mac_weapons_diff linux_weapons_diff // not sure if mac is using the same
// CBasePlayerItem
#define m_pPlayer 41
#define HOOK_COUNT 1 * (sizeof g_szWeaponList)
new HamHook:hamhooks[HOOK_COUNT];
public plugin_precache()
{
new count = 0;
for( new i; i < sizeof g_szWeaponList; i++ )
{
hamhooks[count++] = RegisterHam( Ham_Item_Deploy, g_szWeaponList[i], "Ham_Item_Deploy_Post", true );
}
}
public plugin_init()
{
for( new i; i < sizeof hamhooks; i++ )
{
EnableHamForward( hamhooks[i] );
}
}
public plugin_pause()
{
for ( new i; i < sizeof hamhooks; i++ )
{
DisableHamForward( hamhooks[i] );
}
}
public plugin_unpause()
{
for ( new i; i < sizeof hamhooks; i++ )
{
EnableHamForward( hamhooks[i] );
}
}
public Ham_Item_Deploy_Post( iItem )
{
new iPlayer;
iPlayer = get_pdata_cbase(iItem, m_pPlayer, linux_weapons_diff, mac_weapons_diff);
// do stuff
}