getAccount
Client-side
Server-side
Shared
This function returns an account for a specific user.
OOP Syntax Help! I don't understand this!
- Constructor: Account(...)
Syntax
account|false getAccount ( string username, [ string password = nil, bool caseSensitive = true ] )
Required Arguments
- username: The username of the account you want to retrieve.
Optional Arguments
NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use.
- password (default: nil): The password for the account. If this argument is not specified, you can get the account whatever password it is, otherwise the password must match the account's.
- caseSensitive (default: true): Specifies whether to ignore the case when searching for an account.
Returns
- account|false: result
Returns an account or false if an account matching the username specified (and password, if specified) could not be found.
Code Examples
server
This function checks if the account mentioned exists in the internal.db database file.
addCommandHandler("checkaccount", function(player, cmd, account) if hasObjectPermissionTo(player, "function.banPlayer" ) then -- if the player typing /checkaccount command has permission to banPlayer if (account and account ~= "") then -- if the account name was mentioned if (getAccount(account)) then -- if the account exists outputChatBox("Account "..account.." exists in the database!", player, 0, 255, 0) else -- if the account doesn't exist outputChatBox("Account "..account.." does not exist in database", player, 0, 255, 0) end else outputChatBox("Syntax is /checkaccount [account name]", player, 255, 0, 0) end endend)
See Also
Account Functions
- addAccount
- copyAccountData
- getAccountByID
- getAccount
- getAccountData
- getAccountID
- getAccountIP
- getAccountName
- getAccountPlayer
- getAccountSerial
- getAccountType
- getAccounts
- getAccountsByData
- getAccountsByIP
- getAccountsBySerial
- getAllAccountData
- getPlayerAccount
- isGuestAccount
- logIn
- removeAccount
- logOut
- setAccountData
- setAccountName
- setAccountPassword
- setAccountSerial