Author Topic: Team Spawning  (Read 95 times)

0 Members and 1 Guest are viewing this topic.

Offline Doomed

  • Newbie
  • *
  • Posts: 21
  • Karma: 0
    • View Profile
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: 7589
  • Karma: 341
  • Sertafide Ulysses Jenius
    • View Profile
    • 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.
The price one pays for pursuing any profession or calling is an intimate knowledge of its ugly side. - James Baldwin

Offline Doomed

  • Newbie
  • *
  • Posts: 21
  • Karma: 0
    • View Profile
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.