Advertisement
Guest User

popcorn swep

a guest
Jan 27th, 2013
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.93 KB | None | 0 0
  1. -- All code written by -UN?D-HeadShot
  2.  
  3. -- Effect settings
  4. SWEP.PrintName      = "Popcorn" --
  5. SWEP.Slot           = 1                 --
  6. SWEP.SlotPos        = 1                 --
  7. SWEP.DrawAmmo       = false             --
  8. SWEP.DrawCrosshair  = false             --
  9. SWEP.ViewModel      = "models/popcorn.mdl"  --
  10. SWEP.WorldModel     = "models/popcorn.mdl"  --
  11. SWEP.ReloadSound    = "clipin.wav"  --
  12.  
  13. -- Other settings
  14. SWEP.HoldType           = "physgun"
  15. SWEP.Weight             = 1         --
  16. SWEP.AutoSwitchTo       = true      --
  17. SWEP.AutoSwitchFrom     = false     --
  18. SWEP.Spawnable          = true      --
  19. SWEP.AdminSpawnable     = true      --
  20. --SWEP.AutoReload       = true      --
  21.  
  22. -- Weapon info
  23. SWEP.Author         = "Maxsnipez"       --
  24. SWEP.Contact        = "maxwlang@me.com"     --
  25. SWEP.Purpose        = ""    --
  26. SWEP.Instructions   = ""        --
  27.  
  28. -- Primary fire settings
  29. SWEP.Primary.Sound          = ""    --
  30. SWEP.Primary.Damage         = 0         --
  31. SWEP.Primary.NumShots       = 0         --
  32. SWEP.Primary.Recoil         = 0     --
  33. SWEP.Primary.Cone           = 0         --
  34. SWEP.Primary.Delay          = 0     --
  35. SWEP.Primary.ClipSize       = 0     --
  36. SWEP.Primary.DefaultClip    = 0     --
  37. SWEP.Primary.Tracer         = 0         --
  38. SWEP.Primary.Force          = 0         --
  39. SWEP.Primary.TakeAmmoPerBullet = false  --
  40. SWEP.Primary.Automatic      = false     --
  41. SWEP.Primary.Ammo           = ""    --          --
  42.  
  43. -- Secondary fire settings
  44. SWEP.Secondary.Sound        = ""        --
  45. SWEP.Secondary.Damage       = 0         --
  46. SWEP.Secondary.NumShots     = 0         --
  47. SWEP.Secondary.Recoil       = 0         --
  48. SWEP.Secondary.Cone         = 0         --
  49. SWEP.Secondary.Delay        = 0         --
  50. SWEP.Secondary.ClipSize     = 0         --
  51. SWEP.Secondary.DefaultClip  = 0         --
  52. SWEP.Secondary.Tracer       = 0         --
  53. SWEP.Secondary.Force        = 0         --
  54. SWEP.Secondary.TakeAmmoPerBullet = true --
  55. SWEP.Secondary.Automatic    = false     --
  56. SWEP.Secondary.Ammo         = ""        --          --
  57.  
  58. SWEP.Object     = ""    --
  59. SWEP.ObjectExplode      = false         --  
  60. SWEP.ObjectForce        = 2500
  61.  
  62. --
  63. --
  64.  
  65. function SWEP:Initialize()          --
  66.     self:SetWeaponHoldType( self.HoldType )
  67. end
  68.  
  69. function SWEP:PrimaryAttack()       --
  70.     if ( !self:CanPrimaryAttack() ) then return end     --
  71.     self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK )  --
  72.     self.Owner:MuzzleFlash()                            --
  73.     self.Owner:SetAnimation( PLAYER_ATTACK1 )           --
  74.     self.Weapon:EmitSound(Sound(self.Primary.Sound))    --
  75.     self.Owner:ViewPunch(Angle( -self.Primary.Recoil, 0, 0 ))
  76.     if ( SERVER ) then
  77.         object = ents.Create("prop_physics")
  78.         object:SetKeyValue("physdamagescale","500")
  79.         if (self.ObjectExplode) then
  80.             object:SetKeyValue("explodedamage","25")
  81.             object:SetKeyValue("health","500")
  82.             object:SetKeyValue("exploderadius","150")
  83.             object:SetKeyValue("physdamagescale","1500")
  84.             --object:SetColor(255,255,255,255)
  85.         end
  86.         object:SetModel(self.Object)
  87.         object:SetOwner(self.Owner)
  88.         object:SetPos(self.Owner:GetShootPos())
  89.         object:SetAngles(self.Owner:GetAimVector())
  90.         object:Spawn()
  91.         local physobj = object:GetPhysicsObject()
  92.         local force = self.ObjectForce * physobj:GetMass()
  93.         physobj:SetVelocity(self.Owner:GetAimVector() * force)
  94.         undo.Create("Launched prop")
  95.             undo.AddEntity(object)
  96.             undo.SetPlayer(self.Owner)
  97.         undo.Finish()
  98.     end
  99.     self:TakePrimaryAmmo(1)
  100.     self:SetNextPrimaryFire( CurTime() + self.Primary.Delay )   --
  101. end
  102.  
  103. function SWEP:SecondaryAttack()     -- Called when we press secondary fire
  104.     if ( !self:CanSecondaryAttack() ) then return end       --
  105.     self.Weapon:SendWeaponAnim( ACT_VM_SECONDARYATTACK )    --
  106.     self.Owner:MuzzleFlash()                            --
  107.     self.Owner:SetAnimation( PLAYER_ATTACK1 )           --
  108.     self.Weapon:EmitSound(Sound(self.Secondary.Sound))  --
  109.     self.Owner:ViewPunch(Angle( -self.Secondary.Recoil, 0, 0 ))
  110.     if ( SERVER ) then
  111.         object = ents.Create("prop_physics")
  112.         object:SetKeyValue("physdamagescale","500")
  113.         if (self.ObjectExplode) then
  114.             object:SetKeyValue("explodedamage","25")
  115.             object:SetKeyValue("health","500")
  116.             object:SetKeyValue("exploderadius","150")
  117.             object:SetKeyValue("physdamagescale","1500")
  118.             --object:SetColor(255,255,255,255)
  119.         end
  120.         object:SetModel(self.Object)
  121.         object:SetOwner(self.Owner)
  122.         object:SetPos(self.Owner:GetShootPos())
  123.         object:SetAngles(self.Owner:GetAimVector())
  124.         object:Spawn()
  125.         local physobj = object:GetPhysicsObject()
  126.         local force = self.ObjectForce * physobj:GetMass()
  127.         physobj:SetVelocity(self.Owner:GetAimVector() * force)
  128.         undo.Create("Launched prop")
  129.             undo.AddEntity(object)
  130.             undo.SetPlayer(self.Owner)
  131.         undo.Finish()
  132.     end
  133.     self:TakeSecondaryAmmo(1)
  134.     self:SetNextSecondaryFire( CurTime() + self.Secondary.Delay )   --
  135. end
  136.  
  137. function SWEP:Think()               --
  138. end
  139.  
  140. function SWEP:Reload()              --
  141.     if (self.Weapon:DefaultReload()) then return end    --
  142.     self.Weapon:DefaultReload( ACT_VM_RELOAD )      --
  143.     self.Weapon:EmitSound(Sound(self.ReloadSound))  --
  144. end
  145.  
  146. function SWEP:Deploy()              --
  147.     self.Weapon:SendWeaponAnim(ACT_VM_DRAW)
  148.     return true
  149. end
  150.  
  151. function SWEP:Holster()             --
  152.     return true
  153. end
  154.  
  155. function SWEP:OnRemove()            --
  156. end
  157.  
  158. function SWEP:OnRestore()           --
  159. end
  160.  
  161. function SWEP:Precache()            --
  162. end
  163.  
  164. function SWEP:OwnerChanged()        --
  165. end
  166.  
  167. function SWEP:ContextScreenClick( aimvec, mousecode, pressed, ply ) --
  168. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement