summaryrefslogtreecommitdiff
path: root/entities/weapons/m9k_an94/shared.lua
diff options
context:
space:
mode:
authorAlexander Pickering <Alexander.Pickering@anondomain.site90.net>2016-04-16 02:02:00 -0400
committerAlexander Pickering <Alexander.Pickering@anondomain.site90.net>2016-04-16 02:02:00 -0400
commit7e5db609550cca0d8b8a76c4bf78ba4658962167 (patch)
tree4df54e0c4eccff0b022e0732c258b7b193fd6cfe /entities/weapons/m9k_an94/shared.lua
downloadgmstranded-7e5db609550cca0d8b8a76c4bf78ba4658962167.tar.gz
gmstranded-7e5db609550cca0d8b8a76c4bf78ba4658962167.tar.bz2
gmstranded-7e5db609550cca0d8b8a76c4bf78ba4658962167.zip
Initial commit
Diffstat (limited to 'entities/weapons/m9k_an94/shared.lua')
-rw-r--r--entities/weapons/m9k_an94/shared.lua167
1 files changed, 167 insertions, 0 deletions
diff --git a/entities/weapons/m9k_an94/shared.lua b/entities/weapons/m9k_an94/shared.lua
new file mode 100644
index 0000000..801f127
--- /dev/null
+++ b/entities/weapons/m9k_an94/shared.lua
@@ -0,0 +1,167 @@
+-- Variables that are used on both client and server
+SWEP.Gun = ("m9k_an94") -- must be the name of your swep but NO CAPITALS!
+if (GetConVar(SWEP.Gun.."_allowed")) != nil then
+ if not (GetConVar(SWEP.Gun.."_allowed"):GetBool()) then SWEP.Base = "bobs_blacklisted" SWEP.PrintName = SWEP.Gun return end
+end
+SWEP.Category = "M9K Assault Rifles"
+SWEP.Author = ""
+SWEP.Contact = ""
+SWEP.Purpose = ""
+SWEP.Instructions = ""
+SWEP.MuzzleAttachment = "1" -- Should be "1" for CSS models or "muzzle" for hl2 models
+SWEP.ShellEjectAttachment = "2" -- Should be "2" for CSS models or "1" for hl2 models
+SWEP.PrintName = "AN-94" -- Weapon name (Shown on HUD)
+SWEP.Slot = 2 -- Slot in the weapon selection menu
+SWEP.SlotPos = 25 -- Position in the slot
+SWEP.DrawAmmo = true -- Should draw the default HL2 ammo counter
+SWEP.DrawWeaponInfoBox = false -- Should draw the weapon info box
+SWEP.BounceWeaponIcon = false -- Should the weapon icon bounce?
+SWEP.DrawCrosshair = true -- set false if you want no crosshair
+SWEP.Weight = 30 -- rank relative ot other weapons. bigger is better
+SWEP.AutoSwitchTo = true -- Auto switch to if we pick it up
+SWEP.AutoSwitchFrom = true -- Auto switch from if you pick up a better weapon
+SWEP.HoldType = "ar2" -- how others view you carrying the weapon
+-- normal melee melee2 fist knife smg ar2 pistol rpg physgun grenade shotgun crossbow slam passive
+-- you're mostly going to use ar2, smg, shotgun or pistol. rpg and crossbow make for good sniper rifles
+
+SWEP.ViewModelFOV = 55
+SWEP.ViewModelFlip = true
+SWEP.ViewModel = "models/weapons/v_rif_an_94.mdl" -- Weapon view model
+SWEP.WorldModel = "models/weapons/w_rif_an_94.mdl" -- Weapon world model
+SWEP.ShowWorldModel = true
+SWEP.Base = "bobs_gun_base"
+SWEP.Spawnable = true
+SWEP.AdminSpawnable = true
+SWEP.FiresUnderwater = false
+
+SWEP.Primary.Sound = Sound("an94.Single") -- Script that calls the primary fire sound
+SWEP.Primary.RPM = 600 -- This is in Rounds Per Minute
+SWEP.Primary.ClipSize = 30 -- Size of a clip
+SWEP.Primary.DefaultClip = 60 -- Bullets you start with
+SWEP.Primary.KickUp = 0.3 -- Maximum up recoil (rise)
+SWEP.Primary.KickDown = 0.1 -- Maximum down recoil (skeet)
+SWEP.Primary.KickHorizontal = 0.3 -- Maximum up recoil (stock)
+SWEP.Primary.Automatic = true -- Automatic = true; Semi Auto = false
+SWEP.Primary.Ammo = "ar2" -- pistol, 357, smg1, ar2, buckshot, slam, SniperPenetratedRound, AirboatGun
+-- Pistol, buckshot, and slam always ricochet. Use AirboatGun for a light metal peircing shotgun pellets
+
+SWEP.SelectiveFire = true
+
+SWEP.Secondary.IronFOV = 55 -- How much you 'zoom' in. Less is more!
+
+SWEP.data = {} --The starting firemode
+SWEP.data.ironsights = 1
+
+SWEP.Primary.NumShots = 1 -- How many bullets to shoot per trigger pull
+SWEP.Primary.Damage = 31 -- Base damage per bullet
+SWEP.Primary.Spread = .015 -- Define from-the-hip accuracy 1 is terrible, .0001 is exact)
+SWEP.Primary.IronAccuracy = .005 -- Ironsight accuracy, should be the same for shotguns
+
+-- Enter iron sight info and bone mod info below
+SWEP.IronSightsPos = Vector(4.552, 0, 3.062)
+SWEP.IronSightsAng = Vector(0.93, -0.5, 0)
+SWEP.SightsPos = Vector(4.552, 0, 3.062)
+SWEP.SightsAng = Vector(0.93, -0.5, 0)
+SWEP.RunSightsPos = Vector(-5.277, -8.584, 2.598)
+SWEP.RunSightsAng = Vector(-12.954, -52.088, 0)
+
+SWEP.Primary.Burst = false
+
+function SWEP:SelectFireMode()
+
+ if self.Primary.Burst then
+ self.Primary.Burst = false
+ self.NextFireSelect = CurTime() + .5
+ if CLIENT then
+ self.Owner:PrintMessage(HUD_PRINTTALK, "Automatic selected.")
+ end
+ self.Weapon:EmitSound("Weapon_AR2.Empty")
+ self.Primary.NumShots = 1
+ self.Primary.Sound = Sound("an94.single")
+ self.Primary.Automatic = true
+ else
+ self.Primary.Burst = true
+ self.NextFireSelect = CurTime() + .5
+ if CLIENT then
+ self.Owner:PrintMessage(HUD_PRINTTALK, "Burst fire selected.")
+ end
+ self.Weapon:EmitSound("Weapon_AR2.Empty")
+ self.Primary.NumShots = 2
+ self.Primary.Sound = Sound("an94.double")
+ self.Primary.Automatic = false
+ end
+end
+
+SWEP.Primary.PrevShots = SWEP.Primary.NumShots
+
+function SWEP:PrimaryAttack()
+ if self:CanPrimaryAttack() and self.Owner:IsPlayer() then
+ self.ShootThese = self.Primary.NumShots
+
+ if self.Primary.Burst then
+ if self.Primary.NumShots > self.Owner:GetActiveWeapon():Clip1() then
+ self.Primary.NumShots = 1
+ self.ShootThese = 1
+ self.Primary.Sound = Sound("an94.single")
+ else
+ self.Primary.NumShots = 2
+ self.ShootThese = 2
+ self.Primary.Sound = Sound("an94.double")
+ end
+ end
+
+
+ if !self.Owner:KeyDown(IN_SPEED) and !self.Owner:KeyDown(IN_RELOAD) then
+ self:ShootBulletInformation()
+ self.Weapon:TakePrimaryAmmo(self.ShootThese)
+
+ if self.Silenced then
+ self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK_SILENCED )
+ self.Weapon:EmitSound(self.Primary.SilencedSound)
+ else
+ self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK )
+ self.Weapon:EmitSound(self.Primary.Sound)
+ end
+
+ local fx = EffectData()
+ fx:SetEntity(self.Weapon)
+ fx:SetOrigin(self.Owner:GetShootPos())
+ fx:SetNormal(self.Owner:GetAimVector())
+ fx:SetAttachment(self.MuzzleAttachment)
+ if GetConVar("M9KGasEffect") != nil then
+ if GetConVar("M9KGasEffect"):GetBool() then
+ util.Effect("m9k_rg_muzzle_rifle",fx)
+ end
+ end
+ self.Owner:SetAnimation( PLAYER_ATTACK1 )
+ self.Owner:MuzzleFlash()
+ self.Weapon:SetNextPrimaryFire(CurTime()+1/(self.Primary.RPM/60))
+ self:CheckWeaponsAndAmmo()
+ self.RicochetCoin = (math.random(1,4))
+ if self.BoltAction then self:BoltBack() end
+ end
+ elseif self:CanPrimaryAttack() and self.Owner:IsNPC() then
+ self:ShootBulletInformation()
+ self.Weapon:TakePrimaryAmmo(self.ShootThese)
+ self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK )
+ self.Weapon:EmitSound(self.Primary.Sound)
+ self.Owner:SetAnimation( PLAYER_ATTACK1 )
+ self.Owner:MuzzleFlash()
+ self.Weapon:SetNextPrimaryFire(CurTime()+1/(self.Primary.RPM/60))
+ self.RicochetCoin = (math.random(1,4))
+ end
+end
+
+if GetConVar("M9KDefaultClip") == nil then
+ print("M9KDefaultClip is missing! You may have hit the lua limit!")
+else
+ if GetConVar("M9KDefaultClip"):GetInt() != -1 then
+ SWEP.Primary.DefaultClip = SWEP.Primary.ClipSize * GetConVar("M9KDefaultClip"):GetInt()
+ end
+end
+
+if GetConVar("M9KUniqueSlots") != nil then
+ if not (GetConVar("M9KUniqueSlots"):GetBool()) then
+ SWEP.SlotPos = 2
+ end
+end \ No newline at end of file