GetAccountData: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 21: Line 21:


function onLogin ( previous_account, current_account, auto-login )
function onLogin ( previous_account, current_account, auto-login )
     playerName = getAccountData (current_account,"playerName"); // Get the data stored in "playerName" and output it to a string
     playerName = getAccountData (current_account,"playerName"); -- Get the data stored in "playerName" and output it to a string
     outputChatBox playerName .. " just logged in." // Output the name to the chat box
     outputChatBox playerName .. " just logged in." -- Output the name to the chat box
end
end



Revision as of 10:10, 23 May 2007

This template is no longer in use as it results in poor readability. This function retrieves a string that has been stored using setAccountData. Data stored as account data is persistent across user's sessions and maps, unless they are logged into a guest account.

Syntax

string getAccountData ( account theAccount, string key )

Required Arguments

  • theAccount: The account you wish to retrieve the data from.
  • key: The key under which the data is stored

Returns

Returns a string containing the stored data or false if no data was stored under that key.

Example

root = getRootElement ()
addEventHandler ( "onClientLogin", root, "onLogin" )

function onLogin ( previous_account, current_account, auto-login )
    playerName = getAccountData (current_account,"playerName"); -- Get the data stored in "playerName" and output it to a string
    outputChatBox playerName .. " just logged in." -- Output the name to the chat box
end

See Also