GetAccountsRanks: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{Useful Function}} __NOTOC__
Moved to [[getAccountRanks]]
This function is used to detect the account name groups and put them in the chat.
==Syntax==
<syntaxhighlight lang="lua">
player getAccountRanks ( string accountName )
</syntaxhighlight>
 
===Required Arguments===
* '''accountName''': A string containing account name of a player you want to know his groups.
* '''theplayer''': the player that we tells him.
 
==Code==
<syntaxhighlight lang="lua">
function getAccountRanks( accName,thePlayer ) -- getAccountRanks Function By MouNiR.Dz
    local groups = aclGroupList() -- Acl group list
    for i,v in ipairs(groups) do -- table
        if isObjectInACLGroup("user."..accName,v) then -- if he have groups
            outputChatBox( " there are "..aclGroupGetName(v).." group for the account ("..accName..") ",thePlayer) -- telling the player about his groups
        end -- end for if
    end -- end for
end -- end function
 
</syntaxhighlight>
 
==Example==
<syntaxhighlight lang="lua">
-- Example : When he command "groups", he tells him on chat all the groups he is in
 
addCommandHandler("groups",function (thePlayer) -- binding the command "groups"
local acc = getAccountName(getPlayerAccount(thePlayer)) -- getting account name
getAccountRanks(acc,thePlayer) -- getting account ranks
end -- end for function
) -- closing addCommandHandler(
</syntaxhighlight>
 
'''Author:''' MouNiR.Dz
 
==See Also==
{{Useful_Functions}}

Latest revision as of 02:06, 18 October 2023

Moved to getAccountRanks