CopyAccountData: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
(updated)
Line 17: Line 17:
This example copys the account data from the 'guest' to a registered account when they login
This example copys the account data from the 'guest' to a registered account when they login
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
addEventHandler ( "onClientLogin", root, "onClientLogin" )
function copyDataOnLogin ( previous_account, current_account, auto-login )
function onClientLogin ( previous_account, current_account, auto-login )
   copyAccountData ( current_account, previous_account )
   copyAccountData ( current_account, previous_account )
end
end
addEventHandler ( "onClientLogin", getRootElement(), copyDataOnLogin )
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{Account_functions}}
{{Account_functions}}

Revision as of 20:51, 15 July 2007

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

Syntax

bool copyAccountData ( account theAccount, account fromAccount )

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 copys the account data from the 'guest' to a registered account when they login

function copyDataOnLogin ( previous_account, current_account, auto-login )
  copyAccountData ( current_account, previous_account )
end
addEventHandler ( "onClientLogin", getRootElement(), copyDataOnLogin )

See Also