// Ivan's Advanced Tracer Plugin 0.25 by Ivan <-g-s-ivan@web.de>
// Basing on the original Tracer Script by OLO
Changelog from 0.1 to 0.25
* Added check for CS, now when firing tracers will go to the hitpoint, not the aimpoint
* Added Adminclientcommands for setting Tracers, amx_settracers & amx_setamplitude
* Renamed CVAR amx_ln to amx_tracers_ln
* Lightning Tracers won't start in the middle of your screen anymore (now they come from the lower end - isn't that nasty to look at)
* Now the last shot in mag makes tracers too.
* Some Speed/CPU usage tweaks.
* Better compatibilty with other Mods.
// VERY VERY CPU optimized version.
new tracers, ln, is_cs = 0;
lightning(vec1[3],vec2[3])
message_begin( MSG_BROADCAST,SVC_TEMPENTITY);
write_byte( 1 ); // framestart
write_byte( 5 ); // framerate
write_byte( 20 ); // width
//write_byte( 30 ); // noise
write_byte( 200 ); // r, g, b
write_byte( 200 ); // r, g, b
write_byte( 200 ); // r, g, b
write_byte( 200 ); // brightness
write_byte( 200 ); // speed
tracer(vec1[3],vec2[3]) {
message_begin(MSG_PAS, SVC_TEMPENTITY,vec1 );
write_byte( 6 ) /* TE_TRACER - see commo/const.h in HLSDK */
new ammo = read_data(3), weapon = read_data(2); // I read it only once to save CPU time.
if(users_ammo[id]>ammo && ammo>=0 && users_w[id]==weapon) {
get_user_origin(id,vec1);
// For lightnings we do it a special way, 'cause lightnings from eye positon look shit
get_user_origin(id,vec1,1);
get_user_origin(id,vec2,4);
get_user_origin(id,vec2,3);
if(is_cs == 1 && (weapon==CSW_M3 || weapon==CSW_XM1014)) { // Shotguns in CS
vec2[0]-=SHOTGUN_AIMING; // Repeated substraction is faster then multiplication !
vec2[0]-=SHOTGUN_AIMING; // Repeated substraction is faster then multiplication !
vec2[1]-=SHOTGUN_AIMING; // Repeated substraction is faster then multiplication !
vec2[1]-=SHOTGUN_AIMING; // Repeated substraction is faster then multiplication !
vec2[2]-=SHOTGUN_AIMING; // Repeated substraction is faster then multiplication !
vec2[2]-=SHOTGUN_AIMING; // Repeated substraction is faster then multiplication !
public checktracervars() {
tracers = get_cvar_num("amx_tracers");
ln = get_cvar_num("amx_tracers_ln");
public amx_settracers(id)
client_print(id,print_console,"[AMX] Advanced Tracers> Tracer mode set to 1, Normal Tracers.");
client_print(id,print_console,"[AMX] Advanced Tracers> Tracer mode set to 2, Lightning Tracers.");
} else if(nt==0 && equal(arg1,"0")) {
client_print(id,print_console,"[AMX] Advanced Tracers> Tracer mode set to 0, No Tracers.");
client_print(id,print_console,"[AMX] Advanced Tracers> Please type 0, 1 or 2!");
set_cvar_num("amx_tracers",tracers);
public amx_setamplitude(id)
client_print(id,print_console,"[AMX] Advanced Tracers> Amplitude for Lightning Tracers set to %d.",na);
set_cvar_num("amx_tracers_ln",ln);
light = precache_model("sprites/lgtning.spr");
register_plugin("Advanced Tracers","0.1","-g-s-ivan@web.de");
register_event("CurWeapon","drawtracer","be","1=1"); //,"3>=0");
register_cvar("amx_tracers","1")
register_cvar("amx_tracers_ln","30");
register_concmd("amx_settracers","amx_settracers",ADMIN_LEVEL_A,"<0|1|2> Set tracer mode.");
register_concmd("amx_setamplitude","amx_setamplitude",ADMIN_LEVEL_A,"<noise> Noise for lightning tracers.");
set_task(5.0,"checktracervars",0,"",0,"b");
if(equal(modname,"cstrike")) is_cs = 1;