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 Now we will create the simple and basic parts for the gamemode.ĪddCSLuaFile ( "cl_a" ) -Tell the server that the client needs to download cl_aĪddCSLuaFile ( "a" ) -Tell the server that the client needs to download a.Now you are done with the folders and files needed for this part. Inside the gamemode folder, create three files and save them as "a", "a", and "cl_a". If it's not named like such, the gamemode won't load. Go inside the folder and add another folder called "gamemode" or "Gamemode". Go to your gamemode folder, create a new folder and name it as what you want your gamemode to be named. It just said, "download this, then do this and this", but here you will learn it all from the basics.īefore we start you need to need the files/folder hierarchy for Garry's Mod. I made this tutorial because the other one didn't have all the basic information.1.4 Set the team on first spawn and team loadout.