Exports ​
All money, item and ownership checks happen on the server. Server exports are trusted callers, so they skip checks like the image host allow-list.
Core ​
server
| Export | Returns | Description |
|---|---|---|
notify(src, n) |
boolean |
Notification for one player: { app, title, body, icon?, data?, sound? } |
notifyNumber(number, n) |
boolean |
Same, for whoever holds that number. false if nobody online has it |
notifyAll(n) |
count | Every player with a loaded phone |
push(src, event, data) |
boolean |
Raw push to a player's NUI. event = '<area>:<event>' |
pushAll(event, data) |
boolean |
Broadcast push |
getNumber(src) |
'555-0142' | nil |
|
getNumberByIdentifier(identifier) |
number | Created on first use |
getSourceByNumber(number) |
src | nil |
|
getIdentifierByNumber(number) |
identifier | nil |
|
close(src) |
Close a player's phone (for example, when a script cuffs them) | |
setBlocked(src, state, reason) |
boolean |
Block the phone (state = true: it cannot be opened, its calls and messages are refused, callers get unreachable) or lift the block. Blocks are kept per calling resource and reason; the phone stays blocked while any block is set, and a resource's blocks are lifted when it stops. np_prison uses reason = 'jail', np_minigames reason = 'minigame' while a game runs |
isBlocked(src) |
boolean |
|
getBlockReasons(src) |
{ 'resource:reason', … } |
|
registerStoreApp(entry) |
boolean |
Add or replace an App Store entry (see below) |
Notification fields ​
| Field | Notes |
|---|---|
app |
App id (≤ 32), default 'system'. Tapping the notification opens this app |
title / body |
≤ 120 / ≤ 600 characters |
icon |
Optional Font Awesome class |
data |
Table passed to the app as deep-link params when the notification is tapped |
sound |
Default true |
exports.np_phone:notify(src, { app = 'mail', title = 'Bank', body = 'Your loan was approved.' })
exports.np_phone:notifyNumber('555-0142', { app = 'messages', title = 'Tony C.', body = 'Where are you?' })
App Store ​
exports.np_phone:registerStoreApp({
id = 'racing', name = 'Racing', icon = 'fa-solid fa-flag-checkered', tint = 'violet',
description = 'Street races', url = 'https://cfx-nui-myracing/web/index.html',
category = 'app', featured = true,
-- optional gate
item = 'racing_tablet', job = 'police', grade = 2, onduty = true,
-- optional, with a network provider: what the app's RPCs need (default 'data-lite')
network = 'data',
})
Apps without a web manifest in np_phone (third-party apps) open url in an iframe.
tint takes the phone's tints (gray red orange rust pinkf olivef rose green blue gold violet dark), a css colour, or
a Nimbus UI tint name used by the np_* resources, mapped to the nearest phone tint: lilac → violet, aqua →
blue, olive → olivef, pink → pinkf, neutral / brand → gray (red orange rust green blue are the same
in both).
Liquid Glass in custom apps (SDK 1.1.0): the handshake and the live settings event carry
phone.settings.glass (the player's Liquid Glass switch, Settings → Display) and phone.settings.material
('liquid' or 'frosted'). The SDK mirrors it onto the app's document as <html data-np-material="liquid|frosted">,
so plain CSS can follow the phone; apps on Nimbus liquid.css mirror it to data-nb-material themselves. Phones
before SDK 1.1 send neither field. np_minigames' Arcade app follows it.
Network ​
server
Signal from a network provider such as np_cellnet. Without a provider every phone has full service. The full contract is on Network.
| Export | Returns | Description |
|---|---|---|
setNetwork(src, state) |
true | false, err |
Provider state { bars, type?, carrier?, tint?, tower?, dbm?, load?, wifi?, roaming?, sos?, jammed?, plan? }. nil clears it. Owner-tracked: cleared for everyone when the provider stops. Errors no_player, invalid_state |
getNetwork(src) |
state | nil |
nil: no provider, full service |
canUse(src, need) |
true | false, code |
need = 'sms', 'voice', 'data-lite', 'data' or 'emergency'. Codes no_signal, no_data, jammed |
setRpcNeed(method, need) |
What your RPC needs: a need, function(src, params) -> need | nil, or false (never gated). nil removes your entry. Owner-tracked |
|
getConfig() |
table | Includes emergencyLines, the dialled numbers of the emergency lines ({ '911', '912' }), for providers |
endCall(src, reason?) |
reason = 'dropped' ends the call as a lost connection (Call Failed) |
Four error codes have text in every app: no_signal and jammed (No Service), no_data (Connection too weak) and
network_busy (Network Busy, try again, returned by a provider's rpc hook). call(src, method, params) runs trusted
server code and skips the network gate.
Screen mirror ​
server
Nearby players see a generic version of the phone screen on the prop, never content (Screen mirror).
| Export | Returns | Description |
|---|---|---|
setScreenHidden(src, hidden) |
boolean |
Force the hidden shape ({ on, brightness }) for src, per calling resource (undercover jobs, events). Released when your resource stops |
getScreenState(src) |
table | nil |
Copy of the npPhoneScreen state bag value, nil when the phone is closed or the mirror is off |
hasPrivacyGlass(src) |
boolean |
Privacy glass item or ox_inventory phone metadata flag, cached Config.ScreenMirror.glass.cacheMs. Replace the check with overrideBridge('framework', 'hasPrivacyGlass', fn(src)) |
Addons ​
np_phone is an addon host with API level 1. An addon is a separate resource that extends the phone through these
exports, such as np_cellnet. It vendors the shared addon lib (bridge/np_addon.lua) and registers
everything inside npAddon.attach, which runs now if np_phone is ready and again after every np_phone restart:
-- fxmanifest.lua of the addon
np_addon 'np_phone'
dependency 'np_phone' -- only when it can't run without the phone
-- server of the addon
npAddon.attach('np_phone', function(host)
exports.np_phone:addHook('rpc', onRpc)
exports.np_phone:setRpcNeed('racing.join', 'data')
exports.np_phone:registerStoreApp(App)
end, { api = 1 })
np_phone calls npAddon.ready() once its database schema is applied, so the attach function always finds empty,
accepting registries. Everything registered through the exports (hooks, RPCs, App Store entries, blocks, bridge
overrides, network states, RPC needs) is owner-tracked and removed when the addon stops. The older way, re-registering
in onResourceStart for your resource and for np_phone, still works. The convention: Addons.
Apps ​
server
| Export | Area | Description |
|---|---|---|
sendMail(srcOrIdentifier, mail) |
City | Mail with optional waypoint or event action buttons |
createInvoice(srcOrIdentifier, data) |
City | Business invoice or fine → id |
logTransaction(srcOrIdentifier, amount, title, meta) |
City | Add a line to the wallet history (signed amount) |
groupGetByPlayer(src) |
City | → groupId, info |
groupGetMembers(groupId) |
→ { src, … } |
|
groupStartJob(groupId, job) |
Starts a staged job with a Live Activity | |
groupSetStage(groupId, stage, patch?) |
||
groupSetProgress(groupId, done, total) |
||
groupUpdateJob(groupId, patch) |
||
groupFinishJob(groupId, { payoutEach }) |
Pays every member to bank, plus a transaction log entry | |
groupNotify(groupId, n) |
Notifies every member | |
sendSystemMessage(fromLabel, toNumber, text) |
Comms | Read-only business thread in Messages |
addPhoto(srcOrIdentifier, url, meta?) |
Media | Skips the host allow-list |
addNote(srcOrIdentifier, body) |
Media | |
addFile(srcOrIdentifier, file) |
Media | Document, contract, image, licence or receipt |
createContract(src, targetSrc, data) |
Two-party contract → id. The target gets a "Sign" button | |
getContract(id) |
||
addCalendarEvent(srcOrIdentifier, event) |
Social | → event id |
setChirpVerified(target, bool) |
Social | Blue check on the character's main (oldest) Chirp account, or any account with { handle = 'lsfd' }. false if there is none |
getChirpAccount(target) |
→ { id, handle, name, avatar, bio, verified } of the active account, else the main one, or { handle = }. nil if the character never opened Chirp |
exports.np_phone:sendMail(src, {
sender = 'Lester', subject = 'Job', body = 'Meet me here.',
actions = { { label = 'Set waypoint', type = 'waypoint', data = { x = 1275.0, y = -1710.0 } } },
})
exports.np_phone:createInvoice(src, { sender = 'LSPD', senderJob = 'police', amount = 350,
reason = 'Citation #4412 · Speeding', dueAt = os.time() + 3 * 86400 })
exports.np_phone:addFile(src, { type = 'document', title = 'Property Deed — 3671 Whispymound Dr',
body = 'This deed certifies ...', issuer = 'Dynasty 8 Real Estate' })
Client ​
client
| Export | Returns | Description |
|---|---|---|
open() |
Open the phone | |
close() |
Close the phone | |
isOpen() |
boolean |
|
setPose(pose) |
'text' or 'call' holding animation |
|
setWalking(bool) |
boolean |
Walk mode (cursor off, the player moves, one-handed) or cursor mode (cursor on, movement disabled, two-handed). Players toggle it with Left Alt. Only while the phone is open and Config.WalkMode is on |
isWalking() |
boolean |
The phone is open in walk mode |
ring(opts) |
boolean |
Ring / peek mode: the phone slides up without focus. false while the phone is open |
stopRing(id?) |
boolean |
|
isRinging() |
id | nil |
|
isCameraActive() |
boolean |
The camera app is in use |
getNetwork() |
state | nil |
This player's network provider state, nil = full service (Network) |
isScreenMirrorActive() |
boolean |
This client draws at least one other (or its own) phone screen (Screen mirror) |
setLocalScreenHidden(hidden) |
Hide this player's screen from others, per calling resource (released on stop). Applied by the server like the Hide screen setting |
exports.np_phone:ring({ id = 'dispatch', app = 'phone', title = 'Dispatch', subtitle = 'Incoming call',
openOnAccept = true, timeout = 30000 })
ring callbacks through the export
Phone.ring only accepts onAccept / onDecline when they are Lua functions. Functions passed through an export arrive
as callable function-reference tables, so they're currently ignored. The key press is forwarded to the NUI as the push
phone:ringKey { id, action } instead.
Internal Lua API ​
Inside np_phone (new apps, bridges), use the Phone.* API directly: Phone.rpc.register, Phone.push,
Phone.getPlayer, Phone.fw, Phone.schema, … See Architecture §2–3.