Badges
Server exports to read and assign service numbers, and to list every badge issued for a job.
The jobName argument
jobName is optional on the two player-scoped exports leave it out to use the player's current job
(primary slot first, then second).
getPlayerBadge
A player's badge for a job.
local badge, err = exports['hex_jobscreator']:getPlayerBadge(5)Prop
Type
Returns
| Value | Meaning |
|---|---|
| string | the badge |
nil, reason | invalid_player · player_not_found · no_job · no_badge |
setPlayerBadge
Assigns a badge to a player.
Badge format
Badges are up to four digits with an optional single leading letter (102, A102). Pass an empty
string to clear. Badges are unique per job.
local ok, err = exports['hex_jobscreator']:setPlayerBadge(5, 'A102')Prop
Type
Returns
| Value | Meaning |
|---|---|
true | badge saved |
false, reason | see the reasons below |
Reasons
| Code | Meaning |
|---|---|
invalid_player | player id must be a number |
player_not_found | no such player on the server |
no_job | the player has no job |
badge_taken | another member of that job holds that badge |
invalid_badge | badge format is wrong (up to four digits, one optional leading letter) |
getJobBadges
Every badge issued for a job.
local badges, err = exports['hex_jobscreator']:getJobBadges('police')Prop
Type
Returns
| Value | Meaning |
|---|---|
| table | the badges, shape below |
table, 'no_badges' | no badges have been issued for that job |
nil, 'invalid_job' | job name must be a non-empty string |
{ { identifier = 'char1:abc...', badge = 'A102' }, ... }