Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (SERVER) then
- AddCSLuaFile("shared.lua")
- end
- SWEP.PrintName = "swimming"
- SWEP.Base = "weapon_base"
- SWEP.ViewModel = "models/weapons/c_swim.mdl"
- SWEP.WorldModel = ""
- SWEP.ViewModelFOV = 64
- SWEP.UseHands = true
- SWEP.Primary.Ammo = "none"
- SWEP.Spawnable = false
- SWEP.AdminSpawnable = false
- SWEP.DrawCrosshair = false
- SWEP.HoldType = "normal"
- SWEP.Slot = 6
- SWEP.Primary.Ammo = "none"
- SWEP.Primary.Clipsize = -1
- SWEP.Primary.DefaultClip = -1
- SWEP.Secondary.Ammo = "none"
- SWEP.Secondary.Clipsize = -1
- SWEP.Secondary.DefaultClip = -1
- SWEP.DrawAmmo = false
- SWEP.SwimDelay = CurTime() + 1
- function SWEP:Deploy()
- local player = self:GetOwner()
- player:EmitSound("player/water/water_wade"..math.random(1,4)..".wav",70,100)
- self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER )
- return true
- end
- function SWEP:Holster()
- local player = self:GetOwner()
- WaterLoop:Stop()
- if player:WaterLevel() >= 2 then
- return false
- end
- return true
- end
- function SWEP:PrimaryAttack()
- return false
- end
- function SWEP:SecondaryAttack()
- return false
- end
- function SWEP:Reload()
- return false
- end
- function SWEP:Think()
- local player = self:GetOwner()
- if player:WaterLevel() <= 1 then
- WaterLoop:Stop()
- else
- if self:IsValid() then
- WaterLoop = CreateSound(self,"ambient/water/underwater.wav")
- WaterLoop = CreateSound(self,"")
- WaterLoop:Play()
- end
- WaterLoop:ChangeVolume(0,0)
- end
- if player:WaterLevel() <= 1 then
- WaterLoop:Stop()
- if (SERVER) then
- player:StripWeapon(self:GetClass())
- player:ConCommand("lastinv")
- end
- return
- end
- if CurTime() > self.SwimDelay then
- local player = self:GetOwner()
- if player:KeyDown(IN_FORWARD) then
- player:EmitSound("player/water/water_wade"..math.random(1,4)..".wav",70,100)
- self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER )
- if player:KeyDown(IN_SPEED) then
- timer.Simple(0.15,function()if self:IsValid() then self.Owner:ViewPunch(Angle(-5,0,0))end end)
- else
- timer.Simple(0.30,function()if self:IsValid() then self.Owner:ViewPunch(Angle(-5,0,0))end end)
- end
- end
- if player:KeyDown(IN_BACK) then
- player:EmitSound("player/water/water_wade"..math.random(1,4)..".wav",70,100)
- self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER2 )
- if player:KeyDown(IN_SPEED) then
- timer.Simple(0.10,function()if self:IsValid() then self.Owner:ViewPunch(Angle(2,0,0))end end)
- else
- timer.Simple(0.20,function()if self:IsValid() then self.Owner:ViewPunch(Angle(2,0,0))end end)
- end
- end
- if player:KeyDown(IN_MOVELEFT) then
- player:EmitSound("player/water/water_wade"..math.random(1,4)..".wav",70,100)
- self.Weapon:SendWeaponAnim( ACT_VM_HITLEFT )
- if player:KeyDown(IN_SPEED) then
- timer.Simple(0.25,function()if self:IsValid() then self.Owner:ViewPunch(Angle(0,-5,0))end end)
- timer.Simple(0.3,function()if self:IsValid() then self.Owner:ViewPunch(Angle(0,-5,0))end end)
- else
- timer.Simple(0.70,function()if self:IsValid() then self.Owner:ViewPunch(Angle(0,-5,0))end end)
- timer.Simple(0.80,function()if self:IsValid() then self.Owner:ViewPunch(Angle(0,-5,0))end end)
- end
- end
- if player:KeyDown(IN_MOVERIGHT) then
- player:EmitSound("player/water/water_wade"..math.random(1,4)..".wav",70,100)
- self.Weapon:SendWeaponAnim( ACT_VM_HITRIGHT )
- if player:KeyDown(IN_SPEED) then
- timer.Simple(0.25,function()if self:IsValid() then self.Owner:ViewPunch(Angle(0,5,0))end end)
- timer.Simple(0.3,function()if self:IsValid() then self.Owner:ViewPunch(Angle(0,5,0))end end)
- else
- timer.Simple(0.70,function()if self:IsValid() then self.Owner:ViewPunch(Angle(0,5,0))end end)
- timer.Simple(0.80,function()if self:IsValid() then self.Owner:ViewPunch(Angle(0,5,0))end end)
- end
- end
- if player:KeyDown(IN_SPEED) then
- local vModel = player:GetViewModel()
- vModel:SetPlaybackRate(2)
- self.SwimDelay = CurTime() + self:SequenceDuration()
- else
- self.SwimDelay = CurTime() + self:SequenceDuration() + 0.5
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement