DazzaJay Posted June 12, 2008 Share Posted June 12, 2008 Basically, back in MTA Race, with mIRC, there were multiple independant scripts that had the same command, such as !info, our old server had 4 independant scripts that responded to !info, MTAMA, PRS, Pothole Emotes, Pothole Scripts. So basically, can multiple independant LUA scripts in DM have the same command handler, such as /info in a bunch of different scripts? Link to comment
tma Posted June 12, 2008 Share Posted June 12, 2008 This: addCommandHandler("test", function(player,cmd) outputChatBox("I AM A FUNCTION") end ) addCommandHandler("test", function(player,cmd) outputChatBox("SO AM I") end ) outputs both lines to the chatbox - so yes, you can (assuming there's no difference in having the two test calls in the same resource). Link to comment
DazzaJay Posted June 12, 2008 Author Share Posted June 12, 2008 Well, like that, but in Multiple different recources.... So like this.... Race Gamemode: addCommandHandler("info", function(player,cmd) outputChatBox("Pothole Studios Race v10.7.1") end ) and say, in some other script in a different recource. addCommandHandler("info", function(player,cmd) outputChatBox("Some other script V7.11") end ) Would that work like this... [PS]DazzaJay[AU]: /info Pothole Studios Race v10.7.1 Some other script V7.11 Link to comment
eAi Posted June 12, 2008 Share Posted June 12, 2008 Of course that will work! Why don't you try it (or read the documentation)? http://development.mtasa.com/index.php? ... andHandler "Multiple command handlers can be attached to a single command, and they will be called in the order that the handlers were attached." Sure, it doesn't explicitly say that it works with multiple resources, but you can assume that's the case with anything in MTA. Resources have no exclusive rights to anything (except things they might be given exclusive rights to in the ACL, but that's a bit different). That said, using helpmanager's GUI might be a better way to provide info to the user. We try discourage people outputting anything in the chat box that isn't chat. Link to comment
DazzaJay Posted June 12, 2008 Author Share Posted June 12, 2008 Thats cool, its just cos i remember asking this once before and being told it dosent work, but this was about a day after DP1 was released. Link to comment
eAi Posted June 12, 2008 Share Posted June 12, 2008 Well, it's always worked. So someone must have been misinformed 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