hello, I keep getting this error in my console randomly
[lua]
[ERROR] addons/darkrpmodification/lua/entities/k_printer_upgrade/cl_init.lua:5: Tried to use a NULL entity!
1. GetClass - [C]:-1
2. fn - addons/darkrpmodification/lua/entities/k_printer_upgrade/cl_init.lua:5
3. unknown - addons/ulib/lua/ulib/shared/hook.lua:183
[/lua]
I used these printers [url]http://www.facepunch.com/showthread.php?t=1282076[/url]
Can you post the first 10 lines of the cl_init?
[QUOTE=code_gs;46000970]Can you post the first 10 lines of the cl_init?[/QUOTE]
Here is the whole thing, 15 lines.
[lua]
include("shared.lua")
function DrawInformation()
local tr = LocalPlayer():GetEyeTrace();
if not ( tr.Entity:GetClass() == "money_printer_upgrade" ) then return end;
local w = 84
if IsValid( tr.Entity ) and tr.Entity:GetPos():Distance( LocalPlayer():GetPos() ) < 100 then
draw.RoundedBox( 4, ScrW() / 2 - ( w / 2 ), ScrH() / 2 - 40, w, 20, Color( 255, 255, 255, 100 ) );
draw.SimpleText( "Printer Upgrade", "DermaDefault", ScrW() / 2, ScrH() / 2 - 30, color_black, 1, 1 );
end;
end;
function ENT:Draw()
self.Entity:DrawModel()
DrawInformation()
end
hook.Add( "HUDPaint", "KUpgradeNotif", DrawInformation );
[/lua]
Make sure the trace is valid on Line 5.
You could use the same check which is being used on line 8.
This was fixed already... By me
[editline]16th September 2014[/editline]
Next time post on the thread you got it from rather then making a new thread for something that has been fixed already.
[url]http://facepunch.com/showthread.php?t=1282076[/url]
[editline]16th September 2014[/editline]
[QUOTE=The Beta;46001034]Make sure the trace is valid on Line 5.
You could use the same check which is being used on line 8.[/QUOTE]
haha you told me "Because the trace is not valid when outside the map"
glad you gave a bit more info when helping this guy haha
[editline]16th September 2014[/editline]
Aight since I am kinda a nice person I'll post this so you don't have to find my post ;P
[IMG]http://i.gyazo.com/c76fb1d7a66e7c53753fc29b9f813d20.png[/IMG]
[QUOTE=Chibby;46001039]This was fixed already... By me
[editline]16th September 2014[/editline]
Next time post on the thread you got it from rather then making a new thread for something that has been fixed already.
[url]http://facepunch.com/showthread.php?t=1282076[/url]
[editline]16th September 2014[/editline]
haha you told me "Because the trace is not valid when outside the map"
glad you gave a bit more info when helping this guy haha
[editline]16th September 2014[/editline]
Aight since I am kinda a nice person I'll post this so you don't have to find my post ;P
[IMG]http://i.gyazo.com/c76fb1d7a66e7c53753fc29b9f813d20.png[/IMG][/QUOTE]
Thanks for the help, I'll look over things more carefully in the future
haha who ever rated my post dumb should be banned for being a dumbass.
I helped him, unlike you kids that come on here to rate peoples posts dumb.
[highlight](User was banned for this post ("Flaming + cares about ratings" - Craptasket))[/highlight]
Quick question though, when you say replace line 5, do you mean delete the 5th line and replace it with this:
[lua] if !IsValid(tr.Entity) or tr.Entity:GetClass() != "money_printer_upgrade" then return end
[/lua]
and what do you mean by "do the same for the printer upgrade?"
My english is not well
Yes replace line 5, and you have to replace line 5 in the printer upgrade cl_init.lua as well
Thank you!
Sorry, you need to Log In to post a reply to this thread.