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

Function

logIn

ServerAccountsIdentical to MTA:SA

Logs a player into an account. Fires onPlayerLogin. An account can be logged in by only one player at a time.

Syntax

bool logIn(player thePlayer, account theAccount, string thePassword)

Arguments

thePlayerplayer
The player.
theAccountaccount
The account.
thePasswordstring
The password.

Returns

true on success.

Example

addEvent("tryLogin", true)
addEventHandler("tryLogin", root, function(name, password)
    local account = getAccount(name)
    if not account or not logIn(client, account, password) then
        triggerClientEvent(client, "loginFailed", client)
    end
end)

See also