Guest User

riot shield

a guest
Oct 6th, 2013
226
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if CLIENT then
  2. SWEP.Icon = "VGUI/ttt/icon_shield"
  3. end
  4.  
  5. if SERVER then
  6. AddCSLuaFile( "shared.lua" )
  7.  
  8. resource.AddFile("models/arleitiss/riotshield/shield.mdl")
  9. resource.AddFile("models/arleitiss/riotshield/shield.dx80.vtx")
  10. resource.AddFile("models/arleitiss/riotshield/shield.dx90.vtx")
  11. resource.AddFile("models/arleitiss/riotshield/shield.phy")
  12. resource.AddFile("models/arleitiss/riotshield/shield.sw.vtx")
  13. resource.AddFile("models/arleitiss/riotshield/shield.vvd")
  14. resource.AddFile("materials/pack/icon_riot.png")
  15. resource.AddFile("materials/arleitiss/riotshield/riot_metal.vmt")
  16. resource.AddFile("materials/arleitiss/riotshield/riot_metal_bump.vtf")
  17. resource.AddFile("materials/arleitiss/riotshield/shield_cloth.vmt")
  18. resource.AddFile("materials/arleitiss/riotshield/shield_edges.vmt")
  19. resource.AddFile("materials/arleitiss/riotshield/shield_glass.vmt")
  20. resource.AddFile("materials/arleitiss/riotshield/shield_grip.vmt")
  21. resource.AddFile("materials/arleitiss/riotshield/shield_gripbump.vtf")
  22. resource.AddFile("materials/VGUI/ttt/icon_shield.vmt")
  23. end
  24.  
  25. SWEP.HoldType = "slam"
  26.  
  27. if CLIENT then
  28. SWEP.PrintName = "Riot Shield"
  29. SWEP.Author = "Soviet"
  30. SWEP.Slot = 6
  31. SWEP.SlotPos = 1
  32. SWEP.IconLetter = "w"
  33. end
  34. SWEP.EquipMenuData = {
  35. type = "Defense",
  36. desc = [[
  37. A riot shield used to deflect bullets !]]
  38. };
  39.  
  40.  
  41. SWEP.Base = "weapon_tttbase"
  42. SWEP.Spawnable = true
  43. SWEP.AdminSpawnable = true
  44.  
  45. SWEP.Kind = WEAPON_EQUIP1
  46. SWEP.WeaponID = AMMO_RIOTSHIELD
  47. SWEP.ViewModelFOV = 62
  48. SWEP.ViewModelFlip = false
  49. SWEP.AnimPrefix = "rpg"
  50. SWEP.Primary.Damage = 0
  51. SWEP.Primary.ClipSize = -1
  52. SWEP.Primary.DefaultClip = -1
  53. SWEP.Primary.Automatic = true
  54. SWEP.Primary.Delay = 1.1
  55. SWEP.Primary.Ammo = "none"
  56.  
  57. SWEP.Primary.ClipSize = -1
  58. SWEP.Primary.DefaultClip = 1
  59. SWEP.Primary.Automatic = true
  60. SWEP.Primary.Ammo = "none"
  61.  
  62. SWEP.Secondary.ClipSize = -1
  63. SWEP.Secondary.DefaultClip = 1
  64. SWEP.Secondary.Automatic = true
  65. SWEP.Secondary.Ammo = "none"
  66. SWEP.CanBuy = {ROLE_DETECTIVE} -- only detectives can buy
  67. SWEP.LimitedStock = true -- only buyable once
  68.  
  69.  
  70.  
  71. SWEP.WorldModel = "models/arleitiss/riotshield/shield.mdl" // The reason im having a world model is that, when it lies on the ground, it should have a model then too.
  72. SWEP.ViewModel = ""
  73.  
  74. function SWEP:Deploy()
  75. if SERVER then
  76. if IsValid(self.ent) then return end //Makes it not able to spawn multiple entities.
  77. self:SetNoDraw(true)
  78. self.ent = ents.Create("prop_physics")
  79. self.ent:SetModel("models/arleitiss/riotshield/shield.mdl")
  80. self.ent:SetPos(self.Owner:GetPos() + Vector(0,0,5) + (self.Owner:GetForward()*25))
  81. self.ent:SetAngles(Angle(0,self.Owner:EyeAngles().y,self.Owner:EyeAngles().r))
  82. self.ent:SetParent(self.Owner)
  83. self.ent:Fire("SetParentAttachmentMaintainOffset", "eyes", 0.01) // Garry fucked up the parenting on players in latest patch..
  84. self.ent:SetCollisionGroup( COLLISION_GROUP_WORLD ) // Lets it not collide to anything but world. Taken from Nocollide Rightclick Code
  85. self.ent:Spawn()
  86. self.ent:Activate()
  87. end
  88. return true
  89. end
  90.  
  91.  
  92. function SWEP:Holster()
  93. if SERVER then
  94. if not IsValid(self.ent) then return end
  95. self.ent:Remove()
  96. end
  97. return true
  98. end
  99.  
  100. function SWEP:OnDrop()
  101. if SERVER then
  102. self:SetColor(Color(255,255,255,255))
  103. if not IsValid(self.ent) then return end
  104. self.ent:Remove()
  105. end
  106. end
  107.  
  108. function SWEP:OnRemove()
  109. if SERVER then
  110. self:SetColor(Color(255,255,255,255))
  111. if not IsValid(self.ent) then return end
  112. self.ent:Remove()
  113. end
  114. end
RAW Paste Data