Configuration

Kibra SmartPad Configuration

Fetching Players' Email Addresses

This document shows how to call the GetPlayerEmail export from the kibra-smartpad resource in your FiveM scripts. Simply copy and paste the examples below into your server or client scripts.


Server-Side Usage

-- In your other server script:
local playerServerId = source -- or any valid server ID
local email = exports['kibra-smartpad']:GetPlayerEmail(playerServerId)

if email ~= 'notFound' then
    print(('Player %d email: %s'):format(playerServerId, email))
else
    print(('No email configured for player %d'):format(playerServerId))
end

Client-Side Usage

Since the export is exposed to the client without parameters, you can retrieve the local player’s email directly:

-- client.lua
local email = exports['kibra-smartpad']:GetPlayerEmail()
if email ~= 'notFound' then
    print('My email:', email)
else
    print('Email not set')
end

Creating New Mail Records

You can create and send a new mail entry using the CreateNewMail export. For example, register a server command:

RegisterCommand('testmail', function(source, args)
    local Receiver = '[email protected]'
    local MailContent = {
        subject = 'Urgent: You Have Unpaid Debts',
        message = "Hello, you have unpaid invoices to our mechanical company. We kindly ask you to pay.",
    }
    local From_Name = 'Los Santos Mechanic'
    local From = '[email protected]'
    local Type = 0
    exports['kibra-smartpad']:CreateNewMail(Receiver, MailContent, From_Name, From, Type)
end)
  • Receiver (string): The recipient's email address.

  • MailContent (table): A table with subject and message keys.

  • From_Name (string): The display name of the sender.

  • From (string): The sender's email address.

  • Type (number): A numeric identifier for mail type (e.g., 0 for normal mail).

Copy and paste these snippets to integrate email retrieval and creation quickly!

Custom Create Invoice

This export allows you to create and send a bill (invoice) to a player through the in-game tablet.

exports["kibra-smartpad"]:CreateNewBill(identifier, dueDate, products, status, note, jobName)

📌 Parameters

Parameter
Type
Description

identifier

string

The target player's unique ID (Steam or Rockstar license).

dueDate

string

The bill's due date. Must be in the format "YYYY-MM-DD", e.g., "2025-06-29".

products

table

A list of products or services included in the bill. See format below.

status

number

Bill status: 0 for Pending, 1 for Paid.

note

string

Optional note added to the bill, e.g., "Please pay your invoice."

jobName

string

The job of the player creating the bill (e.g., "mechanic" or "police").

Place events, exports or functions that hide and open your border within these functions.

Example Usage

RegisterCommand('testbill', function(source)
    local Player = Resmon.Lib.GetPlayerFromSource(source)

    local DueDate = '2025-06-29'

    local Products = {
        {
            Description = 'Car Repair',
            Quantity = 1,
            Price = 1000
        }
    }

    local Status = 0 -- Pending
    local Note = 'Please pay your invoice.'

    exports["kibra-smartpad"]:CreateNewBill(
        Player.identifier,
        DueDate,
        Products,
        Status,
        Note,
        Player.job.name
    )
end)

Fetching Players' Email Addresses

This document shows how to call the GetPlayerEmail export from the kibra-smartpad resource in your FiveM scripts. Simply copy and paste the examples below into your server or client scripts.


Server-Side Usage

-- In your other server script:
local playerServerId = source -- or any valid server ID
local email = exports['kibra-smartpad']:GetPlayerEmail(playerServerId)

if email ~= 'notFound' then
    print(('Player %d email: %s'):format(playerServerId, email))
else
    print(('No email configured for player %d'):format(playerServerId))
end

Client-Side Usage

Since the export is exposed to the client without parameters, you can retrieve the local player’s email directly:

-- client.lua
local email = exports['kibra-smartpad']:GetPlayerEmail()
if email ~= 'notFound' then
    print('My email:', email)
else
    print('Email not set')
end

Copy and paste these snippets to integrate email retrieval quickly!

GetPlayerUnpaidInvoices

Description

Retrieves all unpaid invoices for a given player from the kibra-smartpad resource.

Usage

-- In a server-side script
local source = source -- FiveM player source ID
local unpaidInvoices = exports['kibra-smartpad']:GetPlayerUnpaidInvoices(source)

Parameters

  • source (number): The server ID of the player whose unpaid invoices you wish to fetch.

Returns

  • (table): An array of invoice objects. Each object contains:

    • id (number): Invoice identifier.

    • amount (number): Amount due.

    • dueDate (string): Due date in ISO format (YYYY-MM-DD).

    • issuedDate (string): Date the invoice was issued.

    • status (string): Invoice status ("unpaid").

Example

-- Example: Check a player's unpaid invoices and send a chat message
RegisterCommand('checkInvoices', function(source, args, rawCommand)
    local invoices = exports['kibra-smartpad']:GetPlayerUnpaidInvoices(source)

    if #invoices > 0 then
        for _, invoice in ipairs(invoices) do
            TriggerClientEvent('chat:addMessage', source, {
                args = {
                    string.format(
                        'Invoice #%d: $%0.2f due on %s',
                        invoice.id,
                        invoice.amount,
                        invoice.dueDate
                    )
                }
            })
        end
    else
        TriggerClientEvent('chat:addMessage', source, {
            args = { 'You have no unpaid invoices!' }
        })
    end
end, false)

Notes

  • This export must be called from a server-side context.

  • Ensure the kibra-smartpad resource is started before invoking this export.

Last updated