Pointshop items only show for specific job.

Hey, I was wondering how I can take pointshop items that follow this format only show/appear if they’re a specific job:



ITEM.Name = 'name'
ITEM.Price = number
ITEM.Model = 'model'

function ITEM:OnBuy(ply)
    if ( ply:Team() ~= "TEAM_CITIZEN" )
       return false
    end
end

function ITEM:OnEquip(ply, modifications)
	ply:PS_AddClientsideModel(self.ID)
end

function ITEM:OnHolster(ply)
	ply:PS_RemoveClientsideModel(self.ID)
end

function ITEM:ModifyClientsideModel(ply, model, pos, ang)
--stuff
end


Let’s say the person is TEAM_CITIZEN but changes to TEAM_POLICE. How can I make his items disappear until he is TEAM_CITIZEN again?

Thanks.

Team() returns the ID of the team. GetName is what you are looking for. http://wiki.garrysmod.com/page/team/GetName

Point shop in darkrp is the dumbest idea ever.
Also, don’t so what smithy said, all you need to do is remove the quotes, since TEAM_CITIZEN is an ENUM.

in the ITEM:OnEquip before the ply:PS_AddClientsideModel(self.ID)
put
[lua]if not (ply:Team() == TEAM_CITIZEN) then return false end[/lua]

[lua]
function ITEM:CanPlayerBuy(ply)
return ply:Team() == TEAM_CITIZEN
end
[/lua]

Unfortunately when I change jobs the item still stays, could I just add a timer to it?