GetPlayersByMapControl

Parameters
whichControl mapcontrol
bug

Leaks handle f: In Jass you must set local variables that hold agents (or any child type) to null at the end of functions to avoid reference counter leaks.

comment
note

Creates a new force object and returns it. The caller must remove it on its own after use.

return type
force
Source code
function GetPlayersByMapControl takes mapcontrol whichControl returns force
    local force f = CreateForce()
    local integer playerIndex
    local player  indexPlayer

    set playerIndex = 0
    loop
        set indexPlayer = Player(playerIndex)
        if GetPlayerController(indexPlayer) == whichControl then
            call ForceAddPlayer(f, indexPlayer)
        endif

        set playerIndex = playerIndex + 1
        exitwhen playerIndex == bj_MAX_PLAYER_SLOTS
    endloop

    return f
endfunction
Source
Blizzard.j
wc3modding.com
GetPlayersByMapControl