#include <amxmodx>
#include <fakemeta> 
#include <zombieplague>

#define TASK_TRACER 27777

new PLUG[] = "[ZP] Addon: Survivor Tracers"
new VERS[] = "1.2"
new AUTH[] = "eXacT"

new gTracersTime

public plugin_init() 
{
	register_plugin(PLUG, VERS, AUTH)
    
	gTracersTime = register_cvar("zp_survivor_tracers_time", "0.1")
}

public zp_user_humanized_post(id)
{
	if(zp_get_user_survivor(id))
	{
		set_task(get_pcvar_float(gTracersTime), "GiveTracers", id+TASK_TRACER, _, _, "b")
	}
}  

public GiveTracers(id)
{
	id -= TASK_TRACER
    
	if(!is_user_alive(id) || !zp_get_user_survivor(id) || zp_get_user_zombie(id))
	{
		remove_task(id+TASK_TRACER)
		return;
	}
    
	new Float:Origin[3]
	pev(id, pev_origin, Origin)
    
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, Origin, 0)
	write_byte(TE_IMPLOSION)
	engfunc(EngFunc_WriteCoord, Origin[0]) 
	engfunc(EngFunc_WriteCoord, Origin[1]) 
	engfunc(EngFunc_WriteCoord, Origin[2]) 
	write_byte(128) 
	write_byte(20) 
	write_byte(3) 
	message_end()
}  