Why won't my teams spawn in the correct spots?

Hello. In my gamemode I’ve kinda abandoned for a while just because of this one error, my teams I created don’t spawn in the info_player_counterterrorist or info_player_terrorist spots they’re assigned to spawn in. I need help… I have no idea what I could’ve done wrong.

Here’s the code:(it’s in shared.lua)


function GM:CreateTeams()
team.SetUp(1, "Combine", Color(255, 0, 0), true)
team.SetSpawnPoint( Combine, ( "info_player_terrorist" ) )
team.SetUp(2, "Rebels", Color(61, 87, 106), true)
team.SetSpawnPoint( Rebels, ( "info_player_counterterrorist" ) )
end


You’re passing a nil value as the first argument. Use the team indexes instead.

e: ninja’d

also setting TEAM_COMBINE = 1, TEAM_REBEL = 2 and using those instead of the numeric values will make your code a little clearer


 
function GM:CreateTeams()     
     team.SetUp(1, "Combine", Color(255, 0, 0), true)
     team.SetSpawnPoint( 1, ( "info_player_terrorist" ) )

     team.SetUp(2, "Rebels", Color(61, 87, 106), true)
     team.SetSpawnPoint( 2, ( "info_player_counterterrorist" ) )
end


Also I have no idea why your second argument is in rounded brackets.


TEAM_COMBINE = 1
TEAM_REBELS = 2

function GM:CreateTeams()     
     team.SetUp(1, "Combine", Color(255, 0, 0), true)
     team.SetSpawnPoint( TEAM_COMBINE, ( "info_player_terrorist" ) )

     team.SetUp(2, "Rebels", Color(61, 87, 106), true)
     team.SetSpawnPoint( TEAM_REBELS, ( "info_player_counterterrorist" ) )
end

This is what I ended up using. It STILL doesn’t work…

[editline]22nd April 2015[/editline]

Oh, wait! I realized the error. :expressionless: wow, whoops.

Which map are you testing it in? Does the map have these entities? And, see my previous post, and look at the example usage of the function here

team.SetSpawnPoint

I said I realized the error. Yeah, the brackets were the problem. On the example on the gmod wiki I thought they used parentheses. My bad, it works now.