Try this :
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#define PLUGIN "Drop Gun Before Shield"
#define VERSION "0.0.1"
#define INT_BYTES 4
#define BYTE_BITS 8
#define m_pActiveItem 373
#define m_bHasShield 2043
public plugin_init()
{
register_plugin( PLUGIN, VERSION, "ConnorMcLeod" )
register_clcmd("drop", "ClCmd_Drop")
}
public ClCmd_Drop( id )
{
if( is_user_alive(id) && get_pdata_bool(id, m_bHasShield) )
{
new iActiveWeapon = get_pdata_cbase(id, m_pActiveItem)
if( iActiveWeapon > 0 && ExecuteHam(Ham_Item_ItemSlot, iActiveWeapon) == 2 )
{
set_pdata_bool(id, m_bHasShield, false)
engclient_cmd(id, "drop")
set_pdata_bool(id, m_bHasShield, true)
new iActiveWeapon = get_pdata_cbase(id, m_pActiveItem)
if( iActiveWeapon > 0 )
{
ExecuteHamB(Ham_Item_Deploy, iActiveWeapon)
}
return PLUGIN_HANDLED
}
}
return PLUGIN_CONTINUE
}
bool:get_pdata_bool(ent, charbased_offset, intbase_linuxdiff = 5)
{
return !!( get_pdata_int(ent, charbased_offset / INT_BYTES, intbase_linuxdiff) & (0xFF<<((charbased_offset % INT_BYTES) * BYTE_BITS)) )
}
set_pdata_bool(ent, charbased_offset, bool:value, intbase_linuxdiff = 5)
{
set_pdata_char(ent, charbased_offset, _:value, intbase_linuxdiff)
}
set_pdata_char(ent, charbased_offset, value, intbase_linuxdiff = 5)
{
value &= 0xFF
new int_offset_value = get_pdata_int(ent, charbased_offset / INT_BYTES, intbase_linuxdiff)
new bit_decal = (charbased_offset % INT_BYTES) * BYTE_BITS
int_offset_value &= ~(0xFF<<bit_decal) // clear byte
int_offset_value |= value<<bit_decal
set_pdata_int(ent, charbased_offset / INT_BYTES, int_offset_value, intbase_linuxdiff)
return 1
}
__________________