• Can't seem to find a way to toggle a tool gun lamp.
    7 replies, posted
Hi there. I'm new to GMod Lua, so this is probably a very simple thing but I can't seem to work it out. I'm trying to simply turn off and on a lamp spawned from the tool gun menu. Here's just one of the code snippets I have tried to use: local entities = ents.GetAll() for k, v in pairs( ents.FindByClass( "gmod_lamp" ) ) do v:Toggle() end This seems to do nothing to the lamp. Thanks in advance.
I just skimmed it, but this should help
Yeah, I have looked at this many times, but i'm fairly new to Gmod lua, and cant really understand it a bit. I read over it and saw something about a Projected Texture, which i'm trying to control now with some code.
OK, so far I have had no luck trying to work with ProjectedTextures. I have confirmed that it is ProjectedTextures from this page, but none of the function on there seem to work properly. I'm trying to attach these with this code: local entities = ents.GetAll() for k, v in pairs( ents.FindByClass( "class C_EnvProjectedTexture" ) ) do v:TurnOff() end This has given no positive results.
You need to call Toggle() on the server, not client.
Ah OK, i'll have to setup a quick server. Will this make it also toggle the Projected Texture?
No, you don't have to run a server. That's not what he means. He's saying you have to call Toggle from some server side code.
I tried running the code server side without the _cl on the end of the command, but it seemed it did even less that when I ran it in client. I have also watched most of that YouTube series from Code Blue allready xD
Sorry, you need to Log In to post a reply to this thread.