All pastes #408187 Raw Edit

Miscellany

public text v1 · immutable
#408187 ·published 2007-03-24 17:38 UTC
rendered paste body
#include <amxmodx> 
#include <fakemeta> 

new VIEW_MODEL[]    = "models/v_newKnife.mdl" 

new OLDWORLD_MODEL[]    = "models/w_knife.mdl"

public plugin_init() 
{
    register_plugin("new plugin","0.1","SAMURAI");
    register_event("CurWeapon", "Event_CurWeapon", "be","1=1")
    register_forward(FM_SetModel, "fw_SetModel")
} 

public plugin_precache() 
{    
	precache_model(VIEW_MODEL);

} 

public Event_CurWeapon(id) 
{     
	new weaponID = read_data(2);

	if(weaponID != CSW_KNIFE)
		return PLUGIN_CONTINUE;

	set_pev(id, pev_viewmodel2, VIEW_MODEL);
    
	return PLUGIN_CONTINUE 
}

public fw_SetModel(entity, model[])
{
	if(!pev_valid(entity)) 
		return FMRES_IGNORED

	if(!equali(model, OLDWORLD_MODEL)) 
		return FMRES_IGNORED;

	new className[33];
	pev(entity,pev_classname,className,31);
    
	return FMRES_IGNORED;
}