

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 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.
