vinigas Posted October 28, 2016 Share Posted October 28, 2016 I use logIn, logOut functions in my script and I see that I getting chat messages then I am testing. Can I turn off those automatic messages ? Quote login: You successfully logged in. login: You are already logged in. Link to comment
Gravestone Posted October 28, 2016 Share Posted October 28, 2016 12 minutes ago, vinigas said: login: You successfully logged in. login: You are already logged in This means that the logIn function is being triggered twice. Mostly happens when you double click on a gui button. Link to comment
vinigas Posted October 28, 2016 Author Share Posted October 28, 2016 Yea I know, but that's is not a problem. The problem is that i do not use outputChatBox, but I'm still getting this chat messages. Link to comment
Gravestone Posted October 28, 2016 Share Posted October 28, 2016 You can do something like this addEventHandler("onPlayerLogin", root, function() cancelEvent() logIn() -- login the player somehow end ) Link to comment
GTX Posted October 28, 2016 Share Posted October 28, 2016 Those messages are hardcoded, you cannot turn them off as far as I know. Link to comment
Gravestone Posted October 28, 2016 Share Posted October 28, 2016 22 minutes ago, GTX said: Those messages are hardcoded, you cannot turn them off as far as I know. You can, by cancelling the event. Link to comment
GTX Posted October 28, 2016 Share Posted October 28, 2016 If you cancel onPlayerLogin then you won't login (According to wiki). What you're doing in your code now is called stack overflow. Link to comment
Addlibs Posted October 28, 2016 Share Posted October 28, 2016 Pretty sure you can cancelEvent() on onClientChatMessage if the string.sub(message, 1, 6) is "login:" or "logout:" 3 Link to comment
Walid Posted October 28, 2016 Share Posted October 28, 2016 You can use sth like this: Server side addEventHandler("onPlayerLogin", root, function() setTimer(triggerClientEvent,1000,1,source,"removeLoginMessage",source) end ) Client side addEvent("removeLoginMessage",true) addEventHandler("removeLoginMessage",localPlayer, function() for i = 1, 200, 1 do outputChatBox("") end end ) 1 Link to comment
GTX Posted October 28, 2016 Share Posted October 28, 2016 (edited) @Walid No... MrTasty's solution would work just fine. To put it into an example: function onChatMessage(text) if(string.sub(text,1,6) == "login:" or string.sub(text,1,7) == "logout:") then -- Check if it contains login: or logout: strings cancelEvent() -- Cancel it end end addEventHandler("onClientChatMessage",root,onChatMessage) Edited October 28, 2016 by GTX 2 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