Advertisement
Guest User

Untitled

a guest
Mar 3rd, 2015
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.18 KB | None | 0 0
  1. SWEP.PrintName = "Silenced Chair Gun"
  2. SWEP.Author = "Philip"
  3. SWEP.Instructions = "Left click to fire a chair!"
  4.  
  5. SWEP.Spawnable = true
  6. SWEP.AdminOnly = true
  7.  
  8. SWEP.Primary.ClipSize = -1
  9. SWEP.Primary.DefaultClip = -1
  10. SWEP.Primary.Automatic = true
  11. SWEP.Primary.Ammo = "none"
  12.  
  13. SWEP.Secondary.ClipSize = -1
  14. SWEP.Secondary.DefaultClip = -1
  15. SWEP.Secondary.Automatic = true
  16. SWEP.Secondary.Ammo = false
  17.  
  18. SWEP.Weight = 5
  19. SWEP.AutoSwitchTo = false
  20. SWEP.AutoSwitchFrom = false
  21.  
  22. SWEP.Slot = 3
  23. SWEP.SlotPos = 4
  24. SWEP.DrawAmmo = false
  25. SWEP.DrawCrosshair = true
  26.  
  27. SWEP.ViewModel = "models/weapons/v_357.mdl"
  28. SWEP.WorldModel = "models/weapons/w_357.mdl"
  29.  
  30. local ShootSound = Sound("Metal.SawbladeStick")
  31.  
  32. -- This will fire a chair automatically with the left click.
  33. -- OP fire rate at 0.1 seconds.
  34. function SWEP:PrimaryAttack()
  35.  
  36. self.Weapon:SetNextPrimaryFire( CurTime() + 0.1 )
  37.  
  38. self:ThrowChair( "models/pokeball/pokeball.mdl" )
  39.  
  40. end
  41.  
  42. -- This will fire a different chair with right click and goes as fast as you can click.
  43. function SWEP:SecondaryAttack()
  44.  
  45. self:ThrowChair( "models/pokeball/pokeball.mdl" )
  46.  
  47. end
  48.  
  49. --This plays the shoot sound when we shoot the gun.
  50. --And some other shit idk about -Refer to site from Johnson-
  51. function SWEP:ThrowChair( model_file )
  52.  
  53. self:EmitSound( ShootSound )
  54.  
  55. if (CLIENT) then return end
  56.  
  57. local ent = ent.Creat( "prop_physics" )
  58.  
  59. if ( !IsValid( ent )) then return end
  60.  
  61. ent:SetModel( model_file )
  62.  
  63. ent:SetPos( self.Owner:EyePos() + (self.Owner:GetAimVector() * 16))
  64. ent:SetAngles( self.Owner:EyeAngles() )
  65. ent:Spawn()
  66.  
  67. local phys = ent:GetPhysicsObject()
  68. if ( !IsValid( phys )) then ent:Remove() return end
  69.  
  70. --Throwing of the chair is set here!
  71. local velocity = self.Owner:GetAimVector()
  72. velocity = velocity * 500
  73. velocity = velocity + (VectorRand() * 10)
  74. phys:ApplyForceCent( velocity )
  75.  
  76. --Cleanup and undo
  77. cleanup.Add( self.Owner, "props", ent)
  78.  
  79. undo.Create( "Thrown_Chair" )
  80. undo.AddEntity( ent )
  81. undo.SetPlayer( self.Owner )
  82. undo.Finish()
  83.  
  84. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement