/* AMX Mod script.
*
* (c) Copyright 2002, OLO
* This file is provided as is (no warranties).
*
*/

#include <amxmod>

new lastwpn[33]
new lastammo[33]
new lastsend[33]

public make_tracer(id)
{
	new wpn = read_data(2)
	new ammo = read_data(3)
	if ( (lastwpn[id]==wpn) && (lastammo[id]>ammo) && (++lastsend[id] > 6) ) { /* every 7th bullet */
		new vec1[3], vec2[3]
		get_user_origin(id,vec1,1)
		get_user_origin(id,vec2,3)
		message_begin(MSG_PAS, SVC_TEMPENTITY,vec1 )
		write_byte( 6 ) /* TE_TRACER - see commo/const.h in HLSDK */
		write_coord(vec1[0])
		write_coord(vec1[1])
		write_coord(vec1[2])
		write_coord(vec2[0])
		write_coord(vec2[1])
		write_coord(vec2[2])
		message_end()
		lastsend[id] = 0
	}
	lastwpn[id] = wpn
	lastammo[id] = ammo
}

public plugin_init()
{
	register_plugin("Tracers","0.5","default")
	register_event("CurWeapon","make_tracer","be","1=1","2=22","2=28","3>0") /* to alive player on currently handled not empty m4a1 or ak47 */

	return PLUGIN_CONTINUE
}
