WhoAmI Posted March 3, 2014 Share Posted March 3, 2014 Hi guys. for _,player in ipairs ( getElementsByType ( "player" ) ) do unbindKey ( player, "T", "down", "chatbox", "say" ) bindKey ( player, "T", "down", "chatbox", "IC" ) end Is it possible to do such a thing? Couse i found topic in thsi forum, and someone said that it is not, but I saw this in some RP server. How can I do, that in "T" key I would have another chat than "Say"? Link to comment
Anubhav Posted March 3, 2014 Share Posted March 3, 2014 If you mean that you want to change it (WITHOUT BIND KEY) use onPlayerChat event. See the wiki's example. You can make say chat to global and alll... Link to comment
WhoAmI Posted March 3, 2014 Author Share Posted March 3, 2014 I mean changing message, from "Say" to "IC" or something. Link to comment
myonlake Posted March 3, 2014 Share Posted March 3, 2014 Yes, it is possible to unbind the say key and bind it with another one. Link to comment
WhoAmI Posted March 3, 2014 Author Share Posted March 3, 2014 Am I doing it right way? Link to comment
myonlake Posted March 3, 2014 Share Posted March 3, 2014 Actually I don't think it is possible. I remembered wrong; you can't unbind MTA internal commands. However, you can do the following, like Anubhav mentioned above: Server-side addEventHandler( "onPlayerChat", root, function( message, messageType ) if ( messageType == 1 ) then cancelEvent( ) -- Do your own stuff end end ) Link to comment
Moderators Citizen Posted March 3, 2014 Moderators Share Posted March 3, 2014 On 03/03/2014 at 11:58, myonlake said: Actually I don't think it is possible. I remembered wrong; you can't unbind MTA internal commands. However, you can do the following, like Anubhav mentioned above: Server-side addEventHandler( "onPlayerChat", root, function( message, messageType ) if ( messageType == 1 ) then cancelEvent( ) -- Do your own stuff end end ) We can ! But not with unBindKey actually. You need to use toggleControl and the control name for the chatbox is "chatbox": https://wiki.multitheftauto.com/wiki/Co ... d_commands So just toggle that control to false and the player won't be able to show the chat input field. Link to comment
WhoAmI Posted March 3, 2014 Author Share Posted March 3, 2014 Yea but how I would do another chat? bindKey ( player, "T", "down", -- [[and here what?]] ) Link to comment
pa3ck Posted March 3, 2014 Share Posted March 3, 2014 Yea but how I would do another chat? bindKey ( player, "T", "down", -- [[and here what?]] ) bindKey ( player, "T", "down", "chatbox", "IC" ) --You will need to have an addCommandHandler addCommandHandler("ic", function() ... end) Link to comment
WhoAmI Posted March 3, 2014 Author Share Posted March 3, 2014 Lol man, If I toggle "chatbox" off, I can't use chatbox handler. Link to comment
myonlake Posted March 3, 2014 Share Posted March 3, 2014 Lol man, If I toggle "chatbox" off, I can't use chatbox handler. Exactly. Yea but how I would do another chat? Place your other chat functions into the event after the cancelEvent( ) function. Link to comment
Moderators Citizen Posted March 3, 2014 Moderators Share Posted March 3, 2014 Yea but how I would do another chat? bindKey ( player, "T", "down", -- [[and here what?]] ) put a function that will show a new edit field for example. and when the guy press enter, get the text of this edit, output the text in the chat and hide the edit. I'm guessing it's what you wanted to do ? If not, then explain us exactly what you really want to do Btw, you will have to rewrite the command feature. When you find a / as a first character, then send everyting in executeCommandHandler Link to comment
WhoAmI Posted March 3, 2014 Author Share Posted March 3, 2014 I would do chat with myonlake's solution. Link to comment
Moderators Citizen Posted March 3, 2014 Moderators Share Posted March 3, 2014 Oh ok, so you don't want to create a whole new chatbox, thought you wanted to do that. You actually just want to add some stuff/fucntion between the chatbox input field and the display in the chatbox. 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