TheDZetko Posted August 16, 2014 Share Posted August 16, 2014 Hello all, I have a little problem with my script. Here is the code. function test(source) outputChatBox("Hello World!", source, 255,100,10, true); end addCommandHandler("test",test) And here is my meta.xml file. <meta> <script src="test.lua" type="server"> </meta> Here is the problem. I have both files in one folder named "test". I placed the folder to my "resources" folder. When I start the server, it says all resources started (0 failed). When I connect to my server with an account with admin rights, start the resource and type /test, it doesn't do anything. Link to comment
Bonsai Posted August 16, 2014 Share Posted August 16, 2014 Yeah, had the same problem plenty of times. "test" as command doesn't work. Haven't seen any warning about that yet, but found out some day. Link to comment
Saml1er Posted August 16, 2014 Share Posted August 16, 2014 Always read wiki before you use a function in your script. Wiki says addCommandHandler will attach a scripting function (handler) to a console command, so that whenever a player or administrator uses the command the function is called. Note: You cannot use "list" or "test" as command name. Also wiki's note: Note: It is strongly advised that you do not use the same name for your handler function as the command name, as this can lead to confusion if multiple handler functions are used. Use a name that describes your handler's purpose more specifically. Solution: function Hello(source) outputChatBox("Hello World!", source, 255,100,10, true); end addCommandHandler("yo",Hello) So the command is /yo Link to comment
TheDZetko Posted August 17, 2014 Author Share Posted August 17, 2014 Thank you all for your replies. Link to comment
Saml1er Posted August 17, 2014 Share Posted August 17, 2014 Thank you all for your replies. You're welcome. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now