I am not sure but try to put
plugin_precache() after
plugin_init()
Also, it is a bit out of topic but you shouldn't change weapon model at
Event_CurWeapon since it will call many time cause increase in server usage.
This way is out-dated.
Now we used
Ham_Item_Deploy to set weapon model only once when you switch to that specific weapon only
PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
new const model_1[] = "models/model_1.mdl"
new const model_2[] = "models/model_2.mdl"
public plugin_init()
{
RegisterHam(Ham_Item_Deploy, "weapon_usp", "fw_Weapon_Deploy", 1) //change weapon_usp to the weapon you want to replace
}
public plugin_precache(){
precache_model(model_1)
precache_model(model_2)
}
public fw_Weapon_Deploy(ent)
{
if(pev_valid(ent) != 2)
return
static id; id = get_pdata_cbase(ent, 41, 4) //Get ID
if(get_pdata_cbase(id, 373) != ent) //373 = m_pActiveItem. This check if current weapon is correct or not
return
set_pev(id, pev_viewmodel2, model_1)
set_pev(id, pev_weaponmodel2, model_2)
}
Edit: This is assuming you are try to make CS weapon.
__________________