LogIn: Difference between revisions
Jump to navigation
Jump to search
(New page: bool logIn ( player, account, password )) |
m (Добавление языков) |
||
(11 intermediate revisions by 10 users not shown) | |||
Line 1: | Line 1: | ||
bool logIn ( player, account, password ) | __NOTOC__ | ||
{{Server function}} | |||
This functions logs the given player in to the given [[account]]. You need to provide the password needed to log into that account. | |||
==Syntax== | |||
<syntaxhighlight lang="lua"> | |||
bool logIn ( player thePlayer, account theAccount, string thePassword ) | |||
</syntaxhighlight> | |||
{{OOP||[[player]]:logIn||logOut}} | |||
===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=== | |||
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. | |||
==Example== | |||
<syntaxhighlight lang="lua"> | |||
function loginPlayer ( thePlayer, command, username, password ) | |||
local account = getAccount ( username, password ) -- Return the account | |||
if ( account ~= false ) 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. | |||
end | |||
end | |||
addCommandHandler ( "log-in", loginPlayer ) -- Make it trigger for "/log-in", NOTE: /login is hardcored and cannot be used. | |||
</syntaxhighlight> | |||
==See Also== | |||
{{Account_functions}} | |||
[[en:logIn]] | |||
[[ru:logIn]] | |||
[[ar:logIn]] | |||
[[zh-cn:logIn]] |
Latest revision as of 14:08, 12 April 2021
This functions logs the given player in to the given account. You need to provide the password needed to log into that account.
Syntax
bool logIn ( player thePlayer, account theAccount, string thePassword )
OOP Syntax Help! I don't understand this!
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
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.
Example
function loginPlayer ( thePlayer, command, username, password ) local account = getAccount ( username, password ) -- Return the account if ( account ~= false ) 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. end end addCommandHandler ( "log-in", loginPlayer ) -- Make it trigger for "/log-in", NOTE: /login is hardcored and cannot be used.
See Also
- addAccount
- copyAccountData
- getAccount
- getAccountData
- getAccountName
- getAccountPlayer
- getAccountSerial
- getAccounts
- getAccountsBySerial
- getAllAccountData
- getPlayerAccount
- isGuestAccount
- logIn
- logOut
- removeAccount
- setAccountData
- setAccountPassword
- getAccountByID
- getAccountID
- getAccountIP
- getAccountsByData
- getAccountsByIP
- setAccountName