GetAccountType: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ {{Server function}} {{New feature/item|3.0161|1.6.0|22470|This function returns an account type.}} ==Syntax== <syntaxhighlight lang="lua"> string getAccountType ( account theAccount ) </syntaxhighlight> {{OOP|This function is a static function underneath the Account class.|Account.getType||}} ===Required Arguments=== *'''theAccount:''' An account you want to get info from ===Returns=== Returns ''string'' containing the type of the account if t...")
 
m (Added issue note)
Line 13: Line 13:
===Returns===
===Returns===
Returns ''[[string]]'' containing the type of the account if the account is valid. ''nil'' otherwise
Returns ''[[string]]'' containing the type of the account if the account is valid. ''nil'' otherwise
==Issues==
{{Issues|
{{Issue|3406|Server crashes when an invalid argument was provided}}
}}


==Example==  
==Example==  

Revision as of 16:58, 26 May 2024

ADDED/UPDATED IN VERSION 1.6.0 r22470:
This function returns an account type.

Syntax

string getAccountType ( account theAccount )

OOP Syntax Help! I don't understand this!

Note: This function is a static function underneath the Account class.
Method: Account.getType(...)


Required Arguments

  • theAccount: An account you want to get info from

Returns

Returns string containing the type of the account if the account is valid. nil otherwise

Issues

Issue ID Description
#3406 Server crashes when an invalid argument was provided

Example

This example adds command accountInfo that outputs provided account info

addCommandHandler("accountInfo", function(player, cmd, accountName)
    if not accountName then
        outputChatBox("You have to provide an account's name to get info from!", player)
        return
    end
    local acc = getAccount(accountName)
    if not acc then
        outputChatBox("That account doesn't exist!", player)
        return
    end
    local accName = getAccountName(acc)
    local accType = getAccountType(acc)
    outputChatBox('Account name: '..accName..', type: '..accType, player)
end)

See Also