NX Playerlist
Roles & Job Counts
Set up the staff, police and EMS counters and badges.
Roles do two things: they power the live counters in the header (e.g. "3 Staff · 5 Police · 2 EMS") and they add coloured badges on player profiles. A player can have several roles at once.
Defining roles
config.lua
Config.OnDutyOnly = true
Config.Roles = {
{ id = 'staff', label = 'Staff', icon = 'fa-solid fa-user-shield', color = '#8b5cf6', groups = { 'admin', 'superadmin', 'mod' } },
{ id = 'police', label = 'Police', icon = 'fa-solid fa-handcuffs', color = '#3b82f6', jobs = { 'police', 'sheriff' } },
{ id = 'ems', label = 'EMS', icon = 'fa-solid fa-truck-medical', color = '#ef4444', jobs = { 'ambulance' } },
}idstringA unique name for the role. Must be different for every role.
labelstringText shown on the counter and badge.
iconstringFont Awesome 6 icon class.
colorhexBadge and counter colour.
groupstableESX permission groups (from
users.group), such as admin. Players in these groups always count, whatever job they have.jobstableESX job names (not labels), such as
police or ambulance. Check your jobs table if you're unsure.A role can use groups, jobs or both.
On-duty counting
Config.OnDutyOnlybooleandefault: trueWhen
true, players only count towards job roles while they're on duty. When false, everyone with the job counts.On-duty status comes from ESX's built-in job.onDuty. If your server doesn't use ESX duty (some servers use off-duty jobs like offpolice instead), players count as on duty. In that case, just list only the on-duty job names.
groups ignore duty. Staff always count.
Examples
Adding mechanics
config.lua
{ id = 'mechanic', label = 'Mechanic', icon = 'fa-solid fa-wrench', color = '#f59e0b', jobs = { 'mechanic', 'bennys' } },Separate admin and moderator counters
config.lua
{ id = 'admin', label = 'Admins', icon = 'fa-solid fa-crown', color = '#f43f5e', groups = { 'superadmin', 'admin' } },
{ id = 'mod', label = 'Mods', icon = 'fa-solid fa-user-shield', color = '#8b5cf6', groups = { 'mod' } },Hiding all counters
config.lua
Config.Roles = {}