mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 13:53:45 +03:00
Upload
This commit is contained in:
75
gamemodes/base/gamemode/cl_pickteam.lua
Normal file
75
gamemodes/base/gamemode/cl_pickteam.lua
Normal file
@@ -0,0 +1,75 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
Name: gamemode:ShowTeam()
|
||||
Desc:
|
||||
-----------------------------------------------------------]]
|
||||
function GM:ShowTeam()
|
||||
|
||||
if ( IsValid( self.TeamSelectFrame ) ) then return end
|
||||
|
||||
-- Simple team selection box
|
||||
self.TeamSelectFrame = vgui.Create( "DFrame" )
|
||||
self.TeamSelectFrame:SetTitle( "Pick Team" )
|
||||
|
||||
local AllTeams = team.GetAllTeams()
|
||||
local y = 30
|
||||
for ID, TeamInfo in pairs ( AllTeams ) do
|
||||
|
||||
if ( ID != TEAM_CONNECTING && ID != TEAM_UNASSIGNED ) then
|
||||
|
||||
local Team = vgui.Create( "DButton", self.TeamSelectFrame )
|
||||
function Team.DoClick() self:HideTeam() RunConsoleCommand( "changeteam", ID ) end
|
||||
Team:SetPos( 10, y )
|
||||
Team:SetSize( 130, 20 )
|
||||
Team:SetText( TeamInfo.Name )
|
||||
|
||||
if ( IsValid( LocalPlayer() ) && LocalPlayer():Team() == ID ) then
|
||||
Team:SetEnabled( false )
|
||||
end
|
||||
|
||||
y = y + 30
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
if ( GAMEMODE.AllowAutoTeam ) then
|
||||
|
||||
local Team = vgui.Create( "DButton", self.TeamSelectFrame )
|
||||
function Team.DoClick() self:HideTeam() RunConsoleCommand( "autoteam" ) end
|
||||
Team:SetPos( 10, y )
|
||||
Team:SetSize( 130, 20 )
|
||||
Team:SetText( "Auto" )
|
||||
y = y + 30
|
||||
|
||||
end
|
||||
|
||||
self.TeamSelectFrame:SetSize( 150, y )
|
||||
self.TeamSelectFrame:Center()
|
||||
self.TeamSelectFrame:MakePopup()
|
||||
self.TeamSelectFrame:SetKeyboardInputEnabled( false )
|
||||
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
Name: gamemode:HideTeam()
|
||||
Desc:
|
||||
-----------------------------------------------------------]]
|
||||
function GM:HideTeam()
|
||||
|
||||
if ( IsValid(self.TeamSelectFrame) ) then
|
||||
self.TeamSelectFrame:Remove()
|
||||
self.TeamSelectFrame = nil
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user