• About team.SetSpawnPoint?
    4 replies, posted
Hello, I'm trying to set spawn points for each team in my gamemode, but team.SetSpawnPoint seem not to work. Here is the code: [lua]function GM:CreateTeams() TEAM_WAIT = 1 team.SetUp( TEAM_WAIT, "Waiting", Color( 0, 0, 255 ) ) team.SetSpawnPoint( TEAM_WAIT, "info_player_counterterrorist" ) TEAM_BUILD = 2 team.SetUp( TEAM_BUILD, "Builders", Color( 255, 150, 0 ) ) team.SetSpawnPoint( TEAM_BUILD, "info_player_counterterrorist" ) TEAM_ATTACK = 3 team.SetUp( TEAM_ATTACK, "Attackers", Color( 255, 150, 150 ) ) team.SetSpawnPoint( TEAM_ATTACK, "info_player_terrorist" ) end[/lua]
Use [lua[b][/b]] and [/[b][/b]lua] tags.
Doit the cool way: [lua] function GM:PlayerSpawn(ply) if ply:Team() == TEAM_WAIT then local points = ents.FindByClass("info_player_counterterrorist") ply:SetPos(points[math.random(1,#points)]) end end [/lua]
[QUOTE=Donkie;28103839]Doit the cool way: [lua] function GM:PlayerSpawn(ply) if ply:Team() == TEAM_WAIT then local points = ents.FindByClass("info_player_counterterrorist") ply:SetPos(points[math.random(1,#points)]) end end [/lua][/QUOTE] Thanks it worked, but after putting :GetPos() after points[math.random(1,#points)] Like this: [lua] function GM:PlayerSpawn(ply) if ply:Team() == TEAM_WAIT then local points = ents.FindByClass("info_player_counterterrorist") ply:SetPos(points[math.random(1,#points)]:GetPos()) end end [/lua]
[QUOTE=Acid Banana;28106939]Thanks it worked, but after putting :GetPos() after points[math.random(1,#points)] Like this: [lua] function GM:PlayerSpawn(ply) if ply:Team() == TEAM_WAIT then local points = ents.FindByClass("info_player_counterterrorist") ply:SetPos(points[math.random(1,#points)]:GetPos()) end end [/lua][/QUOTE] Ah yeah, forgot that.
Sorry, you need to Log In to post a reply to this thread.