Finish this feature.

This commit is contained in:
FlightControl_Master
2018-04-13 09:56:00 +02:00
parent 3389c908d7
commit 25ae0c3d15
7 changed files with 228 additions and 52 deletions

View File

@@ -1430,6 +1430,26 @@ do -- Players
return nil
end
--- Get the active player count in the group.
-- @param #GROUP self
-- @return #number The amount of players.
function GROUP:GetPlayerCount()
local PlayerCount = 0
local Units = self:GetUnits()
for UnitID, UnitData in pairs( Units or {} ) do
local Unit = UnitData -- Wrapper.Unit#UNIT
local PlayerName = Unit:GetPlayerName()
if PlayerName and PlayerName ~= "" then
PlayerCount = PlayerCount + 1
end
end
return PlayerCount
end
end