Bitl

Bitl's Garry's Mod SWEP Base - Ranged Weapons

Aug 6th, 2013
1,648
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.03 KB | None | 0 0
  1. --This base is working as of August 6, 2013.
  2. --For Garry's Mod 13.
  3. --When your done, save this file as a Lua file and put it in your Garrysmod lua/weapons folder.
  4. --Don't forget to add me as a contributor on Steam Workshop if you upload it there! :)
  5.  
  6. --If you want to make melee weapons, go here:
  7. --http://pastebin.com/CVkddaf2
  8.  
  9. --BITL'S SWEP BASE 2013: Ranged Weapons
  10.  
  11. SWEP.Category               = "Bitl's Sweps" -- The category for your SWEP.
  12. SWEP.PrintName              = "A SWEP" -- The name for your SWEP.      
  13. SWEP.Author             = "Bitl" -- The SWEP author's name. It's you..right?
  14. SWEP.Instructions           = "" -- Instructions for how to use the SWEP.
  15. SWEP.Spawnable              = true -- Is our SWEP spawnable from the spawn menu?
  16. SWEP.AdminOnly              = false -- Is our SWEP admin only?
  17. SWEP.Primary.Sound          = Sound( "weapons/shoot.wav" ) --What sound?
  18. SWEP.Primary.ClipSize           = 30 -- How many bullets do we have in our primary clip?
  19. SWEP.Primary.DefaultClip        = 60 -- How many bullets do we have by default?
  20. SWEP.Primary.Automatic          = true --Is our SWEP automatic on our primary attack?
  21. SWEP.Primary.Ammo           = "AR2" -- What type of primary ammo do we have?
  22. SWEP.Secondary.ClipSize         = -1 -- How many bullets do we have in our secondary clip?
  23. SWEP.Secondary.DefaultClip      = -1 -- How many bullets do we have by default?
  24. SWEP.Secondary.Automatic        = false --Is our SWEP automatic on our secondary attack?
  25. SWEP.Secondary.Ammo         = "None" -- What type of secondary ammo do we have?
  26. SWEP.Weight             = 3 -- How much weight? TODO: Find out what this means.
  27. SWEP.AutoSwitchTo           = false -- Auto switch to our SWEP?
  28. SWEP.AutoSwitchFrom         = false -- Auto switch from our SWEP?
  29. SWEP.Slot               = 2 -- Which slot is our SWEP in? 0 is slot 1, 1 is slot 2, etc.
  30. SWEP.SlotPos                = 7 -- What slot position is our SWEP in? 0 is slot 1, 1 is slot 2, etc.
  31. SWEP.DrawAmmo               = true -- Draw ammo on the HUD?
  32. SWEP.DrawCrosshair          = true -- Draw crosshair on the HUD?
  33. SWEP.ViewModel              = "models/weapons/v_pistol.mdl" --View Model
  34. SWEP.WorldModel             = "models/weapons/w_pistol.mdl" --World Model
  35.  
  36. function SWEP:Initialize()
  37.  
  38.     --How do we hold our SWEP?
  39.     self:SetWeaponHoldType( "ar2" )
  40.  
  41. end
  42.  
  43. function SWEP:PrimaryAttack()
  44.  
  45.     -- Make sure we can shoot first
  46.     if (  !self:CanPrimaryAttack() ) then return end
  47.  
  48.     -- Play shoot sound
  49.     self.Weapon:EmitSound(SWEP.Primary.Sound)
  50.    
  51.     -- Shoot 9 bullets, 150 damage, 0.75 aimcone
  52.     self:ShootBullet( 11, 1, 0.06 )
  53.    
  54.     -- Remove 1 bullet from our clip
  55.     self:TakePrimaryAmmo( 1 )
  56.    
  57.     -- Punch the player's view
  58.     self.Owner:ViewPunch( Angle( -1, 0, 0 ) )
  59.    
  60.     -- Fire rate.
  61.     self.Weapon:SetNextPrimaryFire( CurTime() + 0.085 )
  62.  
  63. end
  64.  
  65. --AMMO TYPE LIST:
  66.  
  67. --AR2 - Ammunition of the AR2/Pulse Rifle
  68. --AlyxGun - (name in-game "5.7mm Ammo")
  69. --Pistol - Ammunition of the 9MM Pistol
  70. --SMG1 - Ammunition of the SMG/MP7
  71. --357 - Ammunition of the .357 Magnum
  72. --XBowBolt - Ammunition of the Crossbow
  73. --Buckshot - Ammunition of the Shotgun
  74. --RPG_Round - Ammunition of the RPG/Rocket Launcher
  75. --SMG1_Grenade - Ammunition for the SMG/MP7 grenade launcher (secondary fire)
  76. --SniperRound
  77. --SniperPenetratedRound - (name in-game ".45 Ammo")
  78. --Grenade - Note you must be given the grenade weapon (weapon_frag) before you can throw grenades.
  79. --Thumper - Ammunition cannot exceed 2 (name in-game "Explosive C4 Ammo")
  80. --Gravity - (name in-game "4.6MM Ammo")
  81. --Battery - (name in-game "9MM Ammo")
  82. --GaussEnergy
  83. --CombineCannon - (name in-game ".50 Ammo")
  84. --AirboatGun - (name in-game "5.56MM Ammo")
  85. --StriderMinigun - (name in-game "7.62MM Ammo")
  86. --HelicopterGun
  87. --AR2AltFire - Ammunition of the AR2/Pulse Rifle 'combine ball' (secondary fire)
  88. --slam - Like Grenade, but for the Selectable Lightweight Attack Munition (S.L.A.M)
  89.  
  90. --HOLD TYPE LIST:
  91.  
  92. --ar2
  93. --camera
  94. --crossbow
  95. --duel (dual pistols)
  96. --fist
  97. --grenade
  98. --gravgun
  99. --knife
  100. --melee
  101. --melee2 (two-handed melee weapons)
  102. --passive (not aiming in front)
  103. --pistol (one-handed small firearms, some knockback on attack anim)
  104. --revolver (two-handed small firearms, heavier knockback on attack anim)
  105. --rpg
  106. --shotgun
  107. --slam
  108. --smg
Advertisement
Add Comment
Please, Sign In to add comment