Different amount of players on a team

I am currently working on a Jailbreak gamemode which can’t have to many guards. The server cap is 24 and there needs to be 7 to 6 guards and the rest prisoners. Obviously I would want there to be less guards if there are only like 10 prisoners, probably 3 or 2 to make it balanced all the time. I am struggling to do it though. Any help? Thanks!

Well, the math could go something like



MaxGuards = math.Floor(NumberOfPlayers * 0.6)


That isn’t actually what you’d use, but that’s the concept.

…I don’t really understand

bumb

First, check if there is a space available:
[lua]
function CanJoinGuards()
if team.NumPlayers( 1 ) <= math.floor( team.NumPlayers( 2 ) * 0.25 ) then return true
else return false
end
end
[/lua]
This would make there be 1 guard for ~6 prisoners.

Then place them in the correct team:
[lua]
function GM:PlayerInitialSpawn(ply)
tm = ( CanJoinGuards() and 1 ) or 2
ply:SetTeam( tm )
end
[/lua]
Team 1 would be the Guards and Team 2 the Prisoners.
You could also set a limit to the minimum amount of guards.
To make a swaplist or to balance the teams before a round you could use the same logic.

I’ll try it out… Thank you!

[editline]28th September 2013[/editline]

It works really well… But the only issue I have is that if there are maximum number of guards on guard team they can click the Guard button to go to the guard team.

[editline]28th September 2013[/editline]

I’m thinking I might need a swaplist to prevent this from happening

You might need to actually figure shit out yourself instead of spamming the Developer Discussion board with your constant requests for your ‘vry unique fr3tta deathrun!!!’.

Do you mean you have a menu to allow people who have just joined to select a team and they can still select it?

Yes… I have been working on one for some time now. I will need to get it finished then.

[editline]28th September 2013[/editline]

XD Lol. Thats what I am doing. How do you think I even start on the gamemode? If got help for things other things and though “Oh this will go here and work like that”. I do figure stuff out but I am still pretty slow on Lua. Whats wrong with asking for help. I give help back to people. If you spend some time you will see I have post suggestions and helps on many threads here XD

Use the CanJoinGuards function in the menu to stop people from selecting the Guards team if it’s full.

In all your posts, you never show that you actually have tried and you just constantly ask for help.
Heres your server summed up in 6 posts including this thread

http://forum.facepunch.com/showthread.php?t=1306936
http://forum.facepunch.com/showthread.php?t=1310939
http://forum.facepunch.com/showthread.php?t=1310436
http://forum.facepunch.com/showthread.php?t=1310433
http://forum.facepunch.com/showthread.php?t=1310435

You don’t need to tell me that. I made them. I never said I didn’t. Why would it bother you anyway. You don’t need to help if you don’t want to :smiley:

The whole reason this place is here is so people who do not understand or need help on what they are doing can find help. What would be the point of just trying to do it by yourself and never completing it because you didn’t know what to do.