logIn
Client-side
Server-side
Shared
Pair: logOut
This functions logs the given player in to the given account. You need to provide the password needed to log into that account.
OOP Syntax Help! I don't understand this!
- Method: player:logIn(...)
Syntax
bool logIn ( player thePlayer, account theAccount, string thePassword )Required Arguments
- thePlayer: The player to log into an account.
- theAccount: The account to log the player into.
- thePassword: The password needed to sign into this account.
Returns
- bool: result
Returns true if the player was successfully logged into the given account. Returns false or nil if the log in failed for some reason, ie. the player was already logged in to some account (use logOut first), if the account was already in use or if it failed for some other reason.
Code Examples
server
This example logs the player into the specified account when the log-in command is entered, if the account & password is correct.
function loginPlayer ( thePlayer, command, username, password ) local account = getAccount ( username, password ) -- Return the account if ( account ) then -- If the account exists. logIn ( thePlayer, account, password ) -- Log them in. else outputChatBox ( "Wrong username or password!", thePlayer, 255, 255, 0 ) -- Output they got the details wrong. endendaddCommandHandler ( "log-in", loginPlayer ) -- Make it trigger for "/log-in", NOTE: /login is hardcored and cannot be used.See Also
Account Functions
- copyAccountData
- getAccount
- getAccountData
- getAccountByID
- addAccount
- getAccountID
- getAccountIP
- getAccountName
- getAccountPlayer
- getAccountSerial
- getAccounts
- getAccountsByData
- getAccountType
- getAccountsByIP
- getAccountsBySerial
- getAllAccountData
- getPlayerAccount
- isGuestAccount
- logIn
- logOut
- removeAccount
- setAccountData
- setAccountName
- setAccountPassword
- setAccountSerial