And here the complete plugin,that i have used for testing
Code:
#include <amxmodx>
new g_nCurWeapon[33][2]
public plugin_init() {
register_plugin("Colored Tracers","0.1","Schnitzelmaker")
register_event("CurWeapon","make_tracer","b")
}
public make_tracer(id){
new weaponID = read_data( 2 )
new wAmmo = read_data( 3 )
if( g_nCurWeapon[id][0] != weaponID ) // User Changed Weapons..
{
g_nCurWeapon[id][0] = weaponID
g_nCurWeapon[id][1] = wAmmo
return PLUGIN_CONTINUE
}
if( g_nCurWeapon[id][1] < wAmmo ) // User Reloaded..
{
g_nCurWeapon[id][1] = wAmmo
return PLUGIN_CONTINUE
}
if( g_nCurWeapon[id-1][1] == wAmmo ) // User did something else, but didn't shoot..
return PLUGIN_CONTINUE
g_nCurWeapon[id][1] = wAmmo
g_nCurWeapon[id][0] = weaponID
new vec1[3], Float:velocity[3],speed=100//have set the spped low to see the tracer effect
get_user_origin(id,vec1,1)
velocity_by_aim(id,speed,velocity)
#define TE_USERTRACER 127 // larger message than the standard tracer, but allows some customization.
// coord (origin)
// coord (origin)
// coord (origin)
// coord (velocity)
// coord (velocity)
// coord (velocity)
// byte ( life * 10 )
// byte ( color ) this is an index into an array of color vectors in the engine. (0 - )
// byte ( length * 10 )
message_begin(MSG_ALL,SVC_TEMPENTITY)
write_byte(127) // TE_BEAMPOINTS)
write_coord(vec1[0])
write_coord(vec1[1])
write_coord(vec1[2])
write_coord(floatround(velocity[0]))
write_coord(floatround(velocity[1]))
write_coord(floatround(velocity[2]))
write_byte(10) // Life
write_byte(1) //Color:1=red,2=green
write_byte(1000)
message_end()
return PLUGIN_CONTINUE
}
__________________