Pointshop health boosts

I have a deathrun server and i am looking for a health/speed/jump boost perk that will only allow you to buy it if you have the previous one if someone could give
me the code for one of them i would be able to make the others myself

this is my current one it doesnt work though.


ITEM.Name = 'Health Boost 2'
ITEM.Price = 1
ITEM.Material = '/AG/health2.png'
ITEM.NoPreview = true

function ITEM:OnBuy(ply)
	if not ply:PS_HasItem(hp1) then
	ply:SendLua([[chat.AddText(Color(0,0,200), "You need Health Boost 1 to purchase this item!")]])
	else return false end
end

function ITEM:OnEquip(ply)
	if ply:PS_HasItem(hp1) then
		ply:SetHealth(150)
	else
		ply:SendLua([[chat.AddText(Color(0,0,200), "You need Health Boost 1 to Equip this item!")]])
		ply:SetHealth(100)
	end
end

function ITEM:OnHolster(ply)
	ply:SetHealth(100)
end

Is there an error or anything when you buy health boost 2?

What happens with the one i gave you is that you can buy it without owning 1

[editline]30th November 2013[/editline]

Bump

your onbuy func looks a little weird, and honestly I have a feeling it’s related to that so

[lua]function ITEM:OnBuy(ply)
if ply:PS_HasItem(hp1) then
return true
else
ply:SendLua([[chat.AddText(Color(0,0,200), “You need Health Boost 1 to purchase this item!”)]])
return false
end[/lua]

Isn’t there a PS_CanBuy() function somewhere?

Thanks, would you happen to know if theres a

ply:TakeHealth(25)
to prevent health glitching?