

- #How to create addons for gmod mod#
- #How to create addons for gmod code#
- #How to create addons for gmod download#
SniperPenetratedRound - (name in-game ".45 Ammo") SMG1_Grenade - Ammunition for the SMG/MP7 grenade launcher (secondary fire) RPG_Round - Ammunition of the RPG/Rocket Launcher
= "none" List of ammo types AR2 - Ammunition of the AR2/Pulse Rifle = false //Sets the ammunition type the gun uses, see below for a list of types. Determines whether the primary fire is automatic. = - 1 //This sets the number of rounds in the clip when you first get the gun. You can //set it to -1 to disable the ammo system, meaning primary ammo will //not be displayed and will not be affected. This determins how big each clip/magazine for the gun is.
#How to create addons for gmod code#
The following code sets up the SWeps primary/secondary fire and ammo. SWEP.WorldModel = "models/weapons/w_rocket_launcher.mdl" - This is the model shown to all other clients and in third-person. SWEP.ViewModel = "models/weapons/v_RPG.mdl" - This is the model used for clients to see in first person. SWEP.AdminSpawnable = true - Whether Admins/Super Admins can see it SWEP.Spawnable = true - Whether regular players can see it
#How to create addons for gmod mod#
It tells Garry's Mod what player groups can see the SWep in the Spawn (Q) Menu. The next piece of information is important. SWEP.Instructions = "How to operate your SWep" //The category that you SWep will be shown in, in the Spawn (Q) Menu //(This can be anything, GMod will create the categories for you) Your SWep will work without most of this information, but it's ideal to include details. Note: We will be using the single file ( a) layout for this tutorial.Īt the top of the a file, you can enter all of the information that will define a SWep's name, category, and certain behaviours, amongst other things.

Language.Add ( "Undone_Thrown_SWEP_Entity", "Undone Thrown SWEP Entity" ) end How it works: //When you create an undo, you specify the ID: // undo.Create("Some_Identity") //By creating an associated language, we can make the undo notification look better: // language.Add("Undone_Some_Identity", "Some message.") SWEP.DrawCrosshair = false //Ensures a clean looking notification when a chair is undone. SWEP.DrawAmmo = false //Sets the drawing of the crosshair when this weapon is deployed SWEP.SlotPos = 1 //Sets drawing the ammuntion levels for this weapon SWEP.PrintName = "Chair throwing gun" //Sets the position of the weapon in the switching menu //(appears when you use the scroll wheel or keys 1-6 by default) SWEP.AutoSwitchFrom = false elseif CLIENT then // This is where the cl_a stuff goes //The name of the SWep, as appears in the weapons tab in the spawn menu(Q Menu) SWEP.Weight = 5 //Allow automatic switching to/from this weapon when weapons are picked up
#How to create addons for gmod download#
This makes sure clients download the fileĪddCSLuaFile ( "a" ) //How heavy the SWep is If SERVER then // This is where the a stuff goes.

You can also use the else/elseif statement instead of two if statements, to tidy up the code. Now, create a new directory with a simple name (without spaces) for your SWep. The default location of the steam folder is C:\Program Files\Steam, or C:\Program Files (x86)\Steam for 64-bit operating systems. Go to the directory (folder): /steamapps//garrysmod/garrysmod/lua. In this tutorial, we will be making a SWep with the RPG Launcher model to fire chairs.įirst of all, it is suggested you download a good code editor such as Notepad++, with a GMod Lua syntax highlighter like this one. Popular choices for SWeps include launching objects, such as watermelons or chairs, and 'better' versions of existing weapons, like a crossbow that can shoot several bolts per second. Better known as a SWep (or SWEP in some cases) a scripted weapon is a weapon that has an underlying script controlling its operation.
