Pointshop issue: attempt to index local 'model' (a nil value)
10 replies, posted
If it's not one thing, it's another I can't catch a break with these issues. Anyway, I keep getting the following lua error in console
[CODE][ERROR] addons/pointshop-master/lua/pointshop/vgui/dpointshoppreview.lua:82: attempt to index local 'model' (a nil value)
1. DrawOtherModels - addons/pointshop-master/lua/pointshop/vgui/dpointshoppreview.lua:82
2. unknown - addons/pointshop-master/lua/pointshop/vgui/dpointshoppreview.lua:42 [/CODE]
I have tried looking it up, but cannot find anything regarding "attempt to index local 'model' (a nil value)", I looked at both lines 42 and 82 as the error states, but I have no idea what I am looking for.
Here are the accessories I am using:
GTA V Accessories pack: [url]https://steamcommunity.com/sharedfiles/filedetails/?id=572310302[/url]
GMod Tower Accessories Pack: [url]https://steamcommunity.com/sharedfiles/filedetails/?id=148215278[/url]
What do you want us to do, since those addons are causing problems, not something yours
Hm... My assumption is that you registered an item incorrectly.
Line 80 is(the starting point of drawing the models):
[code]model, pos, ang = ITEM:ModifyClientsideModel(ply, model, pos, ang)[/code]
How to register an item is(keep note on the function 'ITEM:ModifyClientsideModel' and 'ITEM.Model'):
[code]ITEM.Name = 'Cone Hat'
ITEM.Price = 100
ITEM.Model = 'models/props_junk/TrafficCone001a.mdl'
ITEM.Attachment = 'eyes'
function ITEM:OnEquip(ply)
ply:PS_AddClientsideModel(self.ID)
end
function ITEM:OnHolster(ply)
ply:PS_RemoveClientsideModel(self.ID)
end
function ITEM:ModifyClientsideModel(ply, model, pos, ang)
model:SetModelScale(0.8, 0)
pos = pos + (ang:Forward() * -7) + (ang:Up() * 11)
ang:RotateAroundAxis(ang:Right(), 20)
return model, pos, ang
end[/code]
You're getting this error because model(ITEM.Model = " ") either doesn't exist(nil) or you've typed something incorrectly causing it to error(also resulting in a nil value). Never used PointShop, but that's just what I can get out its source. Go through each item and make sure you haven't accidentally messed with the item's function 'ITEM:ModifyClientsideModel' and/or that the item's value 'ITEM.Model' is correct. Hope this helps :smile:
That's the perfect explanation about what happend, but as op said it happens on workshop items, so there's no way to fix those errors or give him a solution to solve someone else problems
[QUOTE=gonzalolog;52397434]That's the perfect explanation about what happend, but as op said it happens on workshop items, so there's no way to fix those errors or give him a solution to solve someone else problems[/QUOTE]
Just curious, is there a reason workshop items are not working?
I took a look through both addons and neither have anything to do with pointshop. It's only the models.
So I'd follow the advice above and make sure the files you've made for the items are correct. If you haven't made any, then the problem is likely unrelated to these addons.
[QUOTE=JustThatGuy;52401641]I took a look through both addons and neither have anything to do with pointshop. It's only the models.
So I'd follow the advice above and make sure the files you've made for the items are correct. If you haven't made any, then the problem is likely unrelated to these addons.[/QUOTE]
But is it normal for that even if you have the addon put in the Addons folder and in the collection?
[QUOTE=SgtCheesepuff;52402669]But is it normal for that even if you have the addon put in the Addons folder and in the collection?[/QUOTE]
Even if I used ITEM.Model = 'asdfghasdjgfag' the model would be an ERROR and wouldn't cause script errors. Only thing that'd cause errors would be an incorrect item setup.
[QUOTE=Chisler;52406037]Even if I used ITEM.Model = 'asdfghasdjgfag' the model would be an ERROR and wouldn't cause script errors. Only thing that'd cause errors would be an incorrect item setup.[/QUOTE]
What do you mean? Because I have it set as ITEM.Model= 'path/to/model.mdl' so could that be wrong? And what do you mean incorrect item setup?
[QUOTE=SgtCheesepuff;52408642]What do you mean? Because I have it set as ITEM.Model= 'path/to/model.mdl' so could that be wrong? And what do you mean incorrect item setup?[/QUOTE]
If you're positive it isn't any of your items, Pastebin your 'DPointShopPreview.lua' file and let me take a look at it.
[QUOTE=Chisler;52409784]If you're positive it isn't any of your items, Pastebin your 'DPointShopPreview.lua' file and let me take a look at it.[/QUOTE]
Here is what I have:
[lua]
ITEM.Name = 'Bomberman'
ITEM.Price = 300
ITEM.Model = 'models/gmod_tower/bombermanhelmet.mdl'
ITEM.Attachment = 'eyes'
ITEM.AllowedUserGroups = { "donora", "donorb", "owner" }
function ITEM:OnEquip(ply, modifications)
ply:PS_AddClientsideModel(self.ID)
end
function ITEM:OnHolster(ply)
ply:PS_RemoveClientsideModel(self.ID)
end
function ITEM:ModifyClientsideModel(ply, model, pos, ang)
model:SetModelScale(1, 0)
pos = pos + (ang:Forward() * -2.6) + (ang:Up() * 1) + (ang:Right() * -0.2)
ang:RotateAroundAxis(ang:Forward(), -2.6)
ang:RotateAroundAxis(ang:Up(), 1)
ang:RotateAroundAxis(ang:Right(), -0.2)
return model, pos, ang
end
[/lua]
[lua]
ITEM.Name = 'Owl Mask'
ITEM.Price = 200
ITEM.Model = 'models/sal/owl.mdl'
ITEM.Attachment = 'eyes'
function ITEM:OnEquip(ply, modifications)
ply:PS_AddClientsideModel(self.ID)
end
function ITEM:OnHolster(ply)
ply:PS_RemoveClientsideModel(self.ID)
end
function ITEM:ModifyClientsideModel(ply, model, pos, ang)
model:SetModelScale(1.15, 0)
pos = pos + (ang:Forward() * -4) + (ang:Up() * -1) + (ang:Right() * 0)
return model, pos, ang
end
[/lua]
Sorry, you need to Log In to post a reply to this thread.