Entity Blacklist

I understand that entities have different variables such as the allowed one to set a entity to only a certain job/class. Is there a way to flip this like for example, not allowed jobs.

DarkRP.createEntity( “Printer”, {
ent = “printer_ent”,
model = “model/printer.lol”,
price = 1337,
max = 666,
cmd = “buythisthingy”,
notallowed = governmentteams --<— EXAMPLE
} )

I would like everyone to be able to purchase a printer except 2-3 teams i can specify if that is possible. my question is there a way to do this i know “notallowed” is not a variable.

I don’t believe there’s a field by default that has that functionality. Although, you can use the hook canBuyCustomEntity to compare the player’s current job and prevent purchasing of the custom entity.

Is it possible if you could give me a example im not sure how to use that hook.



local jobs = table.GetKeys( RPExtraTeams )
local function CopyAndExclude( src, toexclude )
    src = table.Copy( src )

    for k,v in ipairs( toexclude ) do
        table.RemoveByValue( src, v ) -- slow but who cares
    end
end

DarkRP.createEntity( "Printer", {
    ent = "printer_ent",
    model = "model/printer.lol",
    price = 1337,
    max = 666,
    cmd = "buythisthingy",
    allowed = CopyAndExclude( jobs, {TEAM_POLICE, TEAM_ANOTHER_BLACKLISTED_TEAM} ), --<--- HERE IT IS THE MOST IMPORTANT LINE IN YOUR LIFE WITH FANCY ARROW INCLUDED
} )

If this works i wont be able to thank you enough ill restart my server tommarrow because it is to late today. Thank you so much