PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fakemeta>
#include <fakemeta_util>
new pcvar_gravity,pcvar_velocity
public plugin_init()
{
register_clcmd("say /sm", "smoke")
register_forward(FM_SetModel,"fw_SetModel")
pcvar_gravity = register_cvar("sw_snowball_gravity","0.3")
pcvar_velocity = register_cvar("sw_snowball_velocity","2.0")
}
public fw_SetModel(ent,const model[])
{
//Check ent validity
if(!pev_valid(ent))
return FMRES_IGNORED
//If model is equal to HE model, change it to snowball model
if(equali(model,"models/w_smokegrenade.mdl"))
{
//get owner to renew his ammo
new Float:velocity[3],owner = pev(ent,pev_owner)
//Set less gravity, so it will be "real" snowball
set_pev(ent,pev_gravity,get_pcvar_float(pcvar_gravity))
//Get grenade velocity
pev(ent, pev_velocity, velocity)
//Calculate new velocity
velocity[0] *= get_pcvar_float(pcvar_velocity)
velocity[1] *= get_pcvar_float(pcvar_velocity)
velocity[2] *= get_pcvar_float(pcvar_velocity)
//Set new velocity
set_pev(ent, pev_velocity,velocity)
return FMRES_SUPERCEDE
}
return FMRES_IGNORED
}
public smoke( id )
{
give_item( id, "weapon_smokegrenade" );
cs_set_user_bpammo( id, CSW_SMOKEGRENADE, 100 );
}
I Fixed It
Hope I help some one