Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#define SVEN_RPG 8
public plugin_init(){
register_plugin("Gun Replacement","1.0","Lord Saddler/Angel killer")
register_clcmd("say !rpg_1","rpg_on",0,"Switch to custom rpg model")
register_clcmd("say !rpg_0","rpg_off",0,"Switch to normal rpg model")
}
public rpg_on(id){
if(!is_user_alive(id)){
return PLUGIN_HANDLED
}
new clip, ammo
new weap = get_user_weapon(id,clip,ammo)
if(weap == 8){ //<--- Replace with a different weapon constant to replace another weapon
entity_set_string(id, EV_SZ_viewmodel, "models/gargr/p_snarkrpg.mdl")//<--- Change the model name for different weapons
entity_set_string(id, EV_SZ_weaponmodel, "models/gargr/v_snarkrpg.mdl")//<--- Change the model name for different weapons
}
return PLUGIN_CONTINUE
}
public rpg_off(id){
if(!is_user_alive(id)){
return PLUGIN_HANDLED
}
new clip, ammo
new weap = get_user_weapon(id,clip,ammo)
if(weap == 8){
entity_set_string(id, EV_SZ_viewmodel, "models/gargr/p_rpg.mdl")
entity_set_string(id, EV_SZ_weaponmodel, "models/gargr/v_rpg.mdl")
}
return PLUGIN_CONTINUE
}
public plugin_precache(){
precache_model("models/gargr/p_snarkrpg.mdl")
precache_model("models/gargr/v_snarkrpg.mdl")
precache_model("models/gargr/p_rpg.mdl")
precache_model("models/gargr/v_rpg.mdl")
}