Advertisement
Guest User

Untitled

a guest
Jun 12th, 2013
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.37 KB | None | 0 0
  1. -- PopCorn XD)
  2.  
  3. SWEP.ViewModel = "models/Teh_Maestro/popcorn.mdl"
  4. SWEP.WorldModel = "models/Teh_Maestro/popcorn.mdl"
  5. SWEP.Spawnable = true
  6. SWEP.AdminSpawnable = false
  7.  
  8. SWEP.Primary.Clipsize = -1
  9. SWEP.Primary.DefaultClip = -1
  10. SWEP.Primary.Automatic = false
  11. SWEP.Primary.Ammo = "none"
  12.  
  13. SWEP.Secondary.Clipsize = -1
  14. SWEP.Secondary.DefaultClip = -1
  15. SWEP.Secondary.Automatic = false
  16. SWEP.Secondary.Ammo = "none"
  17.  
  18. SWEP.Slot = 1
  19. SWEP.SlotPos = 1
  20.  
  21. SWEP.HoldType = "shotgun"
  22.  
  23. function SWEP:Think()
  24. end
  25.  
  26. function SWEP:Initialize()
  27. util.PrecacheSound("crisps/eat.wav")
  28. end
  29.  
  30. function SWEP:PrimaryAttack()
  31.  
  32. self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER )
  33. self.Owner:EmitSound("crisps/eat.wav")
  34.  
  35. local tr = {}
  36. tr.start = self.Owner:GetShootPos()
  37. tr.endpos = self.Owner:GetShootPos() + ( self.Owner:GetAimVector() * 50 )
  38. tr.filter = self.Owner
  39. tr.mask = MASK_SHOT
  40. local trace = util.TraceLine( tr )
  41.  
  42. self.Weapon:SetNextPrimaryFire(CurTime() + 6.5)
  43.  
  44. if ( trace.Hit ) then
  45.  
  46. if trace.Entity:IsPlayer() or string.find(trace.Entity:GetClass(),"npc") or string.find(trace.Entity:GetClass(),"prop_ragdoll") then
  47. bullet = {}
  48. bullet.Num = 1
  49. bullet.Src = self.Owner:GetShootPos()
  50. bullet.Dir = self.Owner:GetAimVector()
  51. bullet.Spread = Vector(0, 0, 0)
  52. bullet.Tracer = 0
  53. bullet.Force = 1
  54. bullet.Damage = 0
  55. else
  56. bullet = {}
  57. bullet.Num = 1
  58. bullet.Src = self.Owner:GetShootPos()
  59. bullet.Dir = self.Owner:GetAimVector()
  60. bullet.Spread = Vector(0, 0, 0)
  61. bullet.Tracer = 0
  62. bullet.Force = 1
  63. bullet.Damage = 0
  64. end
  65.  
  66. end
  67. end
  68.  
  69. function SWEP:SecondaryAttack()
  70. local match, heat, att, phys, tr, particle
  71.  
  72. self.Owner:AnimRestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_GMOD_GESTURE_ITEM_PLACE )
  73. self.Weapon:SetNextSecondaryFire(CurTime() + 16)
  74.  
  75. if CLIENT then
  76. return
  77. end
  78.  
  79. self.Owner:EmitSound( "weapons/slam/throw.wav" )
  80.  
  81. self.Hand = self.Hand or self.Owner:LookupAttachment( "anim_attachment_lh" )
  82.  
  83. match = ents.Create( "prop_physics" )
  84. match:SetModel( "models/Teh_Maestro/popcorn.mdl" )
  85. match:SetOwner( self.Owner )
  86. match:SetSolid( SOLID_NONE )
  87.  
  88. if self.Hand == -1 then
  89. att = self.Owner:GetAttachment( self.Hand )
  90. match:SetPos( att.Pos )
  91. else
  92. match:SetPos( self.Owner:GetShootPos( ) )
  93. end
  94.  
  95. match:Spawn( )
  96.  
  97. heat = ents.Create( "env_firesource" )
  98. heat:SetPos( match:GetPos( ) )
  99. heat:SetParent( match )
  100.  
  101.  
  102. heat:Spawn( )
  103. heat:Input( "Enable" )
  104.  
  105. phys = match:GetPhysicsObject( )
  106.  
  107. tr = util.TraceLine{
  108. start = self.Owner:GetShootPos( ),
  109. endpos = self.Owner:GetShootPos( ) + self.Owner:GetAimVector( ) * 512,
  110. filter = { match, heat, self.Owner, particle },
  111. }
  112.  
  113. self.Owner:StripWeapon("weapon_popcorn")
  114.  
  115. SafeRemoveEntityDelayed( match, 6 )
  116.  
  117. particle = ents.Create( "info_particle_system" )
  118. particle:SetKeyValue( "start_active", 1 )
  119. particle:SetKeyValue( "effect_name", "fire_verysmall_01" )
  120. particle:Spawn( )
  121.  
  122. particle:SetPos( match:GetPos( ) )
  123. particle:SetParent( match )
  124. particle:Activate( )
  125.  
  126. if IsValid( phys ) then
  127. phys:SetVelocity( ( tr.HitPos - match:GetPos( ) ):GetNormal( ) * 128 * phys:GetMass( ) )
  128. end
  129.  
  130. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement