Try this.. when a weapon is touched/picked up, check the pev_iuser2 value of the entity [ pev( [entity id] , pev_iuser2 ) ], if it's 1, then it had the model set. If your plugin removes the models, then be sure to call set_pev( iEntID , pev_iuser2 , 0 ) on it.
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#define m_pActiveItem 373
#define XO_PLAYER 5
new V_MODEL[64] = "models/new/v_ak47.mdl"
new P_MODEL[64] = "models/new/p_ak47.mdl"
new iSelect[ MAX_PLAYERS + 1 ];
public plugin_init()
{
register_event("CurWeapon","CurrentWeapon","be","1=1")
}
public CurrentWeapon(id)
{
replace_weapon_models(id, read_data(2))
}
replace_weapon_models(id, weaponid)
{
new iEntID;
switch ( weaponid )
{
case CSW_AK47:
{
if ( iSelect[ id ] )
{
set_pev(id, pev_viewmodel2, V_MODEL)
set_pev(id, pev_weaponmodel2, P_MODEL)
if ( ( iEntID = get_pdata_cbase( id , m_pActiveItem , XO_PLAYER ) ) > 0 )
{
set_pev( iEntID , pev_iuser2 , 1 );
}
}
}
}
}
__________________