This is the error I get when someone pushes Q to open their inventory:
[ERROR] gamemodes/perp/gamemode/cl_networking.lua:129: attempt to index field 'InventoryPanel' (a nil value)
1. CloseInventory - gamemodes/perp/gamemode/cl_networking.lua:129
And here's the code:
function GM.OpenInventory ( )
if (GAMEMODE.ShopPanel) then
GAMEMODE.ShopPanel:Remove()
GAMEMODE.ShopPanel = nil
gui.EnableScreenClicker(false)
LocalPlayer():ClearForcedEyeAngles()
return
end
if (GAMEMODE.BankIPanel) then
GAMEMODE.BankIPanel:Remove()
GAMEMODE.BankIPanel = nil;
gui.EnableScreenClicker(false);
LocalPlayer():ClearForcedEyeAngles()
return
end
if LocalPlayer():GetNWBool("cuffed") then return end
--slaugh7er
if IsValid(GAMEMODE.InventoryPanel) then
GAMEMODE.InventoryPanel:Remove()
GAMEMODE.InventoryPanel = vgui.Create("perp2_inventory")
RunConsoleCommand( "SLAUGH7ER_InvResync" )
end
--slaugh7er
GAMEMODE.InventoryPanel:SetVisible(true)
GAMEMODE.InventoryPanel:UpdateIcons()
GAMEMODE.InventoryPanel:InvalidateLayout(true)
gui.EnableScreenClicker(true)
end
function GM.CloseInventory ( )
if (GAMEMODE.ShopPanel) then
GAMEMODE.ShopPanel:Remove()
GAMEMODE.ShopPanel = nil
gui.EnableScreenClicker(false)
LocalPlayer():ClearForcedEyeAngles()
return
end
GAMEMODE.InventoryPanel:SetVisible(true)
GAMEMODE.InventoryPanel.HoveredItem = nil -- Remove this variable so it doesn't show the info for the last item the user hovered over next time we open.
gui.EnableScreenClicker(true)
end
I'm just trying to figure out why its not working. If someone can point me in the right direction it would be much appreciated. Thanks in advance.
Sorry, you need to Log In to post a reply to this thread.