GetPlayersInACLGroup: Difference between revisions
Jump to navigation
Jump to search
Abdul KariM (talk | contribs) (Created page with "==Syntax== <syntaxhighlight lang="lua">table getPlayersInGroup ( string GroupName )</syntaxhighlight> ===Required Arguments=== * '''GroupName''': A string Group Name To Get All Players In It ===Retur...") |
Abdul KariM (talk | contribs) (→Syntax) |
||
| Line 7: | Line 7: | ||
===Returns=== | ===Returns=== | ||
Returns All Players In Groups if it was Argument true , And vice false | Returns All Players In Groups if it was Argument true , And vice false | ||
==Code== | |||
<section name="Server" class="server" show="true"><syntaxhighlight lang="lua"> | |||
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 | |||
</syntaxhighlight></section> | |||
Revision as of 05:16, 7 May 2016
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 [-]
Serverfunction 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