Advertisement
Guest User

Untitled

a guest
Apr 11th, 2011
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.88 KB | None | 0 0
  1. if ( SERVER ) then
  2. AddCSLuaFile( "shared.lua" )
  3. resource.AddFile("materials/jaanus/brass.vmt")
  4. resource.AddFile("materials/jaanus/shuriken.vmt")
  5. resource.AddFile("materials/shuriken/deathicon.vmt")
  6. resource.AddFile("materials/vgui/entities/weapon_shuriken.vmt")
  7. resource.AddFile("materials/vgui/ttt/icon_cg_shuriken.vmt")
  8. resource.AddFile("models/jaanus/shuriken_big.mdl")
  9. resource.AddFile("models/jaanus/shuriken_huge.mdl")
  10. resource.AddFile("models/jaanus/shuriken_medium.mdl")
  11. resource.AddFile("models/jaanus/shuriken_small.mdl")
  12. resource.AddFile("models/jaanus/v_shuriken.mdl")
  13. resource.AddFile("models/jaanus/w_shuriken.mdl")
  14. resource.AddFile("sound/weapons/shuriken/hit1.wav")
  15. resource.AddFile("sound/weapons/shuriken/hit2.wav")
  16. resource.AddFile("sound/weapons/shuriken/hit3.wav")
  17. resource.AddFile("sound/weapons/shuriken/throw1.wav")
  18. resource.AddFile("sound/weapons/shuriken/throw2.wav")
  19. resource.AddFile("sound/weapons/shuriken/throw3.wav")
  20. resource.AddFile("sound/weapons/shuriken/throw4.wav")
  21. end
  22.  
  23. SWEP.HoldType = "knife"
  24.  
  25. if ( CLIENT ) then
  26. SWEP.PrintName = "Shuriken"
  27. SWEP.Author = "Jaanus/Ported to TTT by ReignofTerr0r"
  28. SWEP.Slot = 6
  29. SWEP.ViewModelFOV = 86
  30. SWEP.ViewModelFlip = false
  31. end
  32.  
  33. SWEP.Base = "weapon_tttbase"
  34. SWEP.HeadshotMultiplier = 10
  35.  
  36. ------------General Swep Info---------------
  37. SWEP.Author = "Jaanus/Ported to TTT by ReignofTerr0r"
  38. SWEP.Contact = "Jaanus@jaanus.cc"
  39. SWEP.Purpose = "Kill stuff - Ninja style."
  40. SWEP.Instructions = "Left click throws a shuriken."
  41. SWEP.Spawnable = true
  42. SWEP.AdminSpawnable = true
  43. -----------------------------------------------
  44.  
  45. ------------Models---------------------------
  46. SWEP.ViewModel = Model("models/jaanus/v_shuriken.mdl")
  47. SWEP.WorldModel = Model("models/jaanus/w_shuriken.mdl")
  48. -----------------------------------------------
  49.  
  50. -- TTT OPS
  51. SWEP.Kind = WEAPON_EQUIP
  52. SWEP.Icon = "VGUI/ttt/icon_cg_shuriken"
  53. SWEP.CanBuy = { ROLE_TRAITOR }
  54. SWEP.LimitedStock = false
  55. SWEP.WeaponID = AMMO_SHURIKEN
  56. SWEP.EquipMenuData = {
  57. type = "Silent Weapon",
  58. desc = "Take out the little innocent\nterrorists, ninja-style!"
  59. };
  60. SWEP.IsSilent = true
  61. SWEP.NoSights = true
  62. SWEP.CanUseKey = true
  63.  
  64. -------------Primary Fire Attributes----------------------------------------
  65. SWEP.Primary.Delay = 0.9 --In seconds
  66. SWEP.Primary.Recoil = 0 --Gun Kick
  67. SWEP.Primary.Damage = 65 --Damage per Bullet
  68. SWEP.Primary.NumShots = 1 --Number of shots per one fire
  69. SWEP.Primary.Cone = 0 --Bullet Spread
  70. SWEP.Primary.ClipSize = 2 --Use "-1 if there are no clips"
  71. SWEP.Primary.DefaultClip = 1 --Number of shots in next clip
  72. SWEP.Primary.Automatic = false --Pistol fire (false) or SMG fire (true)
  73. SWEP.Primary.Ammo = "Xbowbolt" --Ammo Type
  74. -------------End Primary Fire Attributes------------------------------------
  75.  
  76. -------------Secondary Fire Attributes-------------------------------------
  77. SWEP.Secondary.Delay = 0.9
  78. SWEP.Secondary.Recoil = 0
  79. SWEP.Secondary.Damage = 65
  80. SWEP.Secondary.NumShots = 1
  81. SWEP.Secondary.Cone = 0
  82. SWEP.Secondary.ClipSize = -1
  83. SWEP.Secondary.DefaultClip = -1
  84. SWEP.Secondary.Automatic = false
  85. SWEP.Secondary.Ammo = "none"
  86. -------------End Secondary Fire Attributes--------------------------------
  87.  
  88. if ( CLIENT ) then
  89. function SWEP:GetViewModelPosition( pos, ang )
  90. pos = pos + ang:Forward()*4
  91. return pos, ang
  92. end
  93. end
  94.  
  95. function SWEP:WasBought(ply)
  96. ply:GiveAmmo(1, "Xbowbolt")
  97. end
  98.  
  99. function SWEP:Initialize()
  100. self:SetWeaponHoldType( self.HoldType )
  101. util.PrecacheSound("weapons/shuriken/throw1.wav")
  102. util.PrecacheSound("weapons/shuriken/throw2.wav")
  103. util.PrecacheSound("weapons/shuriken/throw3.wav")
  104. util.PrecacheSound("weapons/shuriken/throw4.wav")
  105. end
  106.  
  107. function SWEP:PrimaryAttack()
  108. if (self:CanPrimaryAttack()) then
  109. self.Weapon:EmitSound("weapons/shuriken/throw"..tostring( math.random( 1, 4 ) )..".wav")
  110. self.Weapon:SetNextPrimaryFire(CurTime() + 0.8)
  111. self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
  112. if SERVER then
  113. local shuriken = ents.Create("ent_ttt_shuriken")
  114. shuriken:SetAngles(self.Owner:EyeAngles())-- Angle(0,90,0))
  115. shuriken:SetPos(self.Owner:GetShootPos())
  116. shuriken:SetOwner(self.Owner)
  117. shuriken:SetPhysicsAttacker(self.Owner)
  118. shuriken:Spawn()
  119. shuriken:Activate()
  120. local phys = shuriken:GetPhysicsObject()
  121. phys:SetVelocity(self.Owner:GetAimVector()*7000)
  122. phys:AddAngleVelocity(Vector(0,0,90))
  123. end
  124. self:TakePrimaryAmmo(1)
  125. self:Reload()
  126. end
  127. if SERVER then
  128. if self.Owner:GetAmmoCount( self.Primary.Ammo ) <= 0 then
  129. self.Owner:StripWeapon("weapon_ttt_shuriken")
  130. end
  131. end
  132. end
  133.  
  134. function SWEP:UseOverride(activator)
  135. if ( activator:IsPlayer() ) then
  136. if activator:GetWeapon("weapon_ttt_shuriken") then
  137. activator:GiveAmmo(1, "XbowBolt")
  138. else
  139. activator:Give("weapon_ttt_shuriken")
  140. end
  141. self:Remove()
  142. end
  143. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement