Custom check if player is a certain DarkRP job?

Hello, I have recently implemented a Shop NPC in my server, although I only want Police officers and SWAT team members to be able to purchase from the NPC. Any ideas on how to make something like this happen?
Any help would be appreciated, thank you!

implemented as in?
coded? bought?

either way, you can do something like



local jobs = { TEAM_BLA };

function ENT:Use( _p )
    if( !table.HasValue( jobs, _p:Team() ) ) then
        _p:ChatPrint( "Incorrect job" );
        return;
    end
    // code 
end


You can also check using the :IsCP() function, I’m pretty sure that’s it either that or :IsPolice()

Isn’t that function strictly for DarkRP codes?

Another way to check a player’s job is to use ply:getDarkRPVar(“jobs”). Be sure that ply is defined. It is also a shared function so you can use it on both client and server sidehttp://wiki.darkrp.com/index.php/Functions/Player/Shared/getDarkRPVar.

Forgot to mention that it returns a string. Don’t use TEAM_ETC, rather “Police”