Spectator team access (Prop Hunt)

So I was wondering if there is a way to make the Spectator team for admins only. I’ve searched all over and asked a few people but can’t find out anything. Anyways, If there is a way to do this, I’d appreciate the help.

Note: I’m needing this to keep players from joining spectator and ghosting with their friends on Skype and what not.

those should get you started check if the player is team_spectator then move them unless there admin

Create a new team so you can move the players to that
the team.setup code should be in your gamemodes shared.lua

you would need basic lua knowledge for this

line 91 to 95 of shared.lua
[lua]
function GM:CreateTeams()
team.SetUp(TEAM_TERROR, “Terrorists”, Color(0, 200, 0, 255), false)
team.SetUp(TEAM_SPEC, “Spectators”, Color(200, 200, 0, 255), true)
[/lua]
add another team and do what i said make it so if they are not admin switch their team to the new team you created

also gmod has a default hook so u can change the team when the player is dead by adding a hook for this http://wiki.garrysmod.com/page/GM/PlayerDeath

Any errors or need help add me

I can’t just create a new team, that would completely mess up the gameplay. This is for prop hunt, and spectator is done through that god awful fretta crap. I wouldnt mind making it so if a non admin tried to join spec it would force them to the Hunters team. That or make it so it simply wouldn’t let them join and maybe print a message to them saying “Spectator is for staff only” or something like that. But since I have no clue how the Spectator team is handled (cause its not created the same way as the normal teams) I wouldn’t know how to do any of that.

Well, there’s a function named PlayerJoinTeam which is called when a player tries to join a team. Check if the player is an admin and if the team is spectator, then go from there

[editline]28th September 2014[/editline]

Are you sure? Fretta is pretty much just like any other gamemode, although it may be done via the base instead of actual gamemode

I know, I just hate fretta cause of its MapVote/GMChanger system. Caused me a lot of trouble when I was setting up my server.

Anyway, I’ll mess around with the PlayerJoinTeam when I get a chance, see if I can get it working right.
Thanks for the reply.

I know I’m reviving a year old thread but I really need to know how to do this. Another thing is that I want to make it so spectators can see team chat so we have evidence of ghosting.