Error with player models

Post Reply
Rynoskaf
New to forums
New to forums
Posts: 1
https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
Joined: Mon Sep 09, 2013 4:25 pm

Error with player models

Post by Rynoskaf »

I recently added a pointshop by _undefined and I am having trouble adding playermodels to the shop. I get this message in the logs:

[ERROR] addons/pointshop/lua/items/playermodels/kotonoha.lua:1: attempt to index global 'ITEM' (a nil value)
1. unknown - addons/pointshop/lua/items/playermodels/kotonoha.lua:1

Any idea's how to fix this?

This is in the lua file itself:

ITEM.Name = 'Kotonoha'
ITEM.Price = 250
ITEM.Model = 'models/player/KotonohaV2/models/kotonoha.mdl'

function ITEM:OnEquip(ply, modifications)
if not ply._OldModel then
ply._OldModel = ply:GetModel()
end

timer.Simple(1, function() ply:SetModel(self.Model) end)
end

function ITEM:OnHolster(ply)
if ply._OldModel then
ply:SetModel(ply._OldModel)
end
end
kArp
New to forums
New to forums
Posts: 9
Joined: Sun Sep 08, 2013 10:11 am

Re: Error with player models

Post by kArp »

This is my code I dont know if theres a difference but give it a try, it works for me.

Code: Select all

ITEM.Name = 'Corvo'
ITEM.Price = 250
ITEM.Model = 'models/player/corvo.mdl'

function ITEM:OnEquip(ply, modifications)
	if not ply._OldModel then
		ply._OldModel = ply:GetModel()
	end
	
	timer.Simple(1, function() ply:SetModel(self.Model) end)
end

function ITEM:OnHolster(ply)
	if ply._OldModel then
		ply:SetModel(ply._OldModel)
	end
end

function ITEM:PlayerSetModel(ply)
	ply:SetModel(self.Model)
end
Post Reply