Advertisement
Guest User

Untitled

a guest
Sep 20th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.80 KB | None | 0 0
  1. if SERVER then
  2.    AddCSLuaFile( "shared.lua" )
  3.    resource.AddFile("models/weapons/v_healthkit.mdl")
  4.    resource.AddFile("materials/vgui/ttt/icon_gp_hpkit.vmt")
  5. end
  6.  
  7. SWEP.HoldType = "slam"
  8.  
  9. if CLIENT then
  10.  
  11.    SWEP.PrintName = "Portable Healthkit"           
  12.    SWEP.Slot = 7
  13.    
  14.    
  15.    SWEP.EquipMenuData = {
  16.       type = "Buff",
  17.       desc = "Left click to heal for a swanky 25 HP!"
  18.    };
  19.  
  20.    SWEP.Icon = "VGUI/ttt/icon_gp_hpkit"
  21. end
  22.  
  23. SWEP.Base = "weapon_tttbase"
  24. SWEP.Kind = WEAPON_EQUIP2
  25. SWEP.WeaponID = AMMO_HPKIT
  26. SWEP.CanBuy = {ROLE_TRAITOR, ROLE_DETECTIVE, ROLE_INNOCENT} -- only traitors can buy
  27. SWEP.LimitedStock = false -- only buyable once
  28. SWEP.AutoSpawnable = false
  29. SWEP.AllowDrop = true
  30. SWEP.NoSights = true
  31.  
  32. SWEP.ViewModel      = "models/weapons/v_healthkit.mdl"
  33. SWEP.WorldModel     = "models/Items/HealthKit.mdl"
  34.  
  35. SWEP.Primary.Recoil         = 0
  36. SWEP.Primary.Damage         = 0
  37. SWEP.Primary.NumShots       = 1
  38. SWEP.Primary.Cone           = 0
  39. SWEP.Primary.ClipSize       = -1
  40. SWEP.Primary.Delay          = 0
  41. SWEP.Primary.DefaultClip    = -1
  42. SWEP.Primary.Automatic      = true
  43. SWEP.Primary.Ammo           = "none"
  44.  
  45. SWEP.Secondary.NumShots     = 1
  46. SWEP.Secondary.ClipSize     = -1
  47. SWEP.Secondary.DefaultClip  = -1
  48. SWEP.Secondary.Automatic    = true
  49. SWEP.Secondary.Ammo         = "none"
  50.  
  51. local ShootSound = Sound ("items/smallmedkit1.wav")
  52.  
  53. function SWEP:OnRemove()
  54.    if CLIENT and ValidEntity(self.Owner) and self.Owner == LocalPlayer() and self.Owner:Alive() then
  55.       RunConsoleCommand("lastinv")
  56.    end
  57. end
  58.  
  59. function SWEP:PrimaryAttack()  
  60.     if not self.Weapon:GetOwner():Health() < self.Weapon:GetOwner():GetMaxHealth() then
  61.    
  62.         self.Weapon:EmitSound( ShootSound, 60, 100 )
  63.         self.Weapon:GetOwner():SetHealth( self.Weapon:GetOwner():Health() + 25 )
  64.        
  65.    
  66.        
  67.         if SERVER then
  68.             self.Owner:StripWeapon("weapon_ttt_healthkit")
  69.         end
  70.        
  71.     end
  72. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement