Liikuid
Spin Machine!
i have problem with this function
teams are formed but are unbalanced! example: 10 player. 7 Blues, 3 Reds.
PHP:
local function finishThis()
local t = getPlayers(waitingRoom.fromPos, waitingRoom.toPos)
if #t == 1 then
doPlayerSendTextMessage(t[1], 27, "Find another player to play with.")
doTeleportThing(t[1], temple, true)
elseif #t == 2 then
table.insert(red, t[1])
table.insert(blue, t[2])
elseif #t == 3 then
table.insert(red, t[1])
table.insert(blue, t[2])
table.insert(red, t[3])
elseif #t == 4 then
table.insert(red, t[1])
table.insert(blue, t[2])
table.insert(red, t[3])
table.insert(blue, t[4])
else
for _, v in ipairs(t) do
if math.random(1, 3) < 3 then
table.insert(red, v)
else
table.insert(blue, v)
end
end
end
if #red > 0 and #blue > 0 then
for _, r in ipairs(red) do
setPlayerStorageValue(r, redPlayers, 1)
doAddCondition(r, conditionRed)
doTeleportThing(r, ctf.redPos, true)
red = {}
end
for _, b in ipairs(blue) do
setPlayerStorageValue(b, bluePlayers, 1)
doAddCondition(b, conditionBlue)
doTeleportThing(b, ctf.bluePos, true)
blue = {}
end
end
return true
end
teams are formed but are unbalanced! example: 10 player. 7 Blues, 3 Reds.
Last edited: