SHARE
TWEET

Untitled

a guest Dec 14th, 2018 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ---- Golden Gun
  2.  
  3. if SERVER then
  4.    AddCSLuaFile( "shared.lua" )
  5. end
  6.  
  7. resource.AddFile("materials/models/weapons/v_models/powerdeagle/deagle_skin1.vmt")
  8. resource.AddFile("materials/models/weapons/v_models/powerdeagle/deagle_skin1.vtf")
  9. resource.AddFile("materials/models/weapons/v_models/powerdeagle/deagle_skin1_ref.vtf")
  10. resource.AddFile("materials/models/weapons/v_models/powerdeagle/dot2.vmt")
  11. resource.AddFile("materials/models/weapons/v_models/powerdeagle/dot2.vtf")
  12. resource.AddFile("materials/models/weapons/v_models/powerdeagle/line.vmt")
  13. resource.AddFile("materials/models/weapons/v_models/powerdeagle/line.vtf")
  14. resource.AddFile("materials/models/weapons/v_models/powerdeagle/Suppressor.vmt")
  15. resource.AddFile("materials/models/weapons/v_models/powerdeagle/Suppressor.vtf")
  16. resource.AddFile("models/weapons/v_powerdeagle.mdl")
  17. resource.AddFile("models/weapons/w_powerdeagle.mdl")
  18. resource.AddFile("materials/models/v_models/feets/v_hands.vmt")
  19. resource.AddFile("materials/models/v_models/feets/v_hands.vtf")
  20. resource.AddFile("materials/models/v_models/feets/v_hands_normal.vtf")
  21.  
  22. if CLIENT then
  23.    SWEP.PrintName = "Golden Gun"
  24.    SWEP.Slot      = 6 -- add 1 to get the slot number key
  25.  
  26.    SWEP.ViewModelFOV  = 72
  27.    SWEP.ViewModelFlip = true
  28. end
  29.  
  30. SWEP.Base        = "weapon_tttbase"
  31.  
  32. --- Standard GMod values
  33.  
  34. SWEP.HoldType      = "pistol"
  35.  
  36. SWEP.Primary.Delay       = 0.08
  37. SWEP.Primary.Recoil      = 1.2
  38. SWEP.Primary.Automatic   = true
  39. SWEP.Primary.Damage      = 1
  40. SWEP.Primary.Cone        = 0.025
  41. SWEP.Primary.Ammo        = "Pistol"
  42. SWEP.Primary.ClipSize    = 1
  43. SWEP.Primary.ClipMax     = 1
  44. SWEP.Primary.DefaultClip = 1
  45. SWEP.Primary.Sound       = Sound( "Weapon_Deagle.Single" )
  46.  
  47. SWEP.ViewModel  = "models/weapons/v_powerdeagle.mdl"
  48. SWEP.WorldModel = "models/weapons/w_powerdeagle.mdl"
  49.  
  50. SWEP.Kind = WEAPON_EQUIP1
  51. SWEP.AutoSpawnable = false
  52. SWEP.AmmoEnt = "RPG_Round"
  53. SWEP.CanBuy = { ROLE_DETECTIVE }
  54. SWEP.InLoadoutFor = nil
  55. SWEP.LimitedStock = true
  56. SWEP.AllowDrop = true
  57. SWEP.IsSilent = false
  58. SWEP.NoSights = false
  59.  
  60. if CLIENT then
  61.    -- Path to the icon material
  62.    SWEP.Icon = "VGUI/ttt/icon_flux_goldengun"
  63.  
  64.    -- Text shown in the equip menu
  65.    SWEP.EquipMenuData = {
  66.       type = "Weapon",
  67.       desc = "Shoot a traitor, kill a traitor. \nShoot an innocent, kill yourself. \nBe careful."
  68.    };
  69. end
  70.  
  71. if SERVER then
  72.    resource.AddFile("materials/VGUI/ttt/icon_flux_goldengun.vmt")
  73. end
  74.  
  75. function SWEP:PrimaryAttack()
  76.   if ( !self:CanPrimaryAttack() ) then return end
  77.  
  78.   self:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
  79.  
  80.   local trace = util.GetPlayerTrace(self.Owner)
  81.    local tr = util.TraceLine(trace)
  82.    
  83.      if tr.Entity.IsPlayer() then
  84.        if tr.Entity:IsRole(ROLE_TRAITOR) then
  85.            
  86.            bullet = {}
  87.            bullet.Num = self.Primary.NumberofShots
  88.           bullet.Src = self.Owner:GetShootPos()
  89.           bullet.Dir = self.Owner:GetAimVector()
  90.           bullet.Spread = Vector( 0, 0, 0 )
  91.           bullet.Tracer = 0
  92.           bullet.Force = 3000
  93.           bullet.Damage = 4000
  94.           bullet.AmmoType = self.Primary.Ammo
  95.           self.Owner:FireBullets(bullet)
  96.           self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK )
  97.           self.TakePrimaryAmmo(1)
  98.           self.Weapon.EmitSound( Sound( "Weapon_Deagle.Single" ) )
  99.          
  100.         end
  101.        
  102.        
  103.         if tr.Entity:IsRole(ROLE_TRAITOR) or tr.Entity.IsRole(ROLE_DETECTIVE) then
  104.           self.owner:Kill()
  105.           self.Weapon:EmitSound( Sound( "Weapon_Deagle.Single" ) )
  106.           self.TakePrimaryAmmo(1)
  107.         end
  108.       end
  109.      
  110.     self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
  111.           self:TakePrimaryAmmo(1)
  112.           self.Owner:EmitSound(Sound( "Weapon_Deagle.Single"  ))
  113.          
  114. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top