CopyAccountData: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(updated)
m (Edited language change)
 
(20 intermediate revisions by 13 users not shown)
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
This function copies all of the data from one account to another.
{{Server function}}
This function copies all of the data from one [[account]] to another.


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


===Required Arguments===  
===Required Arguments===  
Line 15: Line 17:


==Example==
==Example==
This example copys the account data from the 'guest' to a registered account when they login
This example copies the account data from the 'guest' to a registered account when they login
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function copyDataOnLogin ( previous_account, current_account, auto-login )
function copyDataOnLogin ( previousAccount, currentAccount )
   copyAccountData ( current_account, previous_account )
   copyAccountData ( currentAccount, previousAccount )
end
end
addEventHandler ( "onClientLogin", getRootElement(), copyDataOnLogin )
addEventHandler ( "onPlayerLogin", getRootElement(), copyDataOnLogin )
 
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{Account_functions}}
{{Account_functions}}
[[ru:copyAccountData]]
[[ar:copyAccountData]]
[[pl:copyAccountData]]
[[zh-cn:copyAccountData]]

Latest revision as of 14:40, 8 June 2022

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