fix nil errors part one

This commit is contained in:
edshot99 2024-12-26 22:44:45 -06:00
parent 3518bf7e4b
commit 762785ef1b
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
ent = net.ReadEntity()
else
ent = weapon:GetOwner()
end
local bullet = {
@ -214,7 +216,7 @@ net.Receive("arccw_sendbullet", function(len, ply)
Dead = false,
Damaged = {},
Drag = drag,
Attacker = ent or weapon:GetOwner(),
Attacker = ent,
Gravity = grav,
Profile = profile,
PhysBulletImpact = impact,

View File

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

View File

@ -614,9 +614,11 @@ function SWEP:CreateCustomize2HUD()
self2.AlreadySet = true
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
scroll_2.btnUp.Paint = function(span, w, h)
@ -1450,7 +1452,7 @@ function SWEP:CreateCustomize2HUD()
local txt = (translate("ui.toggle"))
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
txt = try_translate(catttbl.ToggleStats[self.Attachments[slot].ToggleNum].PrintName)
end
@ -1492,7 +1494,11 @@ function SWEP:CreateCustomize2HUD()
draw.RoundedBox(cornerrad, 0, 0, w, h, col)
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)
end

View File

@ -669,10 +669,15 @@ function SWEP:GetMuzzleDevice(wm)
if self:GetInUBGL() then
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
muzz = (self.Attachments[slot].WMuzzleDeviceElement or {}).Model or muzz
muzz = muzz2 or muzz
else
muzz = (self.Attachments[slot].VMuzzleDeviceElement or {}).Model or muzz
muzz = muzz2 or muzz
end
end