API Reference
Server exports provided by oxide-newspaperjob — IsOnShift, GetSetting, SetSetting, GetInfo, GetShift, GetProgression and SetUpdateHandler — with integration examples.
Reference for developers integrating another resource with oxide-newspaperjob. Everything here is a server-side export; there are no client exports. If you just run the resource as a server owner, you don't need anything on this page.
Guard your calls
Check GetResourceState('oxide-newspaperjob') == 'started' before calling an export, so your resource still works when this job isn't installed.
Server Exports
All exports are called on the server.
| Export | Returns | What it does |
|---|---|---|
IsOnShift(source) | boolean | Whether a player is on a newspaper delivery shift right now |
GetSetting(key) | any | Reads one database-backed setting |
SetSetting(key, value) | boolean | Changes one setting live, and saves it |
GetInfo() | table | The depots, whether each has room, and the base pay. Read-only |
GetShift(source) | table|false | A player's shift as the job holds it now. Read-only |
GetProgression(source) | table|false | A player's level with this job. Read-only |
SetUpdateHandler(handler) | boolean | Lets another resource, such as a phone app, show this job's shift updates itself |
IsOnShift
Tells you whether a player is currently on a newspaper delivery shift. Use it to stop a player from starting another job while they're already working this one.
local onShift = exports['oxide-newspaperjob']:IsOnShift(source)Parameters:
| Name | Type | Description |
|---|---|---|
source | number | The player's server id |
Returns: boolean — true from the moment the player clocks in until the shift ends, whether they clock out, log out or disconnect. false otherwise, including for an id that isn't a player.
GetSetting
Reads one of the resource's database-backed settings, keyed by the setting name without the Config. prefix.
local maxSlots = exports['oxide-newspaperjob']:GetSetting('MaxSlotsPerLocation')Parameters: key (string) — the setting name.
Returns: any — the current value.
SetSetting
Changes one of the resource's settings.
local ok = exports['oxide-newspaperjob']:SetSetting('uniformsEnabled', true)Parameters: key (string), value (any) — the setting name and its new value.
Returns: boolean — true when the change was applied. The change is live: the server uses it right away, it saves to the database, and it syncs to clients. It persists across restarts.
Returns false if the resource hasn't finished loading its settings yet, or if the value can't be stored (for example, a number that isn't finite).
SetSetting does not check permissions — only the in-game /newspaper settings editor is admin-gated. If your resource calls it on behalf of a player, do your own permission check first.
See How Settings Work for how database-backed settings behave.
GetInfo
The depots, whether each one has room for another worker, and the base pay. Read-only.
local info = exports['oxide-newspaperjob']:GetInfo()Returns: table — with these fields:
| Field | Type | Description |
|---|---|---|
locations | table[] | One entry per depot: name (string), coords (vector3) and open (boolean — false while the depot has as many workers as it takes) |
basePay | table | min and max — the base pay per house before bonuses |
crew | boolean | Always false — the job is worked alone |
GetShift
A player's shift as the job holds it right now. Read-only.
local shift = exports['oxide-newspaperjob']:GetShift(source)Parameters: source (number) — the player's server id.
Returns: table|false — false when the player is not on a shift; otherwise a table with these fields:
| Field | Type | Description |
|---|---|---|
location | string | The depot the shift started at |
role | string | Always solo |
stage | string | working while on a route, restock between routes (back to the depot for a new route) |
task | string or nil | The next house on the route; nil otherwise |
done, total | number | Houses done and houses on the current route (0, 0 between routes) |
jobs | number | Houses paid for this shift so far |
earned | number | Pay earned so far, before the deductions taken at clock-out. Tips are not included |
tips | number | Tips paid in cash so far this shift |
GetProgression
A player's level with this job. Read-only: a character who has never worked the job reads as level 1, and no record is created.
local progression = exports['oxide-newspaperjob']:GetProgression(source)Parameters: source (number) — the player's server id.
Returns: table|false — false when the player has no character; otherwise a table with these fields:
| Field | Description |
|---|---|
level, title | The player's current level and its title |
count | Houses delivered in total |
streak | Days in a row |
prevAt, nextAt | The house counts where this level starts and where the next one begins (nextAt is nil at the top level) |
nextTitle | The title of the next level |
timedOut | Whether the player is suspended after complaints |
timeoutRemaining | Seconds left on the suspension |
SetUpdateHandler
Lets another resource, such as a phone app, show this job's shift updates itself. The updates are the messages the job sends to the player's phone when usePhone is on.
While a handler is set and its resource is running, each update goes to the handler first. When the handler returns true, the job sends nothing else; when it returns anything else or fails, the job sends the update as usual. There is one handler at a time: setting one replaces the last.
exports['oxide-newspaperjob']:SetUpdateHandler(function(source, update)
-- update.title: the sender, for example "Daily Courier - Los Santos Meteor"
-- update.message: the message
-- update.summary: { jobs, net } on the pay summary, sent when a shift ends on a clock-out,
-- a deleted depot or a restart (never on a disconnect, a logout or going down)
return true -- shown; the job sends nothing else
end)Parameters: handler (function or nil) — called as handler(source, update). Passing nil removes the handler your resource set; it is also removed when your resource stops.
Returns: boolean — true, or false when nil would remove another resource's handler (that handler stays).
Integration Examples
Stop a player from working two jobs at once
Check before your own job lets the player clock in:
RegisterNetEvent('my-job:server:clockIn', function()
local src = source
if GetResourceState('oxide-newspaperjob') == 'started'
and exports['oxide-newspaperjob']:IsOnShift(src) then
-- tell the player to finish their newspaper delivery shift first
return
end
-- start your job
end)Check every gig job at once
The same IsOnShift(source) export exists on oxide-postaljob (GoPostal), oxide-pizzajob (Pizza Job), oxide-landscapingjob (Landscaping), oxide-roadsideassistancejob (Roadside Assistance), oxide-animalcontroljob (Animal Control) and oxide-newspaperjob. Skip any you don't run:
local GIG_JOBS = {
'oxide-postaljob',
'oxide-pizzajob',
'oxide-landscapingjob',
'oxide-roadsideassistancejob',
'oxide-animalcontroljob',
'oxide-newspaperjob',
}
local function isOnGigShift(src)
for _, resource in ipairs(GIG_JOBS) do
if GetResourceState(resource) == 'started' and exports[resource]:IsOnShift(src) then
return true
end
end
return false
endNext Steps
Admin & Developer Tools
Admin commands, the /newspaper settings editor, the depot builder, and managing player records in oxide-newspaperjob.
Troubleshooting Guide
Common oxide-newspaperjob problems and fixes — clocking in, routes and cancelling, throws, the newspaper item, the bike, pay, settings, missing models, the UI, and phone messages.