Coding Donator Player Models Help?

You know the feature in PointShop where the headcrab hat is only to Admin
How can I do that to player models for different types of donators. (ULX Made Groups)

Like Bronze gets Captain American Player Model
If you donate to silver you get Captain American, V, and Slimer
Gold…
and so on…

So pretty much how do you add stuff to donators only and each someone donates they keep the bronze items and thery get a new player model.

Sorry if this is confusing if you need anymore information please let me know.

You can do something as easy as this:

[lua]ITEM.Name = ‘Alyx’
ITEM.Price = 570
ITEM.Model = ‘models/player/alyx.mdl’
ITEM.AllowedUserGroups = { “admin”, “vip” }

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 [/lua]

After you do that, you can go to the “sv_player_extension.lua” file and scroll down to line 182. You will see this:
[lua] if ITEM.AllowedUserGroups and #ITEM.AllowedUserGroups > 0 then
if not table.HasValue(ITEM.AllowedUserGroups, self:PS_GetUsergroup()) then
self:PS_Notify(‘You’re not in the right group to buy this item!’)
return false
end
end

local cat_name = ITEM.Category
local CATEGORY = PS:FindCategoryByName(cat_name)

if CATEGORY.AllowedUserGroups and #CATEGORY.AllowedUserGroups > 0 then
	if not table.HasValue(CATEGORY.AllowedUserGroups, self:PS_GetUsergroup()) then
		self:PS_Notify('You\'re not in the right group to buy this item!')
		return false
	end
end [/lua]

You could change the text to something like: [lua] if ITEM.AllowedUserGroups and #ITEM.AllowedUserGroups > 0 then
if not table.HasValue(ITEM.AllowedUserGroups, self:PS_GetUsergroup()) then
self:PS_Notify(‘You need to be a Donator to buy this item!’)
return false
end
end

local cat_name = ITEM.Category
local CATEGORY = PS:FindCategoryByName(cat_name)

if CATEGORY.AllowedUserGroups and #CATEGORY.AllowedUserGroups > 0 then
	if not table.HasValue(CATEGORY.AllowedUserGroups, self:PS_GetUsergroup()) then
		self:PS_Notify('You need to be a Donator to buy this item!'')
		return false
	end
end [/lua]

I hope this helps! :smile:

I really appreciate it thanks for the help. :smiley:

No problem :slight_smile: