SetAccountName: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
mNo edit summary
Line 9: 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||name}}
{{OOP||[[account]]:setName||getAccountName}}
===Required Arguments===  
===Required Arguments===  
*'''theAccount:''' The account you wish to change the name.
*'''theAccount:''' The account you wish to change the name.

Revision as of 19:45, 4 September 2018

This function sets the name of an account.

Syntax

bool setAccountName ( account theAccount, string name [, bool allowCaseVariations = false] )

OOP Syntax Help! I don't understand this!

Method: account:setName(...)
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