MasterTobi Posted December 19, 2008 Share Posted December 19, 2008 hey, I have a problem. if I enter /test in the Chatbox then I want in chatbox " test" stands however only for me. in this example (server side) it gives for all " test" out function test(client) outputChatBox ("test",client) end addCommandHandler("test",test) as I can make it, which he spends it only on me Thx tobi Link to comment
robhol Posted December 19, 2008 Share Posted December 19, 2008 addCommandHandler("test", function (source) outputChatBox("TEST!", source); end ) -- OR! function TestCommand(source) outputChatBox("TEST!", source); end addCommandHandler("test", TestCommand); Link to comment
MasterTobi Posted December 19, 2008 Author Share Posted December 19, 2008 ok thx i will test it which is differentiates between client and SOURCE thx tobi Link to comment
robhol Posted December 19, 2008 Share Posted December 19, 2008 ok thx i will test it which is differentiates between client and SOURCE thx tobi I'm not sure if I got you there, but in case you meant "what is the difference", it's nothing: it's just a name. In lua, as with most programming/scripting languages, the names are not important for a function's prototype, but the order is. The addCommandHandler assumes a certain layout for handling functions, like so: function thisIsAHandlerFunction(source,command,argument1,argument2, ...) if you wanted to write function thisIsAHandlerFunction(thef_ckerwhoenteredthecommand,command,argument1,argument2, ...) instead, you could. 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