Skip to main content

Available Server Exports

NPWD includes serveral available exports to easily interface with NPWD behavior and actions. You can find a list of the available server exports below.

generatePhoneNumber

Will generate a random phone number and return the value, this is useful for framework integration.

local phoneNumber = exports.npwd:generatePhoneNumber()

newPlayer

Adds a new player to NPWD internal handling. This is used with framework integration to load a player.

exports.npwd:newPlayer({ source = 1, firstname = 'Taso', lastname = 'Dev', identifier = 'dba4d971256a8bfb1a543cf0d46e342ad1cdd478', phoneNumber = '444-1312' })
warning

The export unloadPlayer currently doesn't perform correctly due to recoil limitations. You can track the issue here.

unloadPlayer

Removes a player from the player map. This should be triggered when swapping to another character where the player data changes.

exports.npwd:unloadPlayer(source)

onMessage

Listen to any message from a phone number

exports.npwd:onMessage('911', function(ctx)
TriggerEvent('roleplayEvent', ctx.data.message)
end)
interface OnMessageExportCtx {
data: PreDBMessage;

source: number;
}

interface PreDBMessage {
conversationId: string;
tgtPhoneNumber: string;
message: string;
}

emitMessage

Send a message to any player from any number

exports.npwd:emitMessage({
senderNumber = '911',
targetNumber = '123-456-7890',
message = 'Hello this is the police!'
})