Advertisement
Exho

Untitled

Aug 26th, 2014
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.85 KB | None | 0 0
  1. if SERVER then
  2. AddCSLuaFile( "weapon_ttt_briefcase.lua" )
  3. resource.AddFile("materials/vgui/ttt/exho_briefcase.png")
  4. end
  5.  
  6. SWEP.HoldType = "normal"
  7.  
  8. --[[
  9. if CLIENT then
  10. SWEP.PrintName = "Briefcase"
  11. SWEP.Slot = 6
  12.  
  13. SWEP.ViewModelFOV = 10
  14.  
  15. SWEP.EquipMenuData = {
  16. type = "item_weapon",
  17. desc = [[The briefcase can dispense ammo
  18. when used. Similar to a Health Station.
  19. ]]
  20. };
  21.  
  22. SWEP.Icon = "vgui/ttt/exho_briefcase.png"
  23. end
  24. ]]
  25.  
  26. SWEP.Base = "weapon_tttbase"
  27.  
  28. SWEP.ViewModel = "models/weapons/v_crowbar.mdl"
  29. SWEP.WorldModel = "models/weapons/w_suitcase_passenger.mdl"
  30.  
  31. SWEP.DrawCrosshair = false
  32. SWEP.Primary.ClipSize = -1
  33. SWEP.Primary.DefaultClip = -1
  34. SWEP.Primary.Automatic = true
  35. SWEP.Primary.Ammo = "none"
  36. SWEP.Primary.Delay = 1.0
  37.  
  38. SWEP.Secondary.ClipSize = -1
  39. SWEP.Secondary.DefaultClip = -1
  40. SWEP.Secondary.Automatic = true
  41. SWEP.Secondary.Ammo = "none"
  42. SWEP.Secondary.Delay = 1.0
  43.  
  44. --SWEP.Kind = WEAPON_EQUIP
  45. --SWEP.CanBuy = {ROLE_TRAITOR, ROLE_DETECTIVE}
  46. --SWEP.LimitedStock = true
  47.  
  48. SWEP.AllowDrop = false
  49.  
  50. SWEP.NoSights = true
  51.  
  52. function SWEP:OnDrop()
  53. self:Remove()
  54. end
  55.  
  56. function SWEP:PrimaryAttack()
  57. self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
  58. self:HealthDrop()
  59. end
  60. function SWEP:SecondaryAttack()
  61. self.Weapon:SetNextSecondaryFire( CurTime() + self.Secondary.Delay )
  62. self:HealthDrop()
  63. end
  64.  
  65. local throwsound = Sound( "Weapon_SLAM.SatchelThrow" )
  66.  
  67. -- ye olde droppe code
  68. function SWEP:HealthDrop()
  69. if SERVER then
  70. local ply = self.Owner
  71. if not IsValid(ply) then return end
  72.  
  73. if self.Planted then return end
  74.  
  75. local vsrc = ply:GetShootPos()
  76. local vang = ply:GetAimVector()
  77. local vvel = ply:GetVelocity()
  78.  
  79. local vthrow = vvel + vang * 150
  80.  
  81. local case = ents.Create("ttt_briefcase")
  82. if IsValid(case) then
  83. case:SetPos(vsrc + vang * 10)
  84. case:Spawn()
  85. case:SetPlacer(ply)
  86.  
  87. case:PhysWake()
  88. local phys = case:GetPhysicsObject()
  89. if IsValid(phys) then
  90. phys:SetVelocity(vthrow)
  91. end
  92. self:Remove()
  93.  
  94. self.Planted = true
  95. end
  96. end
  97.  
  98. self.Weapon:EmitSound(throwsound)
  99. end
  100.  
  101.  
  102. function SWEP:Reload()
  103. return false
  104. end
  105.  
  106. function SWEP:OnRemove()
  107. if CLIENT and IsValid(self.Owner) and self.Owner == LocalPlayer() and self.Owner:Alive() then
  108. RunConsoleCommand("lastinv")
  109. end
  110. end
  111. --[[
  112. if CLIENT then
  113. function SWEP:Initialize()
  114. self:AddHUDHelp(
  115. "Click to drop the briefcase.",
  116. false
  117. )
  118. end
  119. end
  120. ]]
  121.  
  122. function SWEP:Deploy()
  123. if SERVER and IsValid(self.Owner) then
  124. self.Owner:DrawViewModel(false)
  125. end
  126. return true
  127. end
  128.  
  129. function SWEP:DrawWorldModel()
  130. end
  131.  
  132. function SWEP:DrawWorldModelTranslucent()
  133. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement