GetAccount: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 19: Line 19:
==Example==
==Example==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function retAccount ( username, password ) --both arguements are strings
-- example needed.
    if getAccount( username, password ) then
        return getAccount( username, password )
    else
        return false
    end
end
</syntaxhighlight>
 
This example to get an account from his name
<syntaxhighlight lang="lua">
function getAccountFromName(username)
local acc = getAccount(username)
    if acc then
        return acc
    else
        return false
    end
end
</syntaxhighlight>
</syntaxhighlight>



Revision as of 16:52, 17 July 2012

This function returns an account for a specific user.

Syntax

account getAccount ( string username, [ string password ] )

Required Arguments

  • username: The username of the account you want to retrieve

Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.

  • password: The password for the account. If this argument is not specified, you can get the account whatever password it is, otherwise the password must match the account's.

Returns

An account value or false if an account matching the username specified (and password, if specified) could not be found.

Example

-- example needed.

See Also