Available Client Exports
NPWD includes serveral available exports to easily interface with NPWD behavior and actions. You can find a list of the available client exports below.
sendUIMessage
Use this in third-party apps when sending NUI messages. Accepts any data.
- Lua Example
- JS Example
exports.npwd:sendUIMessage({ type = "EVENT", payload = { dog = "woof", cat = "meow" }})
exports.npwd.sendUIMessage({ type: 'EVENT', payload: { dog: 'woof', cat: 'meow' }})
openApp
Will open the NPWD app of the given app id.
- Lua Example
- JS Example
exports.npwd:openApp('CONTACTS')
exports.npwd.openApp('CONTACTS')
setPhoneVisible
Accepts a boolean value to show or hide the phone. Will take into account the phone disabled state.
- Lua Example
- JS Example
exports.npwd:setPhoneVisible(true)
exports.npwd.setPhoneVisible(true)
setPhoneDisabled
Sets whether the phone is disabled or not. When the phone is disabled, the player will be unable to open the phone and will not receive notifications
- Lua Example
- JS Example
exports.npwd:setPhoneDisabled(true)
exports.npwd.setPhoneDisabled(true)
isPhoneDisabled
The getter equivalent of setPhoneDisabled, returns whether the phone is in a disabled state or not.
- Lua Example
- JS Example
local isDisabled = exports.npwd:isPhoneDisabled()
const isDisabled = exports.npwd.isPhoneDisabled()
isPhoneVisible
The getter equivalent of setPhoneVisable, returns whether the phone is in a visible state or not.
- Lua Example
- JS Example
local isPhoneVisible = exports.npwd:isPhoneVisible()
const isPhoneVisible = exports.npwd.isPhoneVisible()
startPhoneCall
Will initiate a phone call to the given phone number.
- Lua Example
- JS Example
exports.npwd:startPhoneCall('603-555-1212')
exports.npwd.startPhoneCall('603-555-1212')
isInCall
Returns whether the player is in a phone call or not.
- Lua Example
- JS Example
local isInCall = exports.npwd:isInCall()
const isInCall = exports.npwd.isInCall()
endCall
Will end the current phone call the player is in.
- Lua Example
- JS Example
local endCall = exports.npwd:endCall()
const endCall = exports.npwd.endCall()
fillNewContact
Opens the contact app and fills in a new contact form with the given data, it will not create the contact until the player confirms the action.
- Lua Example
- JS Example
exports.npwd:fillNewContact({ name = 'John Doe', number = '603-555-1212', avatar = 'https://i.imgur.com/j3UvwQA.png' })
exports.npwd.fillNewContact({ name: 'John Doe', number: '603-555-1212', avatar: 'https://i.imgur.com/j3UvwQA.png' })
fillNewNote
Will automatically open the notes app and start the new note processfilling in all of the fields with passed data. If this number already exists, it will edit it.
- Lua Example
- JS Example
exports.npwd:fillNewNote({ title = 'Some Note', content = 'This is the filled in content of the note' })
exports.npwd.fillNewNote({ title: 'Some Note', content: 'This is the filled in content of the note' })
getPhoneNumber
Returns the clients phone number
- Lua Example
- JS Example
exports.npwd:getPhoneNumber()
exports.npwd.getPhoneNumber()