All pastes #409468 Raw Edit

Someone

public text v1 · immutable
#409468 ·published 2007-03-25 18:44 UTC
rendered paste body
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <csx>

#define PLUGIN "new hegrenstuff"
#define VERSION "1.0"
#define AUTHOR "SAMURAI"

new g_sprite;

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	register_forward(FM_EmitSound,"fw_emitsound");
}

public plugin_precache()
{
	g_sprite = precache_model("sprites/new_zerog-frag1.spr");
}


public fw_emitsound(entity,channel,const sample[],Float:volume,Float:attenuation,fFlags,pitch)
{
	if(!equali(sample,"weapons/hegrenade-1.wav") && !equali(sample,"weapons/hegrenade-2.wav"))
		return FMRES_IGNORED;
		
	he_grenade_explode(entity);
	
	return FMRES_IGNORED;
	
}

public grenade_throw(id,ent,wid)
{
	if(wid != CSW_HEGRENADE)
		return;
	
	set_pev(ent,pev_nextthink,get_gametime() + 9999.0);
}

public he_grenade_explode(ent)
{
	if(!pev_valid(ent))
		return;
		
	static Float:origin[3]
	pev(ent,pev_origin,origin);
	
	message_begin(MSG_BROADCAST,SVC_TEMPENTITY) 
	write_byte(TE_EXPLOSION)
	write_coord(floatround(origin[0]))
 	write_coord(floatround(origin[1]))
	write_coord(floatround(origin[2]))
 	write_short(g_sprite)
 	write_byte(40)
 	write_byte(5)
 	write_byte(15)
	message_end();
}