qaisjp Posted May 26, 2011 Share Posted May 26, 2011 I want to remove the login command and I tried removeCommandHandler("login") and that returns false. The reason for this is that I need loggin in only via GUI. If I cancel the onPlayerLogin event I won't be able to log in at all. All I need is the removal of the command. Secondly how do you remove the message "You logged in" when logging in (via gui) Link to comment
Castillo Posted May 26, 2011 Share Posted May 26, 2011 I don't think you can (correct me if i'm wrong), as far as i know /login + message is built-in MTA. Link to comment
AGENT_STEELMEAT Posted May 27, 2011 Share Posted May 27, 2011 This is what I use in my gamemode: --function to prevent use of certain commands. function filterCommands(command) if(command == "nick") then cancelEvent() outputChatBox("* You can only change your account name via the F1 panel!", source, 255, 0, 0) end if(command == "register") then cancelEvent() outputChatBox("* You can only register an account via the register screen!", source, 255, 0, 0) end end addEventHandler("onPlayerCommand", ROOT, filterCommands) You can adapt that to whatever commands you need. Link to comment
Jaysds1 Posted May 27, 2011 Share Posted May 27, 2011 I don't think you can (correct me if i'm wrong)' date=' as far as i know /login + message is built-in MTA. [/quote'] actually it's in the admin resource, same as /register Link to comment
Castillo Posted May 27, 2011 Share Posted May 27, 2011 Wrong, you can test if you are wrong doing this: stop admin resource then do /login, it will work without it, it's an MTA built-in command. Link to comment
SDK Posted May 27, 2011 Share Posted May 27, 2011 You could try to disallow command.login for the 'Everyone' acl so that nobody would have the rights to use it. The message can't be removed. You can detect it with the client event onClientChatMessage but afaik it can't be canceled. Link to comment
Feche1320 Posted May 27, 2011 Share Posted May 27, 2011 Open un your acl.xml and change the 'access' to false: <right name="command.register" access="false" /> <right name="command.login" access="fals Link to comment
karlis Posted May 27, 2011 Share Posted May 27, 2011 (edited) or you can set some variable to true for like 1sec after logging with gui, and if that variable is false, cancelEvent() the onPlayerLogin. canLogin={} function onLoggingWithGUI(player, .... ) --call this function when logging in canLogin[player]=true ... --do the standard login here setTimer(function(plyr) canLogin[plyr]=false end,1000,1,player) end addEventHandler("onPlayerLogin",getRootElement(),function() if not canLogin[source] then cancelEvent() outputChatBox("You can only login with GUI!",source,255) end end) Edited May 27, 2011 by Guest Link to comment
AGENT_STEELMEAT Posted May 27, 2011 Share Posted May 27, 2011 You can detect it with the client event onClientChatMessage but afaik it can't be canceled. I've tested it (in 1.1) and it works just fine. Link to comment
qaisjp Posted May 27, 2011 Author Share Posted May 27, 2011 This is what I use in my gamemode: --Great Lua Code You can adapt that to whatever commands you need. Thanks! I'm going to use that! actually it's in the admin resource, same as /register Jaysds1, I don't know if you are just getting your post count up or it was an honest mistake. But please check before hand -.- Thanks for your help Castillo and karlis but I am going to go for John's idea + SDK's command limitation 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