ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Server functions
  3. setAccountData

Function

setAccountData

ServerAccountsIdentical to MTA:SA

Stores account data under a key. The value is kept permanently (also after a server restart).

Syntax

bool setAccountData(account theAccount, string key, mixed value)

Arguments

theAccountaccount
The account.
keystring
The key.
valuemixed
The value: number, string, true/false, table.

Returns

true on success.

Example

addEventHandler("onPlayerQuit", root, function()
    local account = getPlayerAccount(source)
    if not isGuestAccount(account) then
        setAccountData(account, "money", getPlayerMoney(source))
        setAccountData(account, "skin", getElementModel(source))
    end
end)

See also