• Printer Error On Explotion
    2 replies, posted
I have a printer that changes color rapidly with a 0.4 timer. When the printer explodes, an error comes up regarding a null entity. How do I fix this? [ERROR] addons/tierprinters/lua/entities/tier5/cl_init.lua:17: Tried to use a NULL entity! 1. SetColor - [C]:-1 2. unknown - addons/tierprinters/lua/entities/tier5/cl_init.lua:17 [url]http://pastie.org/10339734[/url]
when it explodes, stop the timer. this happened me a lot, easy to fix.
[QUOTE=DaRkWoRlD1337;48416722]when it explodes, stop the timer. this happened me a lot, easy to fix.[/QUOTE] How do I do this? [editline]9th August 2015[/editline] include("shared.lua") function ENT:Initialize() end local nextColorChange = 0 function ENT:Draw() self:DrawModel() if SysTime() >= nextColorChange then nextColorChange = SysTime() + 0.4 -- 0.4 means every 0.4 seconds it will change colour local col = Color( math.random( 0, 255 ), math.random( 0, 255 ), math.random( 0, 255 ) ) self:SetColor( col ) end local Pos = self:GetPos() local Ang = self:GetAngles() local owner = self:Getowning_ent() owner = (IsValid(owner) and owner:Nick()) or "unknown" txt1 = "Nuclear Printer" txt2 = "$" ..self:GetNWInt("PrintA") surface.SetFont("HUDNumber5") local TextWidth = surface.GetTextSize(txt1) local TextWidth2 = surface.GetTextSize(txt2) local TextWidth3 = surface.GetTextSize(owner) Ang:RotateAroundAxis(Ang:Up(), 90) cam.Start3D2D(Pos + Ang:Up() * 4.5, Ang, 0.11) draw.WordBox(2, -TextWidth3*0.5, -78, owner, "HUDNumber5", Color(0, 0, 0, 100), Color(255,255,255,255)) draw.WordBox(2, -TextWidth*0.5, -30, txt1, "HUDNumber5", Color(0, 0, 0, 100), Color(255,255,255,255)) draw.WordBox(2, -TextWidth2*0.5, 18, txt2, "HUDNumber5", Color(0, 0, 0, 100), Color(255,255,255,255)) cam.End3D2D() end function ENT:Think() end
Sorry, you need to Log In to post a reply to this thread.