Xeno Posted November 25, 2011 Share Posted November 25, 2011 How would I disable the "logout" command? Or, how would I make it so if someone logged out, it would force them to reconnect? Thanks for your help, Xeno. Link to comment
Castillo Posted November 25, 2011 Share Posted November 25, 2011 addEventHandler("onPlayerLogout",root, function () redirectPlayer(source, "serverIP", "serverPort") end) Link to comment
Xeno Posted November 25, 2011 Author Share Posted November 25, 2011 addEventHandler("onPlayerLogout",root, function () redirectPlayer(source, "serverIP", "serverPort") end) Oh, I did try that, but i forgot to put the IP in the "" so it didn't work. Thanks man. Link to comment
CapY Posted November 25, 2011 Share Posted November 25, 2011 For your first request. function logoutHandler()--We define a function name local accountname = getAccountName (getPlayerAccount(source))--we get an account if (isGuestAccount(getPlayerAccount(source)) == true) then --if that accounts is guest ( in everyone's group(in ACL)) cancelEvent()--then cancelEvent outputChatBox("*Logout is not allowed!", source, 255,0,0)--output him to chatbox that logout is not allowed end end addEventHandler("onPlayerLogout",getRootElement(),logoutHandler)--we add a event handler which will handle the funciton For second, check Solid's post. Link to comment
Castillo Posted November 25, 2011 Share Posted November 25, 2011 Oh, btw, this will work every time they try to logout, but also when logout is not coming from /logout command. If you want it only for /logout command, try this: addEventHandler("onPlayerCommand",root, function (cmd) if (tostring(cmd) == "logout") then redirectPlayer(source, "serverIP", "serverPort") end end) Link to comment
CapY Posted November 25, 2011 Share Posted November 25, 2011 Oh, btw, this will work every time they try to logout. Ofcourse it will, why not ? Link to comment
Xeno Posted November 25, 2011 Author Share Posted November 25, 2011 Thanks guys, really helped me there :3 Link to comment
Castillo Posted November 25, 2011 Share Posted November 25, 2011 Oh, btw, this will work every time they try to logout. Ofcourse it will, why not ? You either got me wrong or just want to increase the post count. His first post was: "How would I disable the "logout" command?" In my first reply I gave him the code to reconnect every time someone logs out (not just via /logout command), and then I supposed he wanted just for the /logout command, so I replied again. Did you get me now? Link to comment
CapY Posted November 26, 2011 Share Posted November 26, 2011 Oh sorry, i've just misreaded the post, not really concentrated these days. -.- 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