GetAccounts: Difference between revisions
Jump to navigation
Jump to search
m (fix oop syntax) |
|||
Line 21: | Line 21: | ||
end | end | ||
addCommandHandler( "accountcount", printAmountOfAccounts ) -- add a command handler for command 'accountcount' | addCommandHandler( "accountcount", printAmountOfAccounts ) -- add a command handler for command 'accountcount' | ||
function getAccountRanks( accName ) -- getAccountRanks Function By MouNiR.Dz | |||
local groups = aclGroupList() | |||
for i,v in ipairs(groups) do | |||
if isObjectInACLGroup("user."..accName,v) then | |||
outputChatBox( " there are "..aclGroupGetName(v).." group for the account ("..accName..") ",thePlayer) | |||
end | |||
end | |||
end | |||
function amountOfGroups( thePlayer,cmd,accountname ) -- | |||
if accountname then -- if account name writen | |||
getAccountRanks(accountname) -- get groups for this account | |||
else -- if no account name writen | |||
outputChatBox("No account name writen",thePlayer,255,0,0) -- write a msg in chat | |||
end -- end function | |||
end -- end If | |||
addCommandHandler("groups",amountOfGroups) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 14:49, 13 April 2020
This function returns a table over all the accounts that exist in the server internal.db file. (Note: accounts.xml is no longer used after version 1.0.4)
Syntax
table getAccounts ()
OOP Syntax Help! I don't understand this!
- Note: This function is a static function underneath the Account class.
- Method: Account.getAll(...)
Returns
A table over the accounts that exist in the server internal.db 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 are 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' function getAccountRanks( accName ) -- getAccountRanks Function By MouNiR.Dz local groups = aclGroupList() for i,v in ipairs(groups) do if isObjectInACLGroup("user."..accName,v) then outputChatBox( " there are "..aclGroupGetName(v).." group for the account ("..accName..") ",thePlayer) end end end function amountOfGroups( thePlayer,cmd,accountname ) -- if accountname then -- if account name writen getAccountRanks(accountname) -- get groups for this account else -- if no account name writen outputChatBox("No account name writen",thePlayer,255,0,0) -- write a msg in chat end -- end function end -- end If addCommandHandler("groups",amountOfGroups)
See Also
- addAccount
- copyAccountData
- getAccount
- getAccountData
- getAccountName
- getAccountPlayer
- getAccountSerial
- getAccounts
- getAccountsBySerial
- getAllAccountData
- getPlayerAccount
- isGuestAccount
- logIn
- logOut
- removeAccount
- setAccountData
- setAccountPassword
- getAccountByID
- getAccountID
- getAccountIP
- getAccountsByData
- getAccountsByIP
- setAccountName