GetPlayersInACLGroup

From Multi Theft Auto: Wiki
Jump to navigation Jump to search

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