SetAccountName: Difference between revisions
Jump to navigation
Jump to search
m (Bonus moved page Useful Functions/SetAccountName to SetAccountName over redirect) |
m (Обновление информации) |
||
(7 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
{{Server function}} | {{Server function}} | ||
__NOTOC__ | __NOTOC__ | ||
{{New feature/item|3.155|1.5.5|11747| | |||
This function sets the name of an [[account]]. | This function sets the name of an [[account]]. | ||
}} | |||
==Syntax== | ==Syntax== | ||
Line 7: | Line 9: | ||
bool setAccountName ( account theAccount, string name [, bool allowCaseVariations = false] ) | bool setAccountName ( account theAccount, string name [, bool allowCaseVariations = false] ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[account]]:setName|| | {{OOP||[[account]]:setName|name|getAccountName}} | ||
===Required Arguments=== | ===Required Arguments=== | ||
*'''theAccount:''' The account you wish to change the name. | *'''theAccount:''' The account you wish to change the name. | ||
Line 25: | Line 27: | ||
return | return | ||
end | end | ||
local account = | local account = getAccount(oldname) | ||
if not account then | if not account then | ||
return | return | ||
Line 35: | Line 37: | ||
==See Also== | ==See Also== | ||
{{Account_functions}} | {{Account_functions}} | ||
[[en:SetAccountName]] | |||
[[ru:setAccountName]] | |||
[[zh-cn:SetAccountName]] |
Latest revision as of 17:12, 12 April 2021
Syntax
bool setAccountName ( account theAccount, string name [, bool allowCaseVariations = false] )
OOP Syntax Help! I don't understand this!
- Method: account:setName(...)
- Variable: .name
- Counterpart: getAccountName
Required Arguments
- theAccount: The account you wish to change the name.
- name: The new name.
Optional Arguments
- allowCaseVariations: Whether the username is case sensitive (if this is set to true, usernames "Bob" and "bob" will refer to different accounts)
Returns
Returns a true if the account name was set, false if an invalid argument was specified.
Example
Change the name of an account.
addCommandHandler("changeaccountname", function(player, _, oldname, newname) if not oldname or not newname then return end local account = getAccount(oldname) if not account then return end setAccountName(account, newname) end)
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