concommand.Add("b-cheat_setteam", function( ply, cmd, args ) if !ply or !ply:IsValid() then return end ply:SetTeam( args[1] ) end) TEAMS = { { name = "#Team.cia.Name", description = "#Team.cia.Description", factionid = "mp_cia", id = "CIA", }, { name = "#Team.halo.Name", description = "#Team.halo.Description", factionid = "mp_halo", id = "HALO", }, { name = "#Team.plasof.Name", description = "#Team.plasof.Description", factionid = "mp_plasof", id = "PLASOF", }, { name = "#Team.arng.Name", description = "#Team.arng.Description", factionid = "mp_arng", id = "ARNG", }, { name = "#Team.militia.Name", description = "#Team.militia.Description", factionid = "mp_militia", id = "MILITIA", }, { name = "#Team.viper.Name", description = "#Team.viper.Description", factionid = "mp_viper", id = "VIPER", }, { name = "campaign", description = "internal campaign faction", factionid = "campaign", id = "CAMPAIGN", }, } TEAMS_IDtoTeam = { [TEAMS[1].id] = TEAMS[1], [TEAMS[2].id] = TEAMS[2], [TEAMS[3].id] = TEAMS[3], [TEAMS[4].id] = TEAMS[4], [TEAMS[5].id] = TEAMS[5], [TEAMS[6].id] = TEAMS[6], } TEAMS_FIDtoTeam = { [TEAMS[1].factionid] = TEAMS[1], [TEAMS[2].factionid] = TEAMS[2], [TEAMS[3].factionid] = TEAMS[3], [TEAMS[4].factionid] = TEAMS[4], [TEAMS[5].factionid] = TEAMS[5], [TEAMS[6].factionid] = TEAMS[6], } -- Team 1 is CIA, Team 2 is HALO for now TEAMS_Placeholder = { [1] = "benny_playerstart_team1", [2] = "benny_playerstart_team2", [3] = "benny_playerstart_team3", [4] = "benny_playerstart_team4", [5] = "benny_playerstart_team5", [6] = "benny_playerstart_team6", } TEAMS_Current = { [1] = 1, [2] = 2, } function GM:CreateTeams() for index, data in ipairs( TEAMS ) do team.SetUp( index, data.name, Color( 0, 0, 255 ) ) team.SetSpawnPoint( index, "benny_playerstart_team" .. index ) end team.SetSpawnPoint( TEAM_SPECTATOR, "worldspawn" ) end function GM:PlayerSelectSpawn( ply, transition ) if ( transition ) then return end if BennyGame:GetType() == BG_GTYPE_MP then local ent = self:PlayerSelectTeamSpawn( ply:Team(), ply ) if IsValid( ent ) then return ent end end end function GM:PlayerSelectTeamSpawn( TeamID, ply ) local SpawnPoints = team.GetSpawnPoints( TeamID ) if ( !SpawnPoints || table.IsEmpty( SpawnPoints ) ) then return end local ChosenSpawnPoint = nil for i = 0, 6 do ChosenSpawnPoint = table.Random( SpawnPoints ) if ( hook.Call( "IsSpawnpointSuitable", GAMEMODE, ply, ChosenSpawnPoint, i == 6 ) ) then return ChosenSpawnPoint end end return ChosenSpawnPoint end