[lua]
caller:SendLua( [[ chat.AddText ( Color(0, 255, 0), "Oven is now turned ON!" ) ]] )
[/lua]
are you serious
[lua]local tr1 = {}
start = self:GetPos()+(self:GetUp()*20)+(self:GetForward()*2.8)+(self:GetRight()*11.5);
endpos = self:GetPos()+(self:GetUp()*24)+(self:GetForward()*2.8)+(self:GetRight()*11.5);
filter = self[/lua]
You're setting the global start, endpos and filter, instead of putting them inside the table:
[lua]local tr1 = {}
tr1.start = self:GetPos()+(self:GetUp()*20)+(self:GetForward()*2.8)+(self:GetRight()*11.5);
tr1.endpos = self:GetPos()+(self:GetUp()*24)+(self:GetForward()*2.8)+(self:GetRight()*11.5);
tr1.filter = self[/lua]
Same goes for the other traces.
You are defining the tr1-tr4 tables but you aren't putting startpos and endpos into them.
Replace startpos = (...) with tr1.startpos = (...)
[QUOTE=pierre0158;51880912][lua]
caller:SendLua( [[ chat.AddText ( Color(0, 255, 0), "Oven is now turned ON!" ) ]] )
[/lua]
are you serious[/QUOTE]
It's fine for debugging.
no
[lua]
caller:ChatPrint("cheeki breeki")
[/lua]
hurr durr
In gmod you almost never need to sent strings over network (expect for the chatbox, file transfer and things like that);
why the hell would you need to send a string if the client already know what is in the string, just use [lua]net.Start("yourentityuse") net.Send(caller)[/lua]
[QUOTE=pierre0158;51881055]no
[lua]
caller:ChatPrint("cheeki breeki")
[/lua]
hurr durr[/QUOTE]
Again, it's fine for debugging. And fun fact, ChatPrint networks the string internally, but can't be coloured.
[QUOTE=pierre0158;51881055]In gmod you almost never need to sent strings over network (expect for the chatbox, file transfer and things like that);
why the hell would you need to send a string if the client already know what is in the string, just use [lua]net.Start("yourentityuse") net.Send(caller)[/lua][/QUOTE]
For the record, I would happily use even [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/net/WriteTable]net.WriteTable[/url] for debugging. I agree with you that SendLua generally should never be in released code (side note, [url=https://github.com/garrynewman/garrysmod/search?utf8=%E2%9C%93&q=SendLua&type=Code]vanilla gmod uses it a lot[/url]), but literally ANY code is fine when debugging as long as it doesn't affect the thing you're actually debugging.
[QUOTE=pierre0158;51880912][lua]
caller:SendLua( [[ chat.AddText ( Color(0, 255, 0), "Oven is now turned ON!" ) ]] )
[/lua]
are you serious[/QUOTE]
I was testing to see if it can toggle. Smh...
[editline]27th February 2017[/editline]
[QUOTE=NeatNit;51881016][lua]local tr1 = {}
start = self:GetPos()+(self:GetUp()*20)+(self:GetForward()*2.8)+(self:GetRight()*11.5);
endpos = self:GetPos()+(self:GetUp()*24)+(self:GetForward()*2.8)+(self:GetRight()*11.5);
filter = self[/lua]
You're setting the global start, endpos and filter, instead of putting them inside the table:
[lua]local tr1 = {}
tr1.start = self:GetPos()+(self:GetUp()*20)+(self:GetForward()*2.8)+(self:GetRight()*11.5);
tr1.endpos = self:GetPos()+(self:GetUp()*24)+(self:GetForward()*2.8)+(self:GetRight()*11.5);
tr1.filter = self[/lua]
Same goes for the other traces.[/QUOTE]
Crap I knew I did something stupid, I'll check it out.
[editline]27th February 2017[/editline]
[QUOTE=Voluptious;51881021]You are defining the tr1-tr4 tables but you aren't putting startpos and endpos into them.
Replace startpos = (...) with tr1.startpos = (...)[/QUOTE]
Alright thanks!
[QUOTE=pierre0158;51880912][lua]
caller:SendLua( [[ chat.AddText ( Color(0, 255, 0), "Oven is now turned ON!" ) ]] )
[/lua]
are you serious[/QUOTE]
SendLua is fine if
A) You're not sending it every tick
B) The string doesn't change at all
But again, you should use net messages instead
[QUOTE=Kevlon;51881869]SendLua is fine if
A) You're not sending it every tick
[b]B) The string doesn't change at all[/b]
But again, you should use net messages instead[/QUOTE]
Huh? Does it optimize it? Have you got a source?
[QUOTE=NeatNit;51881927]Huh? Does it optimize it? Have you got a source?[/QUOTE]
No, It just stops it from erroring or exploiting, that's the only reason why I assumed anyone wouldn't want to use SendLua every tick or in an expensive setting.
ok everyone, now im getting a new error that i cannot fix, like it is not an error inside of my code?!?!
[lua]
[ERROR] lua/includes/util.lua:181: attempt to index local 'object' (a boolean value)
1. IsValid - lua/includes/util.lua:181
2. unknown - lua/entities/oven_cooker/init.lua:75
[/lua]
i updated the init.lua filesa above
If you look at the stack trace you can see it's actually your code producing the error, i.e.
[code]
2. unknown - lua/entities/oven_cooker/init.lua:75
[/code]
Line being
[code]
IsValid(traceFire1.Entity:GetClass() == "oven_pot_debug" )
[/code]
And it's caused by the fact [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Global/IsValid]IsValid[/url] is only meant to be used on "classes", e.g. entities, panels, custom tables, etc
Sorry, you need to Log In to post a reply to this thread.