GetPlayersInACLGroup

From Multi Theft Auto: Wiki
Revision as of 05:16, 7 May 2016 by Abdul KariM (talk | contribs) (Syntax)

Syntax

table getPlayersInGroup ( string GroupName )

Required Arguments

  • GroupName: A string Group Name To Get All Players In It

Returns

Returns All Players In Groups if it was Argument true , And vice false

Code

Click to collapse [-]
Server
function getPlayersInGroup ( GroupName )
 
    local aTable = {}
 
    assert ( tostring ( GroupName ) , "Bad Argument At Argument #1 Group Moust String" )
   
    assert ( aclGetGroup ( tostring ( GroupName ) ) , "Bad Argument At Argument #1 Group not Found "  )
   
    for i , player_ in ipairs ( getElementsByType ( "player" ) ) do
   
    local TheAcc =  getPlayerAccount ( player_ )
   
    if not isGuestAccount ( TheAcc ) then  
 
    if isObjectInACLGroup ( "user." ..getAccountName ( TheAcc ) , aclGetGroup ( tostring ( GroupName ) ) ) then
     
    table.insert ( aTable , player_ )
             end  
        end
    end 
    return aTable
end