Compare commits

...

1 Commits

Author SHA1 Message Date
edshot99
762785ef1b fix nil errors part one 2024-12-26 22:44:45 -06:00
4 changed files with 21 additions and 7 deletions

View File

@ -202,6 +202,8 @@ net.Receive("arccw_sendbullet", function(len, ply)
if game.SinglePlayer() then if game.SinglePlayer() then
ent = net.ReadEntity() ent = net.ReadEntity()
else
ent = weapon:GetOwner()
end end
local bullet = { local bullet = {
@ -214,7 +216,7 @@ net.Receive("arccw_sendbullet", function(len, ply)
Dead = false, Dead = false,
Damaged = {}, Damaged = {},
Drag = drag, Drag = drag,
Attacker = ent or weapon:GetOwner(), Attacker = ent,
Gravity = grav, Gravity = grav,
Profile = profile, Profile = profile,
PhysBulletImpact = impact, PhysBulletImpact = impact,

View File

@ -3,6 +3,7 @@ function EFFECT:Init(data)
local wpn = data:GetEntity() local wpn = data:GetEntity()
if !IsValid(wpn) then return end if !IsValid(wpn) then return end
if !wpn.ArcCW then return end
local muzzle = wpn.MuzzleEffect local muzzle = wpn.MuzzleEffect
local overridemuzzle = wpn:GetBuff_Override("Override_MuzzleEffect") local overridemuzzle = wpn:GetBuff_Override("Override_MuzzleEffect")

View File

@ -614,9 +614,11 @@ function SWEP:CreateCustomize2HUD()
self2.AlreadySet = true self2.AlreadySet = true
end end
local scroll = self2:GetScroll() if IsValid(self.Inv_Scroll) then
local scroll = self2:GetScroll()
self.Inv_Scroll[self.Inv_SelectedSlot or 0] = scroll self.Inv_Scroll[self.Inv_SelectedSlot or 0] = scroll
end
end end
scroll_2.btnUp.Paint = function(span, w, h) scroll_2.btnUp.Paint = function(span, w, h)
@ -1450,7 +1452,7 @@ function SWEP:CreateCustomize2HUD()
local txt = (translate("ui.toggle")) local txt = (translate("ui.toggle"))
local catttbl = ArcCW.AttachmentTable[att] local catttbl = ArcCW.AttachmentTable[att]
if catttbl and catttbl.ToggleStats[self.Attachments[slot].ToggleNum] if catttbl and IsValid(self.Attachments) and catttbl.ToggleStats[self.Attachments[slot].ToggleNum]
and catttbl.ToggleStats[self.Attachments[slot].ToggleNum].PrintName then and catttbl.ToggleStats[self.Attachments[slot].ToggleNum].PrintName then
txt = try_translate(catttbl.ToggleStats[self.Attachments[slot].ToggleNum].PrintName) txt = try_translate(catttbl.ToggleStats[self.Attachments[slot].ToggleNum].PrintName)
end end
@ -1492,7 +1494,11 @@ function SWEP:CreateCustomize2HUD()
draw.RoundedBox(cornerrad, 0, 0, w, h, col) draw.RoundedBox(cornerrad, 0, 0, w, h, col)
surface.SetDrawColor(col2.r, col2.g, col2.b) surface.SetDrawColor(col2.r, col2.g, col2.b)
surface.SetMaterial(self.Attachments[slot].ToggleLock and iconlock or iconunlock) if IsValid(self.Attachments) then
surface.SetMaterial(self.Attachments[slot].ToggleLock and iconlock or iconunlock)
else
surface.SetMaterial(iconunlock)
end
surface.DrawTexturedRect(4, 4, w - 8, h - 8) surface.DrawTexturedRect(4, 4, w - 8, h - 8)
end end

View File

@ -669,10 +669,15 @@ function SWEP:GetMuzzleDevice(wm)
if self:GetInUBGL() then if self:GetInUBGL() then
local _, slot = self:GetBuff_Override("UBGL") local _, slot = self:GetBuff_Override("UBGL")
local muzz2 = nil
if IsValid(self.Attachments) then
muzz2 = (self.Attachments[slot].WMuzzleDeviceElement or {}).Model
end
if wm then if wm then
muzz = (self.Attachments[slot].WMuzzleDeviceElement or {}).Model or muzz muzz = muzz2 or muzz
else else
muzz = (self.Attachments[slot].VMuzzleDeviceElement or {}).Model or muzz muzz = muzz2 or muzz
end end
end end