ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Server functions
  3. getAccount

Function

getAccount

Returns the account with the given name. With a password it returns false when the password does not match.

Syntax

account getAccount(string username [, string password = nil])

Arguments

usernamestring
Account name.
passwordstring, optional = nil
Password to check.

Differences from MTA:SA

  • These MTA:SA arguments are not here: bool caseSensitive = true

In MTA:SA

getAccount(string username, string password = nil, bool caseSensitive = true)

Returns

The account or false.

Example

addCommandHandler("login", function(player, cmd, name, password)
    local account = name and password and getAccount(name, password)
    if not account then
        outputChatBox("Zły login lub hasło.", player, 255, 0, 0)
        return
    end
    logIn(player, account, password)
end)

See also