Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Variables that are used on both client and server
- SWEP.Instructions = "Uses 5.56mm ammo, Alternate Mode: E + Right Click, Switch Weapons: E + Left Click"
- SWEP.Base = "weapon_fas_sim_base"
- SWEP.HoldType = "smg"
- SWEP.ViewModelFlip = false
- SWEP.ViewModel = "models/weapons/a_sg550.mdl"
- SWEP.WorldModel = "models/weapons/b_sg550.mdl"
- SWEP.Spawnable = false
- SWEP.AdminSpawnable = false
- SWEP.Primary.Sound = Sound("Weapof_sg550.Shoot")
- SWEP.Primary.Recoil = 1.5
- SWEP.Primary.Damage = 23.5
- SWEP.Primary.NumShots = 1
- SWEP.Primary.Cone = 0.009
- SWEP.Primary.Delay = 0.085714285714285714285714285714286
- SWEP.Primary.ClipSize = 30 // Size of a clip
- SWEP.Primary.DefaultClip = 0 // Default number of bullets in a clip
- SWEP.Primary.Automatic = true // Automatic/Semi Auto
- SWEP.Primary.Ammo = "AirboatGun"
- SWEP.Secondary.ClipSize = -1 // Size of a clip
- SWEP.Secondary.DefaultClip = -1 // Default number of bullets in a clip
- SWEP.Secondary.Automatic = false // Automatic/Semi Auto
- SWEP.Secondary.Ammo = "none"
- SWEP.ShellEffect = "sim_shelleject_fas_556" // "effect_mad_shell_pistol" or "effect_mad_shell_rifle" or "effect_mad_shell_shotgun"
- SWEP.ShellDelay = 0.02
- SWEP.IronSightsPos = Vector (-3.7426, -5.0006, 1.4002)
- SWEP.IronSightsAng = Vector (0.8852, -0.0393, 0)
- SWEP.RunArmOffset = Vector (4.0928, 0.4246, 2.3712)
- SWEP.RunArmAngle = Vector (-18.4406, 33.1846, 0)
- SWEP.Pistol = false
- SWEP.Rifle = true
- SWEP.Shotgun = false
- SWEP.Sniper = false
- SWEP.Type = 1 // 1 = Automatic/Semi-Automatic mode, 2 = Suppressor mode, 3 = Burst fire mode
- SWEP.Mode = true
- SWEP.data = {}
- SWEP.data.NormalMsg = "Switched to automatic."
- SWEP.data.ModeMsg = "Switched to semi-automatic."
- /*---------------------------------------------------------
- Name: SWEP:Precache()
- Desc: Use this function to precache stuff.
- ---------------------------------------------------------*/
- function SWEP:Precache()
- util.PrecacheSound("weapons/ar_sg550/sg550_fire1.wav")
- util.PrecacheSound("weapons/ar_sg550/sg550_fire2.wav")
- util.PrecacheSound("weapons/ar_sg550/sg550_fire3.wav")
- util.PrecacheSound("weapons/ar_sg550/sg550_fire4.wav")
- util.PrecacheSound("weapons/ar_sg550/sg550_fire5.wav")
- util.PrecacheSound("weapons/ar_sg550/sg550_magin.wav")
- util.PrecacheSound("weapons/ar_sg550/sg550_magout.wav")
- util.PrecacheSound("weapons/ar_sg550/sg550_boltpull.wav")
- end
- /*---------------------------------------------------------
- Name: SWEP:ShootAnimation()
- ---------------------------------------------------------*/
- function SWEP:ShootAnimation()
- self.Weapon:SendWeaponAnim(ACT_VM_IDLE)
- local Animation = self.Owner:GetViewModel()
- self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
- end
- /*---------------------------------------------------------
- Name: SWEP:Think()
- Desc: Called every frame.
- ---------------------------------------------------------*/
- function SWEP:Think()
- self:SecondThink()
- if self.Weapon:Clip1() > 0 and self.IdleDelay < CurTime() and self.IdleApply then
- local WeaponModel = self.Weapon:GetOwner():GetActiveWeapon():GetClass()
- if self.Owner and self.Weapon:GetOwner():GetActiveWeapon():GetClass() == WeaponModel and self.Owner:Alive() then
- if (self.Weapon:Clip1() == 0) then
- self.Weapon:SendWeaponAnim(ACT_VM_IDLE)
- else
- self.Weapon:SendWeaponAnim(ACT_VM_IDLE)
- end
- if self.AllowPlaybackRate and not self.Weapon:GetDTBool(1) then
- self.Owner:GetViewModel():SetPlaybackRate(1)
- else
- self.Owner:GetViewModel():SetPlaybackRate(0)
- end
- end
- self.IdleApply = false
- elseif self.Weapon:Clip1() == 0 then
- self.IdleApply = false
- end
- if self.Weapon:GetDTBool(1) and self.Owner:KeyDown(IN_SPEED) then
- self:SetIronsights(false)
- end
- // If you're running or if your weapon is holsted, the third person animation is going to change
- if self.Owner:KeyDown(IN_SPEED) or self.Weapon:GetDTBool(0) then
- if self.Rifle or self.Sniper or self.Shotgun then
- if self.Owner:KeyDown(IN_DUCK) then
- self:SetWeaponHoldType("normal")
- else
- self:SetWeaponHoldType("passive")
- end
- elseif self.Pistol then
- self:SetWeaponHoldType("normal")
- end
- else
- self:SetWeaponHoldType(self.HoldType)
- end
- if self.Owner:KeyDown(IN_SPEED) or self.Weapon:GetDTBool(0) then return end
- if (self.Owner:KeyDown(IN_USE)) then
- self:SetWeaponHoldType("fist")
- else
- self:SetWeaponHoldType(self.HoldType)
- end
- end
- /*---------------------------------------------------------
- Name: SWEP:Reload()
- Desc: Reload is being pressed.
- ---------------------------------------------------------*/
- function SWEP:Reload()
- if (self.Owner:KeyDown(IN_USE)) then
- if self.Weapon:GetDTBool(0) or self.Owner:KeyDown(IN_SPEED) then return end
- self.Weapon:SetNextPrimaryFire(CurTime() + 3)
- self.Weapon:SetNextSecondaryFire(CurTime() + 3)
- if (SERVER) then
- local knife = ents.Create("sim_fas_sg550")
- knife:SetAngles(self.Owner:EyeAngles())
- // if (self:GetIronsights() == false) then
- local pos = self.Owner:GetShootPos()
- pos = pos + self.Owner:GetForward() * 5
- pos = pos + self.Owner:GetRight() * 9
- pos = pos + self.Owner:GetUp() * -5
- knife:SetPos(pos)
- // else
- // knife:SetPos (self.Owner:EyePos() + (self.Owner:GetAimVector()))
- // end
- knife:Spawn()
- knife:Activate()
- local phys = knife:GetPhysicsObject()
- phys:SetVelocity(self.Owner:GetAimVector() * 100)
- phys:AddAngleVelocity(Vector(0, 0, 0))
- self.Owner:StripWeapon("weapon_fas_sg550")
- if (SERVER) then
- RunConsoleCommand("lastinv")
- end
- end
- else
- // When the weapon is already doing an animation, just return end because we don't want to interrupt it
- if (self.ActionDelay > CurTime()) or self.Owner:KeyDown(IN_SPEED) or self.Weapon:GetDTBool(0) then return end
- if (SERVER) then
- if ( self.Reloadaftershoot > CurTime() ) then return end
- end
- // Need to call the default reload before the real reload animation
- self.Weapon:DefaultReload(ACT_VM_RELOAD)
- if (self.Weapon:Clip1() < self.Primary.ClipSize) and (self.Owner:GetAmmoCount(self.Primary.Ammo) > 0) then
- self:SetIronsights(false)
- self:ReloadAnimation()
- end
- end
- end
- /*---------------------------------------------------------
- Name: SWEP:SetHolsted()
- ---------------------------------------------------------*/
- function SWEP:SetHolsted(b)
- if (self.Owner) then
- if (b) then
- self.Weapon:SendWeaponAnim(ACT_VM_IDLE)
- local Animation = self.Owner:GetViewModel()
- Animation:SetSequence(Animation:LookupSequence("holster"))
- else
- self.Weapon:SendWeaponAnim(ACT_VM_DRAW)
- end
- end
- if (self.Weapon) then
- self.Weapon:SetDTBool(0, b)
- end
- end
- /*---------------------------------------------------------
- Name: SWEP:DeployAnimation()
- ---------------------------------------------------------*/
- function SWEP:DeployAnimation()
- self.Weapon:SendWeaponAnim(ACT_VM_IDLE)
- local Animation = self.Owner:GetViewModel()
- self.Weapon:SendWeaponAnim(ACT_VM_DRAW)
- end
Add Comment
Please, Sign In to add comment