Hello, I am running a gmod server with f2s stronghold and I have added custom weapons. I am getting the following error when navigating through the weapon selection menu:
[ERROR] gamemodes/stronghold/gamemode/vgui/sh_loadoutpanel.lua:432: attempt to index a nil value
1. unknown - gamemodes/stronghold/gamemode/vgui/sh_loadoutpanel.lua:432
On the following line:
[code]
function PANEL:Think()
if !GAMEMODE.PrimaryWeapons then return end
if not self.CurrentPrimary or self.CurrentPrimary == "" then return end
if not self.CurrentSecondary or self.CurrentSecondary == "" then return end
if not self.CurrentExplosive or self.CurrentExplosive == "" then return end
local Atype = GAMEMODE.PrimaryWeapons[self.CurrentPrimary].type
local price = GAMEMODE.Ammo[Atype].price
local Atype2 = GAMEMODE.SecondaryWeapons[self.CurrentSecondary].type
local price2 = GAMEMODE.Ammo[Atype2].price <<<<<<<<<<<<<<<<<<<<<-----HERE IS WHERE THE ERROR OCCURS
local Atype3 = GAMEMODE.Explosives[self.CurrentExplosive].price
if !price then return end
self.PrimaryQBAmmoPrice:SetText("Price: $"..self.PrimaryQuickBuy.Value:GetValue()*price)
self.SecondaryQBAmmoPrice:SetText("Price: $"..self.SecondaryQuickBuy.Value:GetValue()*price2)
self.ExplosiveQBAmmoPrice:SetText("Price: $"..self.ExplosiveQuickBuy.Value:GetValue()*Atype3)
end
[/code]
What's not to understand. Means either Ammo, Ammo[Atype2] or Ammo[Atype2].price is unexistant.
[QUOTE=Netheous;48566382]What's not to understand. Means either Ammo, Ammo[Atype2] or Ammo[Atype2].price is unexistant.[/QUOTE]
ok, so I added 2 of the ammo types in the shared.lua which didnt have a price etc... but now I am getting the following error:
[ERROR] gamemodes/stronghold/gamemode/vgui/sh_loadoutpanel.lua:237: attempt to concatenate a boolean value
1. OnRowSelected - gamemodes/stronghold/gamemode/vgui/sh_loadoutpanel.lua:237
2. DoRefreshLicenses - gamemodes/stronghold/gamemode/vgui/sh_loadoutpanel.lua:371
3. Refresh - gamemodes/stronghold/gamemode/vgui/sh_loadoutmenu.lua:44
4. Open - gamemodes/stronghold/gamemode/vgui/sh_loadoutmenu.lua:62
5. unknown - gamemodes/stronghold/gamemode/cl_panels.lua:147
6. unknown - lua/includes/modules/concommand.lua:54
ok, I found the issue on line 237
[editline]29th August 2015[/editline]
So, I have now solved the error above, but now im back to where ive started, I have the following error:
[ERROR] gamemodes/stronghold/gamemode/vgui/sh_loadoutpanel.lua:432: attempt to index a nil value
1. unknown - gamemodes/stronghold/gamemode/vgui/sh_loadoutpanel.lua:432
[editline]29th August 2015[/editline]
FIXED! I had to add 357 to the gamemode ammo table
Sorry, you need to Log In to post a reply to this thread.