Make your own team In-game

Do somebody have a script for a gamemode or addon that allows your to make your own teams in-game? Would be really nice. If you don’t, are there any ideas on how to do it? I’ve made a derma where you can insert the team name, colour and so on, but it stopped when i came to the coding of the creation of the teams itself. I tried searching garrysmod.org for anything like it, but i didnt manage to find anything useful.

Hey. I dont think that is Possible. You have to make a team with team.SetUp()
I dont think you can Setup a team ingame.
If its Possible, correct me please.

I was playing this gamemode “FTS” (fight to survive) and they had a “Create team” function. That’s where i first saw it. You could choose the colour, name, members, and so on.

I was thinking of making a gamemode read a .txt file where the different teams where saved. When the creator of the team left, the line would be deleted, and the team removed.

I think Stranded had something compareable to that with tribes. Perhaps that you would like to check it out?

Good idea! I’ll take a look!

I expect they truly aren’t “teams” per say but simple creating more information tagged onto each player and sending that information to all players to display on their leaderboard. it would be complicated but it would just deal with more custom checks and stuff. Again i doubt they made teams ingame using team.SetUp() as I’m pretty sure that requires a map restart.

You can use team.SetUp() whenever you want, just make sure to send a usermessage to the client to do the same team.SetUp()

(or be lazy and use SendLua to all the clients)

Stranded does it.

I dont know why someone gave me a Dumb. I Wrote that someone can Correct me if i write the false.
_
@Squad Yepp. I read that thread too :wink:

Peace maker, dont worry about it, you get owned no matter what you post on facepunch. Ignore it (I’m not saying just you, I’ve had my moments too)

Besides, as far as I can remember, you’re new to lua, and it makes me feel good to see that you try to help people. But, yes, yes you can do that.

Anyway, I’m not 100 percent sure on this one, b/c I tried doing something like this a long time ago, but decided 4 default team’s would suffice.
But I’d imagine you’d do something like this:
[lua]
–I’m not going to make a Derma Panel for this so there’s a lot of stuff missing here
function CreateNewTeam(teamname,colorofteam)–These are aquired from the derma and once you push a “Create” button it’s sent here
local number = team.GetAllTeams()+1
team.SetUp(number,teamname,colorofteam)
–(teamname would be a string and colorofteam would be: Color(0,0,0,255))
end
[/lua]
I realize this probably wont work (obviously, since you dont have derma, but even if you did, there would be errors, however, this makes sense to me in most aspects and I hope it gave you some sort of… assistance.

I’ve been trying a lot with all kinds of scripts, and they all failed, when i finally decided to just make some premade teams, i noticed that team.SetUp wouldn’t work if i had the gamemode derived from sandbox! Anyone know a fix for this?