Hey guys, I'm having an issue with the GetModel function currently as it isn't returning full model paths for custom models. The model it's returning is
[code] models/deadpool/deadpool.mdl [/code]
when it should be returning
[code] models/player/saintbaron/deadpool/deadpool.mdl [/code]
This is an issue I am receiving with the preview panel on the pointshop in DPointShopPreview.lua in the function below
[lua]
function PANEL:Init()
print("2 - Pre [self:SetModel(LocalPlayer():GetModel())]", tostring(LocalPlayer():GetModel())) --1st getmodel check
self:SetModel(LocalPlayer():GetModel())
print("3 - Post [self:SetModel(LocalPlayer():GetModel())]", LocalPlayer():GetModel()) --2nd getmodel check
local PrevMins, PrevMaxs = self.Entity:GetRenderBounds()
self:SetCamPos(PrevMins:Distance(PrevMaxs) * Vector(0.30, 0.30, 0.25) + Vector(0, 0, 15))
self:SetLookAt((PrevMaxs + PrevMins) / 2)
end[/lua]
As you can see on this screenshot - [url]http://prntscr.com/gczh5m[/url] - the model is on the server (it appears fine in the item panel) but when the player has this model equipped and the function tries to get the player's model, it returns a broken/shortened path. You can also find the deadpool item's lua file below to show that the correct path is in the file.
[lua]ITEM.Name = 'Deadpool'
ITEM.Price = 380000
ITEM.Model = 'models/player/saintbaron/deadpool/deadpool.mdl'
function ITEM:OnEquip(ply, modifications)
if not ply._OldModel then
ply._OldModel = ply:GetModel()
end
if modifications.color ~= nil then
borkolor = modifications.color
ply:SetPlayerColor(Vector( borkolor.r / 255, borkolor.g / 255, borkolor.b / 255))
end
print("4 ", self.Model)
timer.Simple(1, function() ply:SetModel(self.Model) end)
end
function ITEM:OnHolster(ply)
if ply._OldModel then
ply:SetModel(ply._OldModel)
ply:SetPlayerColor(Vector(0.24, 0.34, 0.41))
end
end
function ITEM:PlayerSetModel(ply)
ply:SetModel(self.Model)
end
function ITEM:Modify(modifications)
PS:ShowColorChooser(self, modifications)
end
function ITEM:OnModify(ply, modifications)
self:OnHolster(ply)
self:OnEquip(ply, modifications)
end[/lua]
Sorry, you need to Log In to post a reply to this thread.