Lipee Lima Posted May 18, 2022 Share Posted May 18, 2022 I wanted to know how do I disable the default mta T chat, I'm using a chat and when I send a message there are two messages that in this case are my chat and the mta default T chat. The script just below. function playerChat(message, messageType) if messageType == 0 then --Global (main) chat cancelEvent() local ID = getElementData(source, "ID") or "N/A" if isObjectInACLGroup("user."..getAccountName ( getPlayerAccount (source)), aclGetGroup ("Console") ) then outputChatBox("#DDA0DD* [#000000Fundador#DDA0DD] " ..getPlayerName(source).." ["..ID.."]: #FFFFFF"..message, root, 255, 0, 0, true ) outputServerLog("ChatLog: "..getPlayerName(source).." ["..ID.."]: "..message)--NOTE: Beacuse we cancelled the onPlayerChat event, we need to log chat manually. elseif isObjectInACLGroup ("user."..getAccountName ( getPlayerAccount ( source ) ), aclGetGroup ( "Adm" ) ) then outputChatBox("#DDA0DD* [#FF0000Administrador#DDA0DD] " ..getPlayerName(source).." ["..ID.."]: #FFFFFF"..message, root, 255, 0, 0, true ) outputServerLog("ChatLog: "..getPlayerName(source).." ["..ID.."]: "..message)--NOTE: Beacuse we cancelled the onPlayerChat event, we need to log chat manually. elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Everyone" ) ) then outputChatBox("#DDA0DD* [#9370DBPlayer#DDA0DD] " ..getPlayerName(source).." ["..ID.."]: #FFFFFF"..message, root, 255, 0, 0, true ) outputServerLog("ChatLog: "..getPlayerName(source).." ["..ID.."]: "..message)--NOTE: Beacuse we cancelled the onPlayerChat event, we need to log chat manually. end end end addEventHandler("onPlayerChat", root, playerChat) Link to comment
Cronoss Posted May 21, 2022 Share Posted May 21, 2022 Try this function playerChat(message, messageType) if messageType == 0 then --Global (main) chat local ID = getElementData(source, "ID") or "N/A" if isObjectInACLGroup("user."..getAccountName ( getPlayerAccount (source)), aclGetGroup ("Console") ) then outputChatBox("#DDA0DD* [#000000Fundador#DDA0DD] " ..getPlayerName(source).." ["..ID.."]: #FFFFFF"..message, root, 255, 0, 0, true ) outputServerLog("ChatLog: "..getPlayerName(source).." ["..ID.."]: "..message) elseif isObjectInACLGroup ("user."..getAccountName ( getPlayerAccount ( source ) ), aclGetGroup ( "Adm" ) ) then outputChatBox("#DDA0DD* [#FF0000Administrador#DDA0DD] " ..getPlayerName(source).." ["..ID.."]: #FFFFFF"..message, root, 255, 0, 0, true ) outputServerLog("ChatLog: "..getPlayerName(source).." ["..ID.."]: "..message) elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Everyone" ) ) then outputChatBox("#DDA0DD* [#9370DBPlayer#DDA0DD] " ..getPlayerName(source).." ["..ID.."]: #FFFFFF"..message, root, 255, 0, 0, true ) outputServerLog("ChatLog: "..getPlayerName(source).." ["..ID.."]: "..message) end end cancelEvent() --Change the cancel event to this part end addEventHandler("onPlayerChat", root, playerChat) Link to comment
Hydra Posted May 25, 2022 Share Posted May 25, 2022 Also if you want to disable the chat for team chat, private chat etc.. you can also put like this: if messageType == 0 or messageType == 1 or messageType == 2 or messageType == 3 or messageType == 4 then --your script end 0: normal message 1: action message (/me) 2: team message 3: private message 4: internal message 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