Features

Services

The business directory, company lines, landlines, the staff inbox and the Line Panel.

The Services app is the city's business directory. Players find a company, call it or message it. The calls and messages do not go to one person: they go to the company's line, and whoever works there and is on duty answers.

Part What it is
Directory Every company, how many of its staff are on duty, and buttons to call, message or get directions
Company line A call to a company rings every worker who can take it. The first to answer gets the call
Landline A short number per company. Dialling it from the keypad rings the line
Inbox Customer messages to the company, read and answered by the staff on duty
Line Panel For staff: the landline, who is on the line right now, and the call log

Companies come from Config.Companies, the line's behaviour from Config.Services.

#For the customer

The Directory tab lists the companies in four groups: Police, Medical & Fire, Mechanics and Other Services. The group, and the card's colour, come from the company's category ('police', 'ems', 'mechanic' or 'other'). A company without a category is sorted by the start of its job name (police, sheriff, lspd ... go under Police; ambulance, ems, fire ... under Medical & Fire; mechanic, bennys, tow ... under Mechanics). Everything else is Other Services.

A job marked hidden = true has no card of its own. It answers the card of its group instead (see Groups and hidden jobs).

Each company shows "N on duty", or "Passive · nobody on duty" when nobody is there. Its page has:

  • Call: rings the company line. The button only works while at least one worker accepts calls.
  • Message: opens a chat with the company. Messages reach whoever is on duty, now or later.
  • Directions / Set Waypoint: when the company has a location.
  • Landline: the company's number, which can also be dialled from the keypad.

The caller never sees the phone number of the worker who answers. They see the company's name and its landline. The company, on the other hand, always sees the caller's number: Hide Number does not apply to company lines.

#For the staff

A player whose job is a company sees a second tab, Inbox, with two switches:

Switch Default What it does
Active (On Duty) on Off: the line skips this worker for calls and messages ("Passive")
Receive Company Calls on Off: the worker still gets messages, but the line does not ring their phone

These switches are the phone's own and are kept per character. They sit on top of the framework's duty: with PreferOnDuty = true (the default) a worker must be on duty in the framework and Active on the phone to be on the line.

The Inbox lists the company's customer chats next to the worker's own personal Services chats. A reply goes out in the company's name, not from the worker's number.

#Who the line rings

When a call comes in, the server builds the list of workers to ring. A worker is rung when all of this is true:

  • Their job is the company, or a job in the same group (see below).
  • Their grade is in the company's callGrades, or the company has no callGrades.
  • They are Active and have Receive Company Calls on.
  • They are on duty in the framework (only with PreferOnDuty = true).
  • They are not in another call, not in airplane mode and have signal.
  • They are not the caller.

With RingAll = true (the default) every worker on the list rings at once, up to MaxRing phones. The first to answer gets the call and the others stop ringing. With RingAll = false one worker rings at a time: the server picks one, prefers the exact job over the rest of its group, and takes turns so the same person does not get every call.

With PreferOnDuty = false duty is ignored, but workers who are on duty are still rung first. Off-duty workers only ring when nobody on duty can take the call.

A worker with Do Not Disturb or silent mode on still sees the call, it just does not play a ringtone.

#When nobody answers

  • The call rings for CallTimeout seconds, then counts as missed.
  • With NotifyMissed = true every worker it rang gets a notification "Missed line call: {number}". Tapping it opens the Line Panel.
  • If everyone it rang declines, the call ends as declined and no missed notification is sent.
  • If nobody can be rung at all, the caller hears "Nobody from this company can take your call right now." The attempt is still written into the call log as Nobody was on duty.
  • Company lines have no voicemail.

#Groups and hidden jobs

Jobs with the same group value answer the same line and share its call log. A call to any of them rings the workers of all of them. The exact job is only preferred when RingAll = false.

The usual use is one card for several departments. Give every department the same group, show one of them as the card, and mark the others hidden = true:

lua{ job = 'police', label = 'Police', icon = 'shield-check', category = 'police', group = 'police',
    location = { name = 'Mission Row', x = 441.2, y = -978.5, z = 30.7 } },
{ job = 'sheriff', group = 'police', category = 'police', hidden = true },
{ job = 'statepolice', group = 'police', category = 'police', hidden = true },

The directory then shows one Police card. Calling it rings every on-duty officer of the three jobs. A hidden job:

  • has no card of its own,
  • uses the card's landline: its workers see that number and the card's name in their Line Panel, and call back with it. A number set on a hidden entry is ignored while the card has a landline,
  • still needs its own callGrades if only some grades should take calls.

A new department only needs one more hidden line with the same group.

#Landlines

Every company that takes calls gets a landline (Landlines.Enabled = true). It is:

  • the number you set on the company in Config.Companies, or
  • Prefix followed by Digits digits made from the job name, for example 44 + 317.

A generated number is made from the job name, so it stays the same across restarts. If two jobs land on the same digits, the second one takes the next free number.

Dialling a landline from the keypad rings the line, exactly like the Call button. If a player happens to own the same number, the call goes to the player instead. Keep the landline length different from player numbers (Config.Number.Length, default 7) so the two never meet.

EmergencyNumbers in Config.Sim (911, 912) also ring a company line, and work without a SIM and without signal. See SIM cards.

#Line Panel and call log

Staff open the Line Panel from the Inbox tab. It shows:

  • The line's landline. "Callers only see this number and the company name."
  • Answered (24 h), Missed (24 h) and Active staff. Missed counts every incoming call that was not answered, declined and unstaffed ones included.
  • Staff on the Line: every colleague whose phone is on, with their state: Ready, On a call, Calls off or Passive.
  • Call Log: the last 60 calls of the line, filter All or Missed. Each row shows the number, the name it is registered to, who answered and how long it lasted. Outgoing calls made as the line show who made them.

From a log row a worker can Call Back as the Line: the person sees the company and its landline, not the worker's own number. Copy Number copies it.

Who may open the panel: anyone with the job whose grade is in callGrades and at least CallLog.MinGrade. Duty does not matter here, so last night's missed calls can be read in the morning.

The name next to a number is the SIM's registered owner when Config.Sim.Enabled = true (a prepaid SIM shows no name), otherwise the character that owns the number. Calls are deleted after CallLog.Days days.

#Companies (Config.Companies)

luaConfig.Companies = {
    AutoAddJobs = true,
    SkipJobs = { 'unemployed', 'cartel', 'gang' },   -- jobs that must never be reachable by phone

    { job = 'police', label = 'Police', icon = 'shield-check', category = 'police', group = 'police',
        location = { name = 'Mission Row', x = 441.2, y = -978.5, z = 30.7 } },
    { job = 'sheriff', group = 'police', category = 'police', hidden = true },

    { job = 'ambulance', label = 'Ambulance', icon = 'heart', category = 'ems',
        location = { name = 'Pillbox Hill', x = 312.9, y = -594.0, z = 43.3 } },

    { job = 'burger', label = 'Burger Shot', icon = 'fork-knife', callGrades = { 0, 1, 2, 3, 4, 5 } },
}

The shipped config.lua holds a full example list. Replace it with your own jobs.

Field Default What it changes
AutoAddJobs true Every framework job not listed is added as a plain card with its own label. It gets a landline but no location, group or category
SkipJobs 'unemployed' and a list of illegal jobs Jobs never added automatically. Put every job here that must not be reachable by phone: gangs, illegal organisations, hidden roles
job Framework job name
label job label Name in the directory and on the caller's screen
icon category icon Icon name from the phone's icon set: shield-check, heart, wrench, briefcase, car, house, fork-knife, storefront, newspaper, megaphone, bank, money, coins, credit-card, shopping-bag, handshake, music-notes, game-controller, television, camera, flame, lightning, drop, tag, globe, airplane, phone, detective, crown. Any other name shows the category's icon
category from the job name 'police', 'ems', 'mechanic' or 'other': the directory group and the card's colour. Set it when the job name does not say it (for example a department called mrpd)
location none { name, x, y, z }. Adds Directions and Set Waypoint
callGrades every grade Grades that receive calls and messages and may open the Line Panel
group none Jobs with the same group answer the same line and share its call log
hidden false true: no card of its own. The job answers its group's card and uses that card's landline
canCall true false hides the Call button. The company then gets no landline and cannot be rung
canMessage true false hides the Message button
number generated The company's own landline, digits only, e.g. '155'. Ignored on a hidden entry whose card has a landline

SkipJobs only stops jobs from being added automatically. A job you list yourself in Config.Companies is always shown.

#Line options (Config.Services)

Option Default What it changes
CallTimeout 30 Seconds a company call rings before it counts as missed
PreferOnDuty true true: only workers on duty in the framework get calls and messages. false: duty is ignored, on-duty workers are rung first
RingAll true true: every worker rings at once, first to answer takes it. false: one at a time, taking turns
MaxRing 16 Most phones that ring for one call
NotifyMissed true Workers rung for a missed call get a notification with the caller's number
Landlines.Enabled true Companies get a landline
Landlines.Prefix '44' Digits in front of a generated landline
Landlines.Digits 3 Digits after the prefix (2 to 6)
CallLog.Enabled true The Line Panel's call log
CallLog.Days 14 Days a call stays in the log
CallLog.ShowName true Show the registered name next to a number. false: number only
CallLog.MinGrade nil Lowest grade that may read the log. nil: everyone who takes calls

#Setting it up

  1. Replace the example list in Config.Companies with your own jobs: a label, an icon, a category and a location for the ones you care about. The rest are added automatically while AutoAddJobs = true.
  2. Put every illegal or secret job in SkipJobs, or it shows up in the directory as a plain card.
  3. Group departments that should share one card: same group, and hidden = true on all but the card.
  4. Make sure your duty system works. On QBCore and Qbox the phone reads the job's onduty. On ESX a job counts as on duty unless the job says otherwise. If your server has no duty system, set PreferOnDuty = false.
  5. Give important companies a short number of their own, or leave the generated landlines.

#For scripts

GetOnDutyWorkers(job) returns the players currently answering a company's line (its group included). SendCompanyMessage(job, fromNumber, text) writes into a company's inbox as if a customer sent it. Both are on Server exports: messages.

#Good to know

  • "Nobody from this company can take your call" although staff are online: check that they are on duty in the framework, Active in the Services app, have Receive Company Calls on, are in callGrades, are not already in a call and have signal.
  • Another job's phones ring for this company's call. The two jobs share a group. Give them different groups, or remove group.
  • A job is missing from the directory. It is in SkipJobs, it has hidden = true, or AutoAddJobs = false and it is not listed.
  • A gang shows up in the directory. AutoAddJobs added it. Put the job in SkipJobs.
  • A department sits under Other Services. Its job name does not start with a known word. Set its category.
  • A company has no landline. It has canCall = false, or Landlines.Enabled = false and no number of its own.
  • Dialling a landline rings a player. A player owns that number. Give the company a number of a different length.
  • A card shows a briefcase instead of its icon. The icon name is not in the phone's icon set (see the table above), so the category's icon is used.
  • The directory and on-duty counts refresh at most every 10 seconds.
  • Company chats are deleted with the other messages after Config.Retention.messages days.