CopyAccountData: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 6: Line 6:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool copyAccountData ( account theAccount, account fromAccount )
bool copyAccountData ( account theAccount, account fromAccount )
</syntaxhighlight>  
</syntaxhighlight>
 
'''OOP Syntax'''
*'''Method 1:''' ''sourceAccount:copyDataTo(targetAccount)''.
*'''Method 2:''' ''targetAccount:copyDataFrom(sourceAccount)''.
 


===Required Arguments===  
===Required Arguments===  

Revision as of 03:49, 12 July 2014

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

Syntax

bool copyAccountData ( account theAccount, account fromAccount )

OOP Syntax

  • Method 1: sourceAccount:copyDataTo(targetAccount).
  • Method 2: targetAccount:copyDataFrom(sourceAccount).


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, autoLogin)
  copyAccountData ( currentAccount, previousAccount )
end
addEventHandler ( "onPlayerLogin", getRootElement(), copyDataOnLogin )

See Also