How do I restrict entities for RP

Hey guys I am fooling around with trying to restrict the a VIP printer from a normal user to use. But here is the catch, I want users to be able to buy 2 printers and VIP be able to buy 3 printers of the exact same printer. Any idea how to do that?

DarkRP?

yes its Darkrp

You do a customCheck function, eg. below




AddEntity("Black Money Printer", {
	ent = "money_black_printer",
	model = "models/props_lab/reciever01a.mdl",
	price = 15000,
	max = 1,
	cmd = "/buyprinter",
	nil,                -- Make sure you add that comma
	customCheck = function(ply) return            -- You use a customcheck function.
		ply:GetUserGroup() == "VIP"
	end,
	CustomCheckFailMsg = "You need to be a VIP to access this."


If you read his post, he wants max to be 3 for VIP and 2 for non VIP.

oh, did not read that correctly… lawl :v:

Try something like



max = function(ply)
    if ply:GetUserGroup() == "VIP" then
        return 3
    else 
        return 2
    end
end,


Might work, might not, just pulled it out of my ass.

I actually came up with something like this making the function max but it did not work, so I am going to try your wayout. haha Thanks for t he respond dude!

SLoved it! lel,

This is what you need to do…



 max = function(ply) return p end,
    customCheck = function(ply) if ply:GetUserGroup() == "vip" then
    p = 3 
	else
    p = 2
    end