I am trying to get it so that when a player selects the vgui button “Criminals” they spawn in info_player_terrorists spawn points. Here is what my init.lua looks like.
Oh and another question, How do i make the Vgui screen close once a players has clicked on a team?
AddCSLuaFile( "cl_init.lua" ) //Tell the server that the client need to download cl_init.lua
AddCSLuaFile( "shared.lua" ) //Tell the server that the client need to download shared.lua
include( 'shared.lua' ) //Tell the server to load shared.lua
function GM:PlayerInitialSpawn( ply ) //"When the player first joins the server and spawns" function
ply:ConCommand( "team_menu" ) //Run the console command when the player first spawns
end //End the "when player first joins server and spawn" function
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 "Guest"...
ply:Give("weapon_ak47") -- ...then give them the Gravity Gun.
ply:SetModel( "models/player/Eli.mdl" )
elseif ply:Team() == 2 then -- Otherwise, if the player is on team "Another Guest"...
ply:Give("weapon_m4") -- ...then give them the Phys Gun.
ply:SetModel( "models/player/Police.mdl" )
end -- This ends the if/elseif.
end -- This ends the function.
function team_1( ply )
ply:SetTeam( 1 ) //Make the player join team 1
ply:Spawn()
end
function team_2( ply )
ply:SetTeam( 2 ) //Make the player join team 2
ply:Spawn()
end
concommand.Add( "team_1", team_1 ) //Add the command to set the players team to team 1
concommand.Add( "team_2", team_2 ) //Add the command to set the players team to team 2