koragg Posted July 12, 2017 Share Posted July 12, 2017 (edited) A few pages back I saw a way to remove MTA's hardcoded messages like "login: ", "logout: " etc. when the player logs in/out, But the only one which gets removed is the one when the player logs in, the others still show up somehow although I've included them to be removed: function removeLoginText(text) if text == "login: You successfully logged in" or text == "login: You are already logged in" or text == "logout: You logged out" then cancelEvent() end end addEventHandler("onClientChatMessage", root, removeLoginText) Just the "login: You successfully logged in" one gets disabled but the other two still show up. Why? Any way to remove them as well? I tried making different functions for each of them but still the same. Edited July 12, 2017 by koragg 1 Link to comment
pa3ck Posted July 12, 2017 Share Posted July 12, 2017 function removeLoginText(text) if text:lower():find('login:') or text:lower():find('logout:') then cancelEvent() end end addEventHandler("onClientChatMessage", root, removeLoginText) Try that, there might be a space or something in the text, so they are not actually the same. 1 Link to comment
koragg Posted July 12, 2017 Author Share Posted July 12, 2017 Worked, thanks. Also any way to check if the account to which I'm trying to login is already used by me? I mean, now the "login: You are already logged in" message doesn't show up and I wanna make a custom one when I am logged in but still try to login with the same credentials without logging out first. I tried this but didn't work (no errors as well): function onPlayerAlreadyLoggedIn(previousAccount, newAccount) if previousAccount == newAccount then outputChatBox("#0000FF* #FFFFFFYou've already logged in to #00FFFF"..getAccountName(previousAccount).."#FFFFFF's account!", source, 255, 255, 255, true) end end addEventHandler("onPlayerLogin", root, onPlayerAlreadyLoggedIn) Link to comment
pa3ck Posted July 12, 2017 Share Posted July 12, 2017 function removeLoginText(text) if text:lower():find('login:') or text:lower():find('logout:') then cancelEvent() else return end if text:lower():find("already logged in") then outputChatBox() -- your own message elseif text:lower():find("something else") then somethingElse() end end addEventHandler("onClientChatMessage", root, removeLoginText) I think this would be the simplest way around it. 1 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