GetAccounts: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(New page: __NOTOC__ {{Server function}} This function returns a table over all the accounts that exist in the server accounts.xml file. ==Syntax== <syntaxhighlight lang="lua"> table getAccounts () </syntaxhighlight> ===Retur...)
 
Line 17: Line 17:
         outputChatBox( "There is no accounts. :(", thePlayer )
         outputChatBox( "There is no accounts. :(", thePlayer )
     else -- table isn't empty
     else -- table isn't empty
         outputChatBox( "There's " .. #accountTable .. " accounts in this server!", thePlayer )
         outputChatBox( "There are " .. #accountTable .. " accounts in this server!", thePlayer )
     end
     end
end
end

Revision as of 18:20, 29 January 2010

This function returns a table over all the accounts that exist in the server accounts.xml file.

Syntax

table getAccounts ()

Returns

A table over the accounts that exist in the server accounts.xml file. This table might be empty.

Example

function printAmountOfAccounts ( thePlayer )
    local accountTable = getAccounts () -- return the table over accounts
    if #accountTable == 0 then -- if the table is empty
        outputChatBox( "There is no accounts. :(", thePlayer )
    else -- table isn't empty
        outputChatBox( "There are " .. #accountTable .. " accounts in this server!", thePlayer )
    end
end
addCommandHandler( "accountcount", printAmountOfAccounts ) -- add a command handler for command 'accountcount'

See Also