Hello! It's been awhile since I used Facepunch whatever this is.
I have an old SWEP, a basic one for the SIG 553 in my TTT server.
For some reason, the reload animation does not play. Rather, instantly, the reload is processed.
The reload amount is completely fine, and I do have CSS installed as well as GMOD for the dedicated server.
Here is the code:
if SERVER then
AddCSLuaFile( "shared.lua" )
resource.AddFile("materials/gg/icon_td_kreig_552.vmt")
end
SWEP.HoldType = "ar2"
if CLIENT then
SWEP.PrintName = "Kreig 552"
SWEP.Slot = 2
SWEP.Icon = "gg/icon_td_kreig_552"
end
SWEP.Base = "weapon_tttbase"
SWEP.Kind = WEAPON_HEAVY
SWEP.WeaponID = AMMO_552
SWEP.Primary.Delay = 0.09
SWEP.Primary.Damage = 14
SWEP.Primary.Cone = 0.007
SWEP.Primary.ClipSize = 30
SWEP.Primary.ClipMax = 60
SWEP.Primary.DefaultClip = 30
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = "smg1"
SWEP.Primary.Recoil = 1
SWEP.Primary.Sound = Sound("Weapon_SG552.Single")
SWEP.Secondary.ClipSize = 1
SWEP.Secondary.DefaultClip = 1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
SWEP.Secondary.ClipMax = -1
SWEP.AutoSpawnable = true
SWEP.AmmoEnt = "item_ammo_smg1_ttt"
SWEP.ViewModelFlip = true
SWEP.ViewModel = "models/weapons/v_rif_sg552.mdl"
SWEP.WorldModel = "models/weapons/w_rif_sg552.mdl"
SWEP.PrimaryAnim = ACT_VM_PRIMARYATTACK_SG552
SWEP.ReloadAnim = ACT_VM_RELOAD_SG552
SWEP.HeadshotMultiplier = 4.5
SWEP.IronSightsPos = Vector (2.035, -6.1108, -0.2902)
SWEP.IronSightsAng = Vector (-6.2404, 28.1427, 18.1494)
SWEP.Secondary.Sound = Sound("Default.Zoom")
SWEP.DeploySpeed = 2
function SWEP:Deploy()
self.Weapon:SendWeaponAnim(ACT_VM_DRAW)
return true
end
function SWEP:SetZoom(state)
if CLIENT then
return
else
if state then
self.Owner:SetFOV(30, 0)
else
self.Owner:SetFOV(0, 0)
end
end
end
function SWEP:SecondaryAttack()
if not self.IronSightsPos then return end
if self.Weapon:GetNextSecondaryFire() > CurTime() then return end
bIronsights = not self:GetIronsights()
self:SetIronsights( bIronsights )
if SERVER then
self:SetZoom(bIronsights)
else
self:EmitSound(self.Secondary.Sound)
end
self.Weapon:SetNextSecondaryFire( CurTime() + 0.2)
end
if CLIENT then
local scope = surface.GetTextureID("sprites/scope")
function SWEP:DrawHUD()
if self:GetIronsights() then
surface.SetDrawColor( 0, 0, 0, 255 )
local x = ScrW() / 2.0
local y = ScrH() / 2.0
local scope_size = ScrH()
-- crosshair
local gap = 80
local length = scope_size
surface.DrawLine( x - length, y, x - gap, y )
surface.DrawLine( x + length, y, x + gap, y )
surface.DrawLine( x, y - length, x, y - gap )
surface.DrawLine( x, y + length, x, y + gap )
gap = 0
length = 50
surface.DrawLine( x - length, y, x - gap, y )
surface.DrawLine( x + length, y, x + gap, y )
surface.DrawLine( x, y - length, x, y - gap )
surface.DrawLine( x, y + length, x, y + gap )
-- cover edges
local sh = scope_size / 2
local w = (x - sh) + 2
surface.DrawRect(0, 0, w, scope_size)
surface.DrawRect(x + sh - 2, 0, w, scope_size)
surface.SetDrawColor(255, 0, 0, 255)
surface.DrawLine(x, y, x + 1, y + 1)
-- scope
surface.SetTexture(scope)
surface.SetDrawColor(255, 255, 255, 255)
surface.DrawTexturedRectRotated(x, y, scope_size, scope_size, 0)
else
return self.BaseClass.DrawHUD(self)
end
end
function SWEP:AdjustMouseSensitivity()
return (self:GetIronsights() and 0.2) or nil
end
end
function SWEP:PreDrop()
self:SetZoom(false)
self:SetIronsights(false)
return self.BaseClass.PreDrop(self)
end
function SWEP:Reload()
self.Weapon:DefaultReload( ACT_VM_RELOAD );
self:SetIronsights(false)
self:SetZoom(false)
end
function SWEP:Holster()
self:SetIronsights(false)
self:SetZoom(false)
return true
end
This is still facepunch
And your code should work, could you try doing:
function SWEP:Reload()
self.Weapon:DefaultReload(ACT_VM_RELOAD);
end
Sorry, you need to Log In to post a reply to this thread.