Ok so what im trying to do here is make a team balancing system for a Fretta gamemode, I want it so there will be 3 people on team 2 to every 1 person on team 1. I would really like to test it but its hard to get like like 10 people to help me test it so I was wondering if someone could tell me if theres anything wrong with it or something. Thanks
[Lua]function GM:CheckTeamBalance()
local ratio = 3
local notice
for id, tm in pairs( team.GetAllTeams() ) do
if ( id > 0 && id < 1000 && team.Joinable( id ) ) then
if ( team.NumPlayers( 2 ) / team.NumPlayers( 1 ) < ratio ) then
local ply = GAMEMODE:FindLeastCommittedPlayerOnTeam( 1 )
ply:Kill()
ply:SetTeam( 2 )
// Todo: Notify player 'you have been swapped'
// This is a placeholder
ply:ChatPrint( "You have been swapped to "..team.GetName( 2 ).." for team balance" )
notice = true
end
end
if !notice then return end
end
// Send a notice to every player here - Use chatprint? Something else?
end[/Lua]
[editline]01:20PM[/editline]
Ok now it should be right, or at least I think it is
Well, is it?
Im not sure I cant test it fully, I need alot of testers soo im not sure
Sorry, you need to Log In to post a reply to this thread.