Author Topic: Team Spawning  (Read 1477 times)

0 Members and 1 Guest are viewing this topic.

Offline Doomed

  • Newbie
  • *
  • Posts: 28
  • Karma: 0
Team Spawning
« on: February 16, 2017, 06:50:55 PM »
How would I go about adding a check to make sure an info_player_red or info_player blue exists on a given map? The gamemode can have 2 to 4 (red, blue, green or yellow) teams depending on the map and the way it is currently somebody may spawn on the green team although that team may not exist on that map.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Team Spawning
« Reply #1 on: February 17, 2017, 05:18:00 PM »

From my understanding, spawn points are a 'class' of a map entity.
One way...
local red_spawns = ents.FindByClass( "info_player_red" )
local blue_spawns = ents.FindByClass( "info_player_blue" )
.. green ..
.. yellow ..

Then check if tables are empty.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Doomed

  • Newbie
  • *
  • Posts: 28
  • Karma: 0
Re: Team Spawning
« Reply #2 on: February 17, 2017, 07:25:55 PM »
thanks for reply, ya all i had to do was loop through the info_player_* ents.