CopyAccountData: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
{{Server function}}
{{Server function}}
此函数用于将所有数据从一个帐户[[account]]复制到另一个帐户.
This function copies all of the data from one [[account]] to another.


==语法==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool copyAccountData ( account theAccount, account fromAccount )
bool copyAccountData ( account theAccount, account fromAccount )
</syntaxhighlight>
</syntaxhighlight>
{{OOP_ZH-CN||[[account]]:copyDataTo||}}
{{OOP||[[account]]:copyDataTo||}}


===必填参数===  
===Required Arguments===  
*'''theAccount:''' 复制数据的账户
*'''theAccount:''' The account you wish to copy the data ''to''.
*'''fromAccount:''' 黏贴数据的账户
*'''fromAccount:''' The account you wish to copy the data ''from''.
===返回(Returns)===
如果帐户有效,则返回“true”,否则返回“false”.


==例子==
===Returns===
此示例在“guest”登录时将帐户数据从其复制到已注册的帐户
Returns a ''true'' if the accounts were valid, ''false'' otherwise.
 
==Example==
This example copies the account data from the 'guest' to a registered account when they login
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function copyDataOnLogin ( previousAccount, currentAccount )
function copyDataOnLogin ( previousAccount, currentAccount )
Line 30: Line 31:
[[ar:copyAccountData]]
[[ar:copyAccountData]]
[[pl:copyAccountData]]
[[pl:copyAccountData]]
[[zh-cn:copyAccountData]]

Revision as of 01:33, 4 February 2021

This function copies all of the data from one account to another.

Syntax

bool copyAccountData ( account theAccount, account fromAccount )

OOP Syntax Help! I don't understand this!

Method: account:copyDataTo(...)


Required Arguments

  • theAccount: The account you wish to copy the data to.
  • fromAccount: The account you wish to copy the data from.

Returns

Returns a true if the accounts were valid, false otherwise.

Example

This example copies the account data from the 'guest' to a registered account when they login

function copyDataOnLogin ( previousAccount, currentAccount )
  copyAccountData ( currentAccount, previousAccount )
end
addEventHandler ( "onPlayerLogin", getRootElement(), copyDataOnLogin )

See Also