Laser Bullets

I posted this but It was in the wrong section so yeah

How you would go about making it so that in your gamemode when you fire a weapon, a colored beam goes to where you shoot at for like, half a second?

In cl_init, put the PrimaryAttack hook, Use **[Player.GetEyeTraceNoCursor

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Player.GetEyeTraceNoCursor)** to find the point you look at, make a beam using **[Render.AddBeam

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Render.AddBeam)**

Im new to working with AddBeam. I tried to get it working but when I fire, nothing shows up. This is what I tried. It’s in cl_init.

[lua]
function LaserShot()
render.SetMaterial(laser);
render.StartBeam(2);
render.AddBeam(Vector(),32,CurTime(),Color(0,0,255,255));
render.AddBeam(LocalPlayer():GetEyeTraceNoCursor(),32,CurTime()+1,Color(0,0,255,255));
render.EndBeam();
end
hook.Add(“PrimaryAttack”,“LaserShot”,LaserShot)
[/lua]

Can anyone explain what I’m doing wrong?

I heard GetEyeAngles is faster, don’t know for sure though

GetEyeTrace uses GetEyePosition and GetEyeAngles, and you have to use trace to find hit point.

What does this error message mean? I get it when I call my function via the console



Warning: You're trying to render in the wrong place. This doesn't play nice with multi-core rendering, so we're not going to let you draw here.
Warning: You're trying to render in the wrong place. This doesn't play nice with multi-core rendering, so we're not going to let you draw here.
AddBeam: Error - added too many beams![0/0]
AddBeam: Error - added too many beams![0/0]


How would I use tracers to do that?