Restricting entities to certain jobs and donators
If you want to restrict entities to certain jobs, here is an example:
DarkRP.createEntity("Stove", {
ent = "cocaine_stove",
model = "models/craphead_scripts/the_cocaine_factory/stove/gas_stove.mdl",
price = 1500,
max = 2,
category = "Cocaine Factory",
cmd = "buystove",
allowed = {TEAM_DRUGGIE, TEAM_GANGSTER, TEAM_WHATEVER},
})
You can read more about customizing entities in the DarkRP Wiki (CustomEntityFields)
Here is another example of how to make an item only available for donators.
DarkRP.createEntity("Cooking Pot", {
ent = "cocaine_cooking_pot",
model = "models/craphead_scripts/the_cocaine_factory/utility/pot.mdl",
price = 50,
max = 10,
category = "Cocaine Factory",
cmd = "buypot",
customCheck = function(ply) return ply:GetUserGroup() == "donator" end,
CustomCheckFailMsg = function(ply, entTable) return "You need to be a donator to buy this entity!" end,
})
Hope this helps you!