First of all, yes this isn’t the game modes section, but this question fits here better than in the gamemodes.
This is my cl_init.lua file
[lua]
include( ‘shared.lua’ )
function set_team()
local frame = vgui.Create( “DFrame” )
frame:SetPos( ScrW() / 2, ScrH() / 2 ) --Set the window in the middle of the players screen/game window
frame:SetSize( 200, 210 ) --Set the size
frame:SetTitle( “Change Team” ) --Set title
frame:SetVisible( true )
frame:SetDraggable( false )
frame:ShowCloseButton( true )
frame:MakePopup()
team_1 = vgui.Create( “DButton”, frame )
team_1:SetPos( frame:GetTall() / 2, 5 ) --Place it half way on the tall and 5 units in horizontal
team_1:SetSize( 50, 100 )
team_1:SetText( “Team RED” )
team_1.DoClick = function() --Make the player join team 1
RunConsoleCommand( “team_1” )
end
team_2 = vgui.Create( “DButton”, frame )
team_2:SetPos( frame:GetTall() / 2, 105 ) --Place it next to our previous one
team_2:SetSize( 50, 100 )
team_2:SetText( “Team BLUE” )
team_2.DoClick = function() --Make the player join team 2
RunConsoleCommand( “team_2” )
end
end
concommand.Add( “team_menu”, set_team )
[/lua]
This is my init.lua file
[lua]
AddCSLuaFile( “cl_init.lua” )
AddCSLuaFile( “shared.lua” )
include( ‘shared.lua’ )
// Serverside only stuff goes here
/---------------------------------------------------------
Name: gamemode:PlayerLoadout( )
Desc: Give the player the default spawning weapons/ammo
---------------------------------------------------------/
function GM:PlayerInitialSpawn( ply )
RunConsoleCommand( "team_menu" ) --Run the console command when the player first spawns
end
function GM:PlayerLoadout(ply) --“The weapons/items that the player spawns with” function
ply:StripWeapons() -- This command strips all weapons from the player.
if ply:Team() == 1 then --If the player is on team "Team RED"...
ply:Give("weapon_crowbar") -- ...then give them the Crow Bar.
elseif ply:Team() == 2 then -- Otherwise, if the player is on team "Team BLUE"...
ply:Give("weapon_stunstick") -- ...then give them the Stun Stick.
end -- This ends the if/elseif.
end – This ends the function
function team_1( ply )
ply:SetTeam( 1 )
end
function team_2( ply )
ply:SetTeam( 2 )
end
concommand.Add( “team_1”, team_1 )
concommand.Add( “team_2”, team_2 )
[/lua]
And this is my shared.lua file
[lua]
GM.Name = “RUSHMOD”
GM.Author = “C-UNIT”
GM.Email = “N/A”
GM.Website = “N/A”
team.SetUp( 1, “TeamRED”, Color( 255, 55, 0, 155, 1 ) ) – for team red
team.SetUp( 1, “TeamBLUE”, Color( 0, 0, 255 ) ) – for team blue
[/lua]
My game mode is when you first join a menu comes up, and you choose team red or team blue, if you go team blue, you get a stun stick, if you go red you get a crow bar, but when i join the menu comes up, and when i click team read or team blue, nothing happens i have to exit out of the pop-up box that lets you choose, and i have no weapons at all, and you are always team blue, no matter what, any ideas?