Advertisement
Guest User

Untitled

a guest
Jun 11th, 2014
19
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.00 KB | None | 0 0
  1. if (SERVER) then
  2. AddCSLuaFile("shared.lua")
  3. end
  4.  
  5. SWEP.PrintName = "swimming"
  6. SWEP.Base = "weapon_base"
  7.  
  8. SWEP.ViewModel = "models/weapons/c_swim.mdl"
  9. SWEP.WorldModel = ""
  10. SWEP.ViewModelFOV = 64
  11. SWEP.UseHands = true
  12.  
  13. SWEP.Primary.Ammo = "none"
  14.  
  15. SWEP.Spawnable = false
  16. SWEP.AdminSpawnable = false
  17.  
  18. SWEP.DrawCrosshair = false
  19. SWEP.HoldType = "normal"
  20.  
  21. SWEP.Slot = 6
  22.  
  23. SWEP.Primary.Ammo = "none"
  24. SWEP.Primary.Clipsize = -1
  25. SWEP.Primary.DefaultClip = -1
  26.  
  27. SWEP.Secondary.Ammo = "none"
  28. SWEP.Secondary.Clipsize = -1
  29. SWEP.Secondary.DefaultClip = -1
  30.  
  31. SWEP.DrawAmmo = false
  32.  
  33. SWEP.SwimDelay = CurTime() + 1
  34.  
  35. function SWEP:Deploy()
  36. local player = self:GetOwner()
  37. player:EmitSound("player/water/water_wade"..math.random(1,4)..".wav",70,100)
  38. self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER )
  39. return true
  40. end
  41.  
  42. function SWEP:Holster()
  43. local player = self:GetOwner()
  44. WaterLoop:Stop()
  45. if player:WaterLevel() >= 2 then
  46. return false
  47. end
  48.  
  49. return true
  50. end
  51.  
  52. function SWEP:PrimaryAttack()
  53. return false
  54. end
  55.  
  56. function SWEP:SecondaryAttack()
  57. return false
  58. end
  59.  
  60. function SWEP:Reload()
  61. return false
  62. end
  63.  
  64. function SWEP:Think()
  65.  
  66. local player = self:GetOwner()
  67. if player:WaterLevel() <= 1 then
  68. WaterLoop:Stop()
  69. else
  70. if self:IsValid() then
  71. WaterLoop = CreateSound(self,"ambient/water/underwater.wav")
  72. WaterLoop = CreateSound(self,"")
  73. WaterLoop:Play()
  74. end
  75. WaterLoop:ChangeVolume(0,0)
  76. end
  77.  
  78. if player:WaterLevel() <= 1 then
  79. WaterLoop:Stop()
  80. if (SERVER) then
  81. player:StripWeapon(self:GetClass())
  82. player:ConCommand("lastinv")
  83. end
  84.  
  85. return
  86. end
  87.  
  88. if CurTime() > self.SwimDelay then
  89.  
  90. local player = self:GetOwner()
  91. if player:KeyDown(IN_FORWARD) then
  92. player:EmitSound("player/water/water_wade"..math.random(1,4)..".wav",70,100)
  93. self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER )
  94. if player:KeyDown(IN_SPEED) then
  95. timer.Simple(0.15,function()if self:IsValid() then self.Owner:ViewPunch(Angle(-5,0,0))end end)
  96. else
  97. timer.Simple(0.30,function()if self:IsValid() then self.Owner:ViewPunch(Angle(-5,0,0))end end)
  98. end
  99. end
  100. if player:KeyDown(IN_BACK) then
  101. player:EmitSound("player/water/water_wade"..math.random(1,4)..".wav",70,100)
  102. self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER2 )
  103. if player:KeyDown(IN_SPEED) then
  104. timer.Simple(0.10,function()if self:IsValid() then self.Owner:ViewPunch(Angle(2,0,0))end end)
  105. else
  106. timer.Simple(0.20,function()if self:IsValid() then self.Owner:ViewPunch(Angle(2,0,0))end end)
  107. end
  108. end
  109. if player:KeyDown(IN_MOVELEFT) then
  110. player:EmitSound("player/water/water_wade"..math.random(1,4)..".wav",70,100)
  111. self.Weapon:SendWeaponAnim( ACT_VM_HITLEFT )
  112. if player:KeyDown(IN_SPEED) then
  113. timer.Simple(0.25,function()if self:IsValid() then self.Owner:ViewPunch(Angle(0,-5,0))end end)
  114. timer.Simple(0.3,function()if self:IsValid() then self.Owner:ViewPunch(Angle(0,-5,0))end end)
  115. else
  116. timer.Simple(0.70,function()if self:IsValid() then self.Owner:ViewPunch(Angle(0,-5,0))end end)
  117. timer.Simple(0.80,function()if self:IsValid() then self.Owner:ViewPunch(Angle(0,-5,0))end end)
  118. end
  119. end
  120. if player:KeyDown(IN_MOVERIGHT) then
  121. player:EmitSound("player/water/water_wade"..math.random(1,4)..".wav",70,100)
  122. self.Weapon:SendWeaponAnim( ACT_VM_HITRIGHT )
  123. if player:KeyDown(IN_SPEED) then
  124. timer.Simple(0.25,function()if self:IsValid() then self.Owner:ViewPunch(Angle(0,5,0))end end)
  125. timer.Simple(0.3,function()if self:IsValid() then self.Owner:ViewPunch(Angle(0,5,0))end end)
  126. else
  127. timer.Simple(0.70,function()if self:IsValid() then self.Owner:ViewPunch(Angle(0,5,0))end end)
  128. timer.Simple(0.80,function()if self:IsValid() then self.Owner:ViewPunch(Angle(0,5,0))end end)
  129. end
  130. end
  131.  
  132. if player:KeyDown(IN_SPEED) then
  133. local vModel = player:GetViewModel()
  134. vModel:SetPlaybackRate(2)
  135. self.SwimDelay = CurTime() + self:SequenceDuration()
  136. else
  137. self.SwimDelay = CurTime() + self:SequenceDuration() + 0.5
  138. end
  139. end
  140. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement