Garry's Mod Spawnicon Generation

Okay, I am making an inventory for my gamemode. The only problem, however, is that my spawn icons refuse to generate. I have two problems.

  1. In my inventory enlarger, (you click on an item and it enlarges it and gives info, ect) the default icon generates as an error.
  2. In my main inventory, empty slots do not generate.

The model i am using to fill empty inventory slots is an invisible cube model.
Yes, the cube model works when spawned in sandbox and using ent_create in my gamemode.

The code i am using (clientside) to generate empty inventory slots is as follows:
[lua]
slot2 = vgui.Create(“SpawnIcon”, ivd)
slot2:SetPos(74,5)
if LocalPlayer():GetNetworkedInt(“IS2”) > -1 then
slot2:SetModel(ItemModelArray[LocalPlayer():GetNetworkedInt(“IS2”)])
slot2:SetToolTip(ItemNameArray[LocalPlayer():GetNetworkedInt(“IS2”)])
else
slot2:SetToolTip(“Empty Item Slot”)
slot2.SetModel(invisimodel)
end
[/lua]

Yes, before you ask, the ToolTip for empty slots sets itself.
the invisimodel is defined up the top of the function like this:

[lua]
invisimodel = “models/RealRP/nicktendopefish64/invisicube.mdl”
[/lua]

The code i use for the item info bar spawnicon is as follows:
[lua]
enlarger = vgui.Create(“SpawnIcon”, invent)
enlarger:SetIconSize(100)
enlarger:SetPos(503, 30)
enlarger:SetModel(invisimodel)
[/lua]

Here is a screenshot of the problem:

[editline]7th July 2012[/editline]

Oh, also before you get confused, ItemModelArray and ItemNameArray are arrays where the item names and models are stored.

I think you have to util.PrecacheModel the model before you put it in the spawnicon, or call SpawnIcon:RebuildSpawnIcon() when you make it.

I have never done this and mine always worked. They have to generate once you open the menu for the first time… but those methods are not required. I think he is doing something wrong inside of those tables… which we cannot see to verify.

OP, you mind posting those?

The tables or the table code?
I’ll also the the rebuildicon and util.Precache beforehand

[editline]8th July 2012[/editline]

Thanks guys, the util.precachemodel fixed then enlarger box, and the problem with the actual inventory was that i was using a . instead of : for SpawnIcon:SetModel()

Fixed now, the only problem i have is the “Generating spawn icon”
Is there a way to fix that?