Advertisement
MiniPickels

ForceAwakens Stun Baton Script

Jan 23rd, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.05 KB | None | 0 0
  1. //General Settings \\
  2. SWEP.AdminSpawnable = true
  3. SWEP.ViewModelFOV = 64
  4. SWEP.ViewModel = "models/weapons/star wars the force awakens/spartanmark6/riot_control_stunbaton.mdl"
  5. SWEP.WorldModel = "models/weapons/star wars the force awakens/spartanmark6/riot_control_stunbaton.mdl"
  6. SWEP.AutoSwitchTo = false
  7. SWEP.Slot = 1
  8. SWEP.HoldType = "Pistol"
  9. SWEP.PrintName = "ForceAwakens StunBaton"
  10. SWEP.Author = "Mini Pickels"
  11. SWEP.Spawnable = false
  12. SWEP.AutoSwitchFrom = false
  13. SWEP.FiresUnderwater = false
  14. SWEP.Weight = 5
  15. SWEP.DrawCrosshair = true
  16. SWEP.Category = "stunbaton"
  17. SWEP.SlotPos = 0
  18. SWEP.DrawAmmo = true
  19. SWEP.ReloadSound = "Weapon_Pistol.Reload"
  20. SWEP.Instructions = "Stun bad people"
  21. SWEP.Contact = "cocopickersgt@gmail.com"
  22. SWEP.Purpose = "stunbaton"
  23. SWEP.base = "weapon_base"
  24. //General settings\\
  25.  
  26. //PrimaryFire Settings\\
  27. SWEP.Primary.Sound = "Weapon_StunStick.Swing"
  28. SWEP.Primary.Damage = 0
  29. SWEP.Primary.TakeAmmo = 0
  30. SWEP.Primary.ClipSize = 0
  31. SWEP.Primary.Ammo = "stunstick"
  32. SWEP.Primary.DefaultClip = 32
  33. SWEP.Primary.Spread = 0.1
  34. SWEP.Primary.NumberofShots = 1
  35. SWEP.Primary.Automatic = true
  36. SWEP.Primary.Recoil = 1
  37. SWEP.Primary.Delay = 0.1
  38. SWEP.Primary.Force = 10
  39. //PrimaryFire settings\\
  40.  
  41. //SecondaryProp Settings\\
  42. SWEP.Secondary.NumberofShots = 0
  43. SWEP.Secondary.Force = 30
  44. SWEP.Secondary.Spread = 0
  45. SWEP.Secondary.Sound = "Weapon_StunStick.Swing"
  46. SWEP.Secondary.DefaultClip = 0
  47. SWEP.Secondary.Automatic = false
  48. SWEP.Secondary.AngVelocity = Angle(0,0,0)
  49. SWEP.Secondary.Ammo = "stunstick" l
  50. SWEP.Secondary.Model = "models/props_c17/FurnitureChair001a.mdl"
  51. SWEP.Secondary.Recoil = 3
  52. SWEP.Secondary.Delay = 0
  53. SWEP.Secondary.TakeAmmo = 0
  54. SWEP.Secondary.ClipSize = 0
  55. SWEP.Secondary.Damage = 0
  56. //SecondaryProp Settings \\
  57.  
  58.  
  59.  
  60.  
  61. //SWEP:Initialize()\\
  62. function SWEP:Initialize()
  63. util.PrecacheSound(self.Primary.Sound)
  64. util.PrecacheSound(self.Secondary.Sound)
  65. if ( SERVER ) then
  66. self:SetWeaponHoldType( self.HoldType )
  67. end
  68. end
  69. //SWEP:Initialize()\\
  70.  
  71. //SWEP:PrimaryFire()\\
  72. function SWEP:PrimaryAttack()
  73. if ( !self:CanPrimaryAttack() ) then return end
  74. local bullet = {}
  75. bullet.Num = self.Primary.NumberofShots
  76. bullet.Src = self.Owner:GetShootPos()
  77. bullet.Dir = self.Owner:GetAimVector()
  78. bullet.Spread = Vector( self.Primary.Spread * 0.1 , self.Primary.Spread * 0.1, 0)
  79. bullet.Tracer = 0
  80. bullet.Force = self.Primary.Force
  81. bullet.Damage = self.Primary.Damage
  82. bullet.AmmoType = self.Primary.Ammo
  83. local rnda = self.Primary.Recoil * -1
  84. local rndb = self.Primary.Recoil * math.random(-1, 1)
  85. self:ShootEffects()
  86. self.Owner:FireBullets( bullet )
  87. self.Weapon:EmitSound(Sound(self.Primary.Sound))
  88. self.Owner:ViewPunch( Angle( rnda,rndb,rnda ) )
  89. self:TakePrimaryAmmo(self.Primary.TakeAmmo)
  90. self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
  91. self.Weapon:SetNextSecondaryFire( CurTime() + self.Primary.Delay )
  92. end
  93. //SWEP:PrimaryFire()\\
  94.  
  95. //SWEP:SecondaryFire()\\
  96. function SWEP:SecondaryAttack()
  97. self:TakePrimaryAmmo(self.Secondary.TakeAmmo)
  98. self:Throw_Attack (self.Secondary.Model, self.Primary.Sound, self.Secondary.AngVelocity)
  99. self.Weapon:SetNextPrimaryFire( CurTime() + self.Secondary.Delay )
  100. self.Weapon:SetNextSecondaryFire( CurTime() + self.Secondary.Delay )
  101. end
  102. //SWEP:SecondaryFire()\\
  103.  
  104. //SWEP:Throw_Attack(Model, Sound, Angle)\\
  105. function SWEP:Throw_Attack (Model, Sound, Angle)
  106. local tr = self.Owner:GetEyeTrace()
  107. self.Weapon:EmitSound (Sound)
  108. self.BaseClass.ShootEffects (self)
  109. if (!SERVER) then return end
  110. local ent = ents.Create ("prop_physics")
  111. ent:SetModel (Model)
  112. ent:SetPos (self.Owner:EyePos() + (self.Owner:GetAimVector() * 16))
  113. ent:SetAngles (self.Owner:EyeAngles())
  114. ent:Spawn()
  115. local phys = ent:GetPhysicsObject()
  116. local shot_length = tr.HitPos:Length()
  117. phys:ApplyForceCenter (self.Owner:GetAimVector():GetNormalized() * math.pow (shot_length, 7))
  118. phys:AddAngleVelocity(Angle)
  119. cleanup.Add (self.Owner, "props", ent)
  120. undo.Create ("Thrown model")
  121. undo.AddEntity (ent)
  122. undo.SetPlayer (self.Owner)
  123. undo.Finish()
  124. end
  125. //Throw_Attack(Model, Sound, Angle)\\
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement