• ENT:Use help!
    5 replies, posted
Hello everyone. Simple question here! I've created a entity that the player can press E on, For testing purposes it prints "lol" to the server console, Now this is in the init.lua file. [CODE]function ENT:Use( activator, caller ) print("lol") end[/CODE] Now if the player presses E it says lol multiple times in the console, How can i prevent that thus making the entity not spam the use button as if i make it open a derma i dont wont it too open 4 dermas. Thanks in advance.
[lua] function ENT:Use( activator, caller ) print("lol") return end [/lua]
[QUOTE=MrCraig2;46474388][lua] function ENT:Use( activator, caller ) print("lol") return end [/lua][/QUOTE] Still spamming it.
[quote] local whatever = false function ENT:Use( activator, caller ) if not whatever then print("lol) whatever = true end end [/quote]
[URL]http://wiki.garrysmod.com/page/Entity/SetUseType[/URL] I added some info to relevant wiki pages to avoid such questions in the future: [url]http://wiki.garrysmod.com/page/ENTITY/Use[/url]
[QUOTE=Robotboy655;46474430][URL]http://wiki.garrysmod.com/page/Entity/SetUseType[/URL] I added some info to relevant wiki pages to avoid such questions in the future: [url]http://wiki.garrysmod.com/page/ENTITY/Use[/url][/QUOTE] Nevermind, I realised that i had to spawn a new entity since its on ent initialize lol.. xD
Sorry, you need to Log In to post a reply to this thread.