Jump to content

Login


qaisjp

Recommended Posts

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

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

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

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 by Guest
Link to comment
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...