Advertisement
Guest User

Untitled

a guest
Oct 24th, 2015
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.40 KB | None | 0 0
  1. local soundData = {
  2. name = "Weapon_Cssg08.Draw" ,
  3. channel = CHAN_WEAPON,
  4. volume = 0.25,
  5. soundlevel = 80,
  6. pitchstart = 100,
  7. pitchend = 100,
  8. sound = "newage_csgo/csgo/ssg08/ssg08_draw.wav"
  9. }
  10.  
  11. sound.Add(soundData)
  12.  
  13. local soundData = {
  14. name = "Weapon_Cssg08.BoltBack" ,
  15. channel = CHAN_WEAPON,
  16. volume = 0.25,
  17. soundlevel = 80,
  18. pitchstart = 100,
  19. pitchend = 100,
  20. sound = "newage_csgo/csgo/ssg08/ssg08_boltback.wav"
  21. }
  22.  
  23. sound.Add(soundData)
  24.  
  25. local soundData = {
  26. name = "Weapon_Cssg08.BoltForward" ,
  27. channel = CHAN_WEAPON,
  28. volume = 0.25,
  29. soundlevel = 80,
  30. pitchstart = 100,
  31. pitchend = 100,
  32. sound = "newage_csgo/csgo/ssg08/ssg08_boltforward.wav"
  33. }
  34.  
  35. sound.Add(soundData)
  36.  
  37. local soundData = {
  38. name = "Weapon_Cssg08.Clipout" ,
  39. channel = CHAN_WEAPON,
  40. volume = 0.25,
  41. soundlevel = 80,
  42. pitchstart = 100,
  43. pitchend = 100,
  44. sound = "newage_csgo/csgo/ssg08/ssg08_clipout.wav"
  45. }
  46.  
  47. sound.Add(soundData)
  48.  
  49. local soundData = {
  50. name = "Weapon_Cssg08.Clipin" ,
  51. channel = CHAN_WEAPON,
  52. volume = 0.25,
  53. soundlevel = 80,
  54. pitchstart = 100,
  55. pitchend = 100,
  56. sound = "newage_csgo/csgo/ssg08/ssg08_clipin.wav"
  57. }
  58.  
  59. sound.Add(soundData)
  60.  
  61. local soundData = {
  62. name = "Weapon_Cssg08.Cliphit" ,
  63. channel = CHAN_WEAPON,
  64. volume = 0.25,
  65. soundlevel = 80,
  66. pitchstart = 100,
  67. pitchend = 100,
  68. sound = "newage_csgo/csgo/ssg08/ssg08_cliphit.wav"
  69. }
  70.  
  71. sound.Add(soundData)
  72.  
  73. if ( SERVER ) then
  74.  
  75. AddCSLuaFile( "shared.lua" )
  76.  
  77. end
  78.  
  79.  
  80. SWEP.PrintName = "SSG 08"
  81. SWEP.Slot = 2
  82. SWEP.SlotPos = 1
  83.  
  84.  
  85. SWEP.HoldType = "ar2"
  86. SWEP.ViewModelFlip = false
  87. SWEP.ViewModel = "models/weapons/c_csgo_ssg08.mdl"
  88. SWEP.WorldModel = "models/weapons/csgo_world/w_snip_ssg08.mdl"
  89. SWEP.UseHands = true
  90. SWEP.ViewModelFOV = 45
  91. SWEP.DrawCrosshair = false -- set false if you want no crosshair
  92. SWEP.Weight = 5
  93. SWEP.AutoSwitchTo = false
  94. SWEP.AutoSwitchFrom = false
  95.  
  96. -- TTT settings
  97. SWEP.Spawnable = true
  98. SWEP.AdminSpawnable = true
  99. SWEP.AutoSpawnable = true
  100. SWEP.Kind = WEAPON_HEAVY
  101. SWEP.AmmoEnt = "item_ammo_357_ttt"
  102. SWEP.IsSilent = false
  103. SWEP.NoSights = false
  104. SWEP.Base = "weapon_tttbase"
  105. SWEP.AllowDrop = true
  106. -- TTT
  107.  
  108. SWEP.Primary.Sound = Sound("csgo/ssg08/ssg08-1.wav")
  109. SWEP.Secondary.Sound = Sound("Default.Zoom")
  110. SWEP.Primary.Recoil = 5
  111. SWEP.Primary.Damage = 50
  112. SWEP.Primary.NumShots = 1
  113. SWEP.HeadshotMultiplier = 5
  114. SWEP.Primary.KickUp = 0.15
  115. SWEP.Primary.KickDown = 0.12
  116. SWEP.Primary.KickHorizontal = 0.13
  117. SWEP.Primary.Cone = 0.0001
  118. SWEP.Primary.ClipSize = 10
  119. SWEP.Primary.Delay = 1.3
  120. SWEP.Primary.DefaultClip = 10
  121. SWEP.Primary.ClipMax = 20
  122. SWEP.Primary.Automatic = false
  123. SWEP.Primary.Ammo = "357"
  124.  
  125. SWEP.IronSightsPos = Vector(0, 0, 0)
  126. SWEP.IronSightsAng = Vector(0.145, 2.634, 0)
  127.  
  128. -- Accuracy
  129. -- Accuracy
  130. SWEP.CrouchCone = 0.01 -- Accuracy when we're crouching
  131. SWEP.CrouchWalkCone = 0.02 -- Accuracy when we're crouching and walking
  132. SWEP.WalkCone = 0.025 -- Accuracy when we're walking
  133. SWEP.AirCone = 0.1 -- Accuracy when we're in air
  134. SWEP.StandCone = 0.015 -- Accuracy when we're standing still
  135. SWEP.Delay = 0.275
  136. SWEP.Recoil = 0
  137. SWEP.RecoilZoom = 0
  138.  
  139. if CLIENT then
  140. SWEP.Icon = "vgui/ttt/ssg08_newage"
  141. local scope = surface.GetTextureID("sprites/scope")
  142. function SWEP:DrawHUD()
  143. if self:GetIronsights() then
  144. surface.SetDrawColor( 0, 0, 0, 255 )
  145.  
  146. local x = ScrW() / 2.0
  147. local y = ScrH() / 2.0
  148. local scope_size = ScrH()
  149.  
  150. -- crosshair
  151. local gap = 80
  152. local length = scope_size
  153. surface.DrawLine( x - length, y, x - gap, y )
  154. surface.DrawLine( x + length, y, x + gap, y )
  155. surface.DrawLine( x, y - length, x, y - gap )
  156. surface.DrawLine( x, y + length, x, y + gap )
  157.  
  158. gap = 0
  159. length = 50
  160. surface.DrawLine( x - length, y, x - gap, y )
  161. surface.DrawLine( x + length, y, x + gap, y )
  162. surface.DrawLine( x, y - length, x, y - gap )
  163. surface.DrawLine( x, y + length, x, y + gap )
  164.  
  165.  
  166. -- cover edges
  167. local sh = scope_size / 2
  168. local w = (x - sh) + 2
  169. surface.DrawRect(0, 0, w, scope_size)
  170. surface.DrawRect(x + sh - 2, 0, w, scope_size)
  171.  
  172. surface.SetDrawColor(255, 0, 0, 255)
  173. surface.DrawLine(x, y, x + 1, y + 1)
  174.  
  175. -- scope
  176. surface.SetTexture(scope)
  177. surface.SetDrawColor(255, 255, 255, 255)
  178.  
  179. surface.DrawTexturedRectRotated(x, y, scope_size, scope_size, 0)
  180.  
  181. else
  182. return self.BaseClass.DrawHUD(self)
  183. end
  184. end
  185.  
  186. function SWEP:AdjustMouseSensitivity()
  187. return (self:GetIronsights() and 0.2) or nil
  188. end
  189. end
  190.  
  191. function SWEP:IronSight()
  192.  
  193. if !self.Owner:KeyDown(IN_USE) then
  194. -- If the key E (Use Key) is not pressed, then
  195.  
  196. if self.Owner:KeyPressed(IN_ATTACK2) then
  197. -- When the right click is pressed, then
  198.  
  199. self:SetIronsights(true, self.Owner)
  200.  
  201. if CLIENT then return end
  202. end
  203. end
  204.  
  205. if !self.Owner:KeyDown(IN_ATTACK2) then
  206. -- If the right click is released, then
  207.  
  208. self:SetIronsights(false, self.Owner)
  209.  
  210. if CLIENT then return end
  211. end
  212. end
  213.  
  214. local IRONSIGHT_TIME = 0.15 -- How long it takes to raise our rifle
  215.  
  216. function SWEP:SetIronsights(b, player)
  217.  
  218. if CLIENT then return end
  219.  
  220. -- Send the ironsight state to the client, so it can adjust the player's FOV/Viewmodel pos accordingly
  221. self.Weapon:SetNetworkedBool("Ironsights", b)
  222.  
  223. if self.UseScope then -- If we have a scope, use that instead of ironsights
  224. if b then
  225. --Activate the scope after we raise the rifle
  226. timer.Simple(IRONSIGHT_TIME, function() self:SetScope(true, player) end)
  227. else
  228. self:SetScope(false, player)
  229. end
  230. end
  231. end
  232.  
  233. function SWEP:SetZoom(state)
  234. if CLIENT then
  235. return
  236. else
  237. if state then
  238. self.Owner:SetFOV(20, 0.3)
  239. else
  240. self.Owner:SetFOV(0, 0.2)
  241. end
  242. end
  243. end
  244.  
  245. function SWEP:SecondaryAttack()
  246. if not self.IronSightsPos then return end
  247. if self.Weapon:GetNextSecondaryFire() > CurTime() then return end
  248.  
  249. bIronsights = not self:GetIronsights()
  250.  
  251. self:SetIronsights( bIronsights )
  252.  
  253. if SERVER then
  254. self:SetZoom(bIronsights)
  255. else
  256. self:EmitSound(self.Secondary.Sound)
  257. end
  258.  
  259. self.Weapon:SetNextSecondaryFire( CurTime() + 0.3)
  260. end
  261.  
  262. function SWEP:PreDrop()
  263. self:SetZoom(false)
  264. self:SetIronsights(false)
  265. return self.BaseClass.PreDrop(self)
  266. end
  267.  
  268. function SWEP:Holster()
  269. self:SetIronsights(false)
  270. self:SetZoom(false)
  271. return true
  272. end
  273.  
  274. SWEP.Offset = {
  275. Pos = {
  276. Up = 0,
  277. Right = 1,
  278. Forward = -3,
  279. },
  280. Ang = {
  281. Up = 0,
  282. Right = 0,
  283. Forward = 0,
  284. }
  285. }
  286.  
  287. function SWEP:Think()
  288. self:DrawWorldModel( )
  289. end
  290.  
  291. function SWEP:RenderOverride()
  292. self:DrawWorldModel()
  293. end
  294.  
  295. function SWEP:OnDrop()
  296. self.Owner = nil
  297. end
  298.  
  299. function SWEP:Reload()
  300. self.Weapon:DefaultReload( ACT_VM_RELOAD );
  301. self:SetIronsights( false )
  302. self:SetZoom(false)
  303. end
  304.  
  305. function SWEP:DrawWorldModel( )
  306. local hand, offset, rotate
  307.  
  308. if not IsValid( self.Owner ) then
  309. self:SetRenderOrigin(self.Pos)
  310. self:SetRenderAngles(self.Ang)
  311. self:DrawModel( )
  312. return
  313. end
  314.  
  315. if not self.Hand then
  316. self.Hand = self.Owner:LookupAttachment( "anim_attachment_rh" )
  317. end
  318.  
  319. hand = self.Owner:GetAttachment( self.Hand )
  320.  
  321. if not hand then
  322. --self:SetRenderOrigin(self:GetNetworkOrigin())
  323. --self:SetRenderAngles(self:GetNetworkAngles())
  324. self:SetRenderOrigin(self.Pos)
  325. self:SetRenderAngles(self.Ang)
  326. self:DrawModel( )
  327. return
  328. end
  329.  
  330. offset = hand.Ang:Right( ) * self.Offset.Pos.Right + hand.Ang:Forward( ) * self.Offset.Pos.Forward + hand.Ang:Up( ) * self.Offset.Pos.Up
  331.  
  332. hand.Ang:RotateAroundAxis( hand.Ang:Right( ), self.Offset.Ang.Right )
  333. hand.Ang:RotateAroundAxis( hand.Ang:Forward( ), self.Offset.Ang.Forward )
  334. hand.Ang:RotateAroundAxis( hand.Ang:Up( ), self.Offset.Ang.Up )
  335.  
  336. if self.SetRenderOrigin == nil or self.SetRenderAngles == nil then return end
  337.  
  338. self:SetRenderOrigin( hand.Pos + offset )
  339. self:SetRenderAngles( hand.Ang + Angle(-10, 0, 0) )
  340.  
  341. self:DrawModel( )
  342. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement