Skip to content

UserFunction; Player_Team

Cloaked edited this page Jun 10, 2020 · 1 revision

Returns the team number of a player (may be a different number than what is in the game-setup screen).

-------------------------------------------------------------------------------
-- returns the team number of a player (may be different than what is in the game-setup screen)
-- function created by Mikali
--
function Player_Team(iPlayer)
    local TeamsTable = {}
    for playerIndex = 0, PlayerCount do
        local IsAllied = 0
        for i = 1, getn(TeamsTable) do
            if (AreAllied(playerIndex, TeamsTable[i]) == 1) then
                IsAllied = 1
                break
            end
        end
        if (IsAllied == 0) then
            tinsert(TeamsTable, playerIndex)
        end
    end
    for i = 1, getn(TeamsTable) do
        if (AreAllied(iPlayer, TeamsTable[i]) == 1) then
            return i
        end
    end
end

Comments

Page Status

Updated Formatting? Initial
Updated for HWRM? Initial

Clone this wiki locally