[TTT] Pointshop Exclusive Items

Well, I’ve started my TTT server and put the Pointshop. I have added a new item and I want it only from VIPs members. I put the ITEM.AllowUserGroups property to let VIPs to buy it. But my question is: Is possible to restrict the model only if you are VIP? I want to say, if you aren’t VIP but you were and now want to use it, it’s possible restrict the model ONLY if you are actually VIP?

What are you asking? The model is already restricted to only VIPs with ITEM.AllowedUserGroups.

I think he means that because if you are the group, you can purchase it, but then your VIP wears out and you can still use it. Am I right, or wrong OP?

If right, you can go under OnEquip and detect if they are the group. If not, don’t allow it.

U r right Nookyava, can u put the exactly code to restrict the use when the Vip wears out??

Post the Pointshop code of one of your VIP items.

That’s the entire code for one of my Pointshop VIP Items


ITEM.Name = 'Altair Oscuro'
ITEM.Price = 4500
ITEM.Model = 'Models/player/assassinsCreed/altair_pmodel.mdl'
ITEM.AllowedUserGroups = { "admin", "Vip", "superadmin" }

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

Bump

There was a new commit recently which added ITEM.CanPLayerEquip and ITEM.CanPlayerHolster (https://github.com/adamdburton/pointshop/commit/9e6e28371de02446ba1b297b6017413359307b6b) maybe this is what you need?

Well, I’m not sure because with this function, I’m able to let users holster or not, but it let me restrict items for user groups?? For I read on that commit, I’m not sure that’s possible. With it you can restrict to an user to holster or not an item, but not a group. I’m asking for the

solution but I don’t know to execute him.

I think you’re looking for something like this.


ITEM.Name = 'Health Boost'
ITEM.Price = 0
ITEM.Material = ''
ITEM.AllowedUserGroups = { "vip" }

function ITEM:OnEquip(ply, modifications)
	local access = false
	for i=1,#self.AllowedUserGroups do
		if ply:GetUserGroup() == self.AllowedUserGroups* then
			access = true
		end
	end
	if access == false then ply:ChatPrint("You must be vip to use this item!") ply:PS_HolsterItem(self.ID) end
end

I tried dat code on my server with my models and it shows the skin like an error black and pink mall.

It’s example code; he didn’t put in any materials or models.

Just add the example code to the beginning of the LUA that you add to the item on the server, it then does check if it is in the required group before doing the function completely.

That’s the code i’m using. What’s wrong?


ITEM.Name = 'Altair Oscuro'
ITEM.Price = 4500
ITEM.Model = 'Models/player/assassinsCreed/altair_pmodel.mdl'
ITEM.AllowedUserGroups = { "admin", "Vip", "superadmin" }

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

        local access = false
	for i=1,#self.AllowedUserGroups do
		if ply:GetUserGroup() == self.AllowedUserGroups* then
			access = true
		end
	end
	if access == false then ply:ChatPrint("You must be vip to use this item!") ply:PS_HolsterItem(self.ID) end
end

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

Try this


ITEM.Name = 'Altair Oscuro'
ITEM.Price = 4500
ITEM.Model = 'Models/player/assassinsCreed/altair_pmodel.mdl'
ITEM.AllowedUserGroups = { "admin", "Vip", "superadmin" }

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

	local access = false
	for i=1,#self.AllowedUserGroups do
		if ply:GetUserGroup() == self.AllowedUserGroups* then
			access = true
		end
	end
	if access == false then ply:ChatPrint("You must be vip to use this item!") ply:PS_HolsterItem(self.ID) end
end

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

Only use this code for the model you posted for now.

Now the skin is functional but, the users who has the Vip wears out may to use the skin… I dont know why because with this function, we are restricting the use only for Vips, or not??

If only users who’s VIP status has worn out can use this, then that means it’s an issue with your admin mod. Can a normal user who’s never had VIP use it?