Team Evening Being Dumb :P .

PROBLEM: Everytime a person dies he is set to another random team ( being the other team from the one he was previously on ).
Here is the code for the evening teams :stuck_out_tongue:
[lua]
//Evening Teams
local VTCG = math.random( 1, 2 )
local GAN = team.NumPlayers( 1 ) --Do we need that long variable?
local WHI = team.NumPlayers( 2 ) --Do we need that long variable?

if GAN > WHI then
ply:SetTeam( 2 )
elseif WHI > GAN then
ply:SetTeam( 1 )
elseif WHI == GAN then
ply:SetTeam( VTCG )
end
end
[/lua]
Also this may be it but not 100% sure the initial spawn is setting you to team 1
[lua]
function GM:PlayerInitialSpawn( ply )
ply:PrintMessage( HUD_PRINTTALK, "Welcome, " … ply:Name() … “!” )
ply:SetTeam( 1 )
end
[/lua]
Thanks for the help :slight_smile: :stuck_out_tongue:

wat

Haha dont know how to read?

<generic image macro here>

Haha dont know how to tell us what your actual problem is?

Dude i stated "Everytime a person dies he is set to another random team ( being the other team from the one he was previously on ). " Thats the problem. But here ill edit if for future preferences

Attempting to understand, but I believe the top bit is placed in function GM:PlayerSpawn(ply) no? If so, then that is causing them to change teams each round. Should show us what is calling the team change script.

Not sure what you mean buy this!?
And yes it is under that function, so to fix this i will have to remove it from that function!?

move the code
[lua]local VTCG = math.random( 1, 2 )
local GAN = team.NumPlayers( 1 ) --Do we need that long variable?
local WHI = team.NumPlayers( 2 ) --Do we need that long variable?

if GAN > WHI then
ply:SetTeam( 2 )
elseif WHI > GAN then
ply:SetTeam( 1 )
elseif WHI == GAN then
ply:SetTeam( VTCG )
end[/lua]

inside the function GM:PlayerInitialSpawn( ply )
This will say that when the player FIRST spawns(not every spawn) they will select a team.
You should be able to remove the function GM:PlayerSpawn( ply ) if that was all that was in it.