


Now we add so that when the player first spawns, run the console command "team_menu".Ĭhosen team menu shows on spawn function GM:PlayerInitialSpawn ( ply ) -"When the player first joins the server and spawns" function Now we have made a simple VGUI window that can be used to change team. Team_2.DoClick = function ( ) -Make the player join team 2

Team_2:SetPos ( frame:GetTall ( ) / 2, 105 ) -Place it next to our previous one Team_2 = vgui.Create ( "DButton", frame ) Team_1.DoClick = function ( ) -Make the player join team 1 Team_1:SetPos ( frame:GetTall ( ) / 2, 5 ) -Place it half way on the tall and 5 units in horizontal Team_1 = vgui.Create ( "DButton", frame ) And we will also add two console command to change team.įunction set_team ( ) local frame = vgui.Create ( "DFrame" )įrame:SetPos ( ScrW ( ) / 2, ScrH ( ) / 2 ) -Set the window in the middle of the players screen/game windowįrame:SetSize ( 200, 210 ) -Set the sizeįrame:SetTitle ( "Change Team" ) -Set title Now we will add a simple VGUI window to change team and we will another team.The "GM:PlayerLoadout" is called every time someone spawns and gives the player/team the weapon/ammo/items that is stated under it. The "GM:PlayerInitialSpawn" is called the first time the player spawn in the server.
#Pre made gmod darkrp server download code
With this code we will force the player to join team 1 ("Guest") and then give the player the Gravity Gun. Ply:Give ( "weapon_physcannon" ) -Give them the Gravity Gun end -Here we end the if condition end -Here we end the Loadout function Ply:SetTeam ( 1 ) -Add the player to team 1 end -End the "when player first joins server and spawns" function function GM:PlayerLoadout ( ply ) -Weapon/ammo/item function if ply:Team ( ) = 1 then -If player team equals 1 Set the team on first spawn and team loadoutįunction GM:PlayerInitialSpawn ( ply ) -"When the player first joins the server and spawns" function Now we will make the players join our team and give them the Gravity Gun.
#Pre made gmod darkrp server download download
Now we have told the server that the client needs to download cl_a and a, and that the server needs to load a. Include ( 'a' ) -Tell the server to load a
