Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //General Settings \\
- SWEP.AdminSpawnable = true
- SWEP.ViewModelFOV = 64
- SWEP.ViewModel = "models/weapons/star wars the force awakens/spartanmark6/riot_control_stunbaton.mdl"
- SWEP.WorldModel = "models/weapons/star wars the force awakens/spartanmark6/riot_control_stunbaton.mdl"
- SWEP.AutoSwitchTo = false
- SWEP.Slot = 1
- SWEP.HoldType = "Pistol"
- SWEP.PrintName = "ForceAwakens StunBaton"
- SWEP.Author = "Mini Pickels"
- SWEP.Spawnable = false
- SWEP.AutoSwitchFrom = false
- SWEP.FiresUnderwater = false
- SWEP.Weight = 5
- SWEP.DrawCrosshair = true
- SWEP.Category = "stunbaton"
- SWEP.SlotPos = 0
- SWEP.DrawAmmo = true
- SWEP.ReloadSound = "Weapon_Pistol.Reload"
- SWEP.Instructions = "Stun bad people"
- SWEP.Contact = "cocopickersgt@gmail.com"
- SWEP.Purpose = "stunbaton"
- SWEP.base = "weapon_base"
- //General settings\\
- //PrimaryFire Settings\\
- SWEP.Primary.Sound = "Weapon_StunStick.Swing"
- SWEP.Primary.Damage = 0
- SWEP.Primary.TakeAmmo = 0
- SWEP.Primary.ClipSize = 0
- SWEP.Primary.Ammo = "stunstick"
- SWEP.Primary.DefaultClip = 32
- SWEP.Primary.Spread = 0.1
- SWEP.Primary.NumberofShots = 1
- SWEP.Primary.Automatic = true
- SWEP.Primary.Recoil = 1
- SWEP.Primary.Delay = 0.1
- SWEP.Primary.Force = 10
- //PrimaryFire settings\\
- //SecondaryProp Settings\\
- SWEP.Secondary.NumberofShots = 0
- SWEP.Secondary.Force = 30
- SWEP.Secondary.Spread = 0
- SWEP.Secondary.Sound = "Weapon_StunStick.Swing"
- SWEP.Secondary.DefaultClip = 0
- SWEP.Secondary.Automatic = false
- SWEP.Secondary.AngVelocity = Angle(0,0,0)
- SWEP.Secondary.Ammo = "stunstick" l
- SWEP.Secondary.Model = "models/props_c17/FurnitureChair001a.mdl"
- SWEP.Secondary.Recoil = 3
- SWEP.Secondary.Delay = 0
- SWEP.Secondary.TakeAmmo = 0
- SWEP.Secondary.ClipSize = 0
- SWEP.Secondary.Damage = 0
- //SecondaryProp Settings \\
- //SWEP:Initialize()\\
- function SWEP:Initialize()
- util.PrecacheSound(self.Primary.Sound)
- util.PrecacheSound(self.Secondary.Sound)
- if ( SERVER ) then
- self:SetWeaponHoldType( self.HoldType )
- end
- end
- //SWEP:Initialize()\\
- //SWEP:PrimaryFire()\\
- function SWEP:PrimaryAttack()
- if ( !self:CanPrimaryAttack() ) then return end
- local bullet = {}
- bullet.Num = self.Primary.NumberofShots
- bullet.Src = self.Owner:GetShootPos()
- bullet.Dir = self.Owner:GetAimVector()
- bullet.Spread = Vector( self.Primary.Spread * 0.1 , self.Primary.Spread * 0.1, 0)
- bullet.Tracer = 0
- bullet.Force = self.Primary.Force
- bullet.Damage = self.Primary.Damage
- bullet.AmmoType = self.Primary.Ammo
- local rnda = self.Primary.Recoil * -1
- local rndb = self.Primary.Recoil * math.random(-1, 1)
- self:ShootEffects()
- self.Owner:FireBullets( bullet )
- self.Weapon:EmitSound(Sound(self.Primary.Sound))
- self.Owner:ViewPunch( Angle( rnda,rndb,rnda ) )
- self:TakePrimaryAmmo(self.Primary.TakeAmmo)
- self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
- self.Weapon:SetNextSecondaryFire( CurTime() + self.Primary.Delay )
- end
- //SWEP:PrimaryFire()\\
- //SWEP:SecondaryFire()\\
- function SWEP:SecondaryAttack()
- self:TakePrimaryAmmo(self.Secondary.TakeAmmo)
- self:Throw_Attack (self.Secondary.Model, self.Primary.Sound, self.Secondary.AngVelocity)
- self.Weapon:SetNextPrimaryFire( CurTime() + self.Secondary.Delay )
- self.Weapon:SetNextSecondaryFire( CurTime() + self.Secondary.Delay )
- end
- //SWEP:SecondaryFire()\\
- //SWEP:Throw_Attack(Model, Sound, Angle)\\
- function SWEP:Throw_Attack (Model, Sound, Angle)
- local tr = self.Owner:GetEyeTrace()
- self.Weapon:EmitSound (Sound)
- self.BaseClass.ShootEffects (self)
- if (!SERVER) then return end
- local ent = ents.Create ("prop_physics")
- ent:SetModel (Model)
- ent:SetPos (self.Owner:EyePos() + (self.Owner:GetAimVector() * 16))
- ent:SetAngles (self.Owner:EyeAngles())
- ent:Spawn()
- local phys = ent:GetPhysicsObject()
- local shot_length = tr.HitPos:Length()
- phys:ApplyForceCenter (self.Owner:GetAimVector():GetNormalized() * math.pow (shot_length, 7))
- phys:AddAngleVelocity(Angle)
- cleanup.Add (self.Owner, "props", ent)
- undo.Create ("Thrown model")
- undo.AddEntity (ent)
- undo.SetPlayer (self.Owner)
- undo.Finish()
- end
- //Throw_Attack(Model, Sound, Angle)\\
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement