GMod Lua- How to use 'self' outside a function (in a STool)?
1 replies, posted
Okay, so I'm trying to make a fairly basic STool, except when I try to use the variable 'self' to sample a ClientNumber (and make it a bool) to determine an 'if' sequence, a very painful error keeps popping up (self is a nil value).
How can I use the var 'self' WITHOUT using a function containing TOOL at the start? This is the annoyance, just add it into any STool script (outside a function) and the error will pop up.
[CODE]local ANYTHING = tobool( self:GetClientNumber( "SOMETHING_WITH_A_NUMBER" ) )[/CODE]
(Replace the value 'SOMETHING_WITH_A_NUMBER' with an actual command if you want)
It's meant to set a var 'ANYTHING', checking whether the ClientNumber of 'SOMETHING_WITH_A_NUMBER' is true or false, but it cannot check the variable 'self' because it is undefined.
How can I define it?
Hello, and welcome to Facepunch forums. This is the Fast Threads section. Garry's Mod questions go into the [url=http://facepunch.com/forumdisplay.php?f=11]Garry's Mod section[/url]. Since you already made a thread there, I recommend that you ask a moderator to close this one, as redundant threads, especially in the wrong sections, do not help anyone.
Sorry, you need to Log In to post a reply to this thread.