How does work /login ?

Host your own server and communicate with server operators.
2 posts Page 1 of 1
Xaxime
Deuce
Posts: 17
Joined: Wed Dec 16, 2015 9:18 pm


Arguments password are saved into "client.exe", or the player calls the server with the number to connect, and only server has the password ?

Thank you, I'm curious about how does the game work.
Amatt
Winter Celebration 2013
Winter Celebration 2013
Posts: 21
Joined: Tue Apr 09, 2013 12:44 am


In the server's config, the passwords are defined in this manor
Code: Select all
"passwords" : {
        "admin" : ["adminpass"],
        "moderator" : ["modpass"],
        "guard" : ["guardpass"],
        "trusted" : ["trustedpass"]
    },
They are arrays that can be modified to have as many passwords as you would like.

The code for the login command (located in commands.py) is
Code: Select all
def login(connection, password):
    """
    Login as a user type
    """
    if connection not in connection.protocol.players:
        raise KeyError()
    for user_type, passwords in connection.protocol.passwords.iteritems():
        if password in passwords:
            if user_type in connection.user_types:
                return "You're already logged in as %s" % user_type
            return connection.on_user_login(user_type, True)
    if connection.login_retries is None:
        connection.login_retries = connection.protocol.login_retries - 1
    else:
        connection.login_retries -= 1
    if not connection.login_retries:
        connection.kick('Ran out of login attempts')
        return
    return 'Invalid password - you have %s tries left' % (
        connection.login_retries)
The passwords are stored on the server in the config. The command /login <password> checks if the password is in the config, and if it is, it will log you in, otherwise, it will decrees your attempt count until you hit 0 or the correct password. If you hit 0, you will be banned.

Hope this helps you understand it a bit better.
2 posts Page 1 of 1
Return to “Servers”

Who is online

Users browsing this forum: No registered users and 2 guests