Garry's Mod SWEP Base - Ranged Weapons

Garry's Mod SWEP Base - Ranged Weapons


     
    SWEP.Category                           = "Bitl's Sweps" -- The category for your SWEP.
    SWEP.PrintName                          = "A SWEP" -- The name for your SWEP.          
    SWEP.Author                             = "Bitl" -- The SWEP author's name. It's you..right?
    SWEP.Instructions                       = "" -- Instructions for how to use the SWEP.
    SWEP.Spawnable                          = true -- Is our SWEP spawnable from the spawn menu?
    SWEP.AdminOnly                          = false -- Is our SWEP admin only?
    SWEP.Primary.Sound                      = Sound( "weapons/shoot.wav" ) --What sound?
    SWEP.Primary.ClipSize                   = 30 -- How many bullets do we have in our primary clip?
    SWEP.Primary.DefaultClip                = 60 -- How many bullets do we have by default?
    SWEP.Primary.Automatic                  = true --Is our SWEP automatic on our primary attack?
    SWEP.Primary.Ammo                       = "AR2" -- What type of primary ammo do we have?
    SWEP.Secondary.ClipSize                 = -1 -- How many bullets do we have in our secondary clip?
    SWEP.Secondary.DefaultClip              = -1 -- How many bullets do we have by default?
    SWEP.Secondary.Automatic                = false --Is our SWEP automatic on our secondary attack?
    SWEP.Secondary.Ammo                     = "None" -- What type of secondary ammo do we have?
    SWEP.Weight                             = 3 -- How much weight? TODO: Find out what this means.
    SWEP.AutoSwitchTo                       = false -- Auto switch to our SWEP?
    SWEP.AutoSwitchFrom                     = false -- Auto switch from our SWEP?
    SWEP.Slot                               = 2 -- Which slot is our SWEP in? 0 is slot 1, 1 is slot 2, etc.
    SWEP.SlotPos                            = 7 -- What slot position is our SWEP in? 0 is slot 1, 1 is slot 2, etc.
    SWEP.DrawAmmo                           = true -- Draw ammo on the HUD?
    SWEP.DrawCrosshair                      = true -- Draw crosshair on the HUD?
    SWEP.ViewModel                          = "models/weapons/v_pistol.mdl" --View Model
    SWEP.WorldModel                         = "models/weapons/w_pistol.mdl" --World Model
     
    function SWEP:Initialize()
     
            --How do we hold our SWEP?
            self:SetWeaponHoldType( "ar2" )
     
    end
     
    function SWEP:PrimaryAttack()
     
            -- Make sure we can shoot first
            if (  !self:CanPrimaryAttack() ) then return end
     
            -- Play shoot sound
            self.Weapon:EmitSound(SWEP.Primary.Sound)
           
            -- Shoot 9 bullets, 150 damage, 0.75 aimcone
            self:ShootBullet( 11, 1, 0.06 )
           
            -- Remove 1 bullet from our clip
            self:TakePrimaryAmmo( 1 )
           
            -- Punch the player's view
            self.Owner:ViewPunch( Angle( -1, 0, 0 ) )
           
            -- Fire rate.
            self.Weapon:SetNextPrimaryFire( CurTime() + 0.085 )
     
    end
     
    --AMMO TYPE LIST:
     
    --AR2 - Ammunition of the AR2/Pulse Rifle
    --AlyxGun - (name in-game "5.7mm Ammo")
    --Pistol - Ammunition of the 9MM Pistol
    --SMG1 - Ammunition of the SMG/MP7
    --357 - Ammunition of the .357 Magnum
    --XBowBolt - Ammunition of the Crossbow
    --Buckshot - Ammunition of the Shotgun
    --RPG_Round - Ammunition of the RPG/Rocket Launcher
    --SMG1_Grenade - Ammunition for the SMG/MP7 grenade launcher (secondary fire)
    --SniperRound
    --SniperPenetratedRound - (name in-game ".45 Ammo")
    --Grenade - Note you must be given the grenade weapon (weapon_frag) before you can throw grenades.
    --Thumper - Ammunition cannot exceed 2 (name in-game "Explosive C4 Ammo")
    --Gravity - (name in-game "4.6MM Ammo")
    --Battery - (name in-game "9MM Ammo")
    --GaussEnergy
    --CombineCannon - (name in-game ".50 Ammo")
    --AirboatGun - (name in-game "5.56MM Ammo")
    --StriderMinigun - (name in-game "7.62MM Ammo")
    --HelicopterGun
    --AR2AltFire - Ammunition of the AR2/Pulse Rifle 'combine ball' (secondary fire)
    --slam - Like Grenade, but for the Selectable Lightweight Attack Munition (S.L.A.M)
     
    --HOLD TYPE LIST:
     
    --ar2
    --camera
    --crossbow
    --duel (dual pistols)
    --fist
    --grenade
    --gravgun
    --knife
    --melee
    --melee2 (two-handed melee weapons)
    --passive (not aiming in front)
    --pistol (one-handed small firearms, some knockback on attack anim)
    --revolver (two-handed small firearms, heavier knockback on attack anim)
    --rpg
    --shotgun
    --slam
    --smg

No comments:

Post a Comment