Developer Preview

UI natives

Game-style notifications, dialogs, subtitles, markers and the HUD on the local player's screen.

Developer Preview. Scripting is live on Neighborly servers – everything on these pages works today. The API is young, so tell us what you need next on Discord.

Game-style notifications, dialogs, subtitles, markers and the HUD on the local player's screen.

Open in the natives browser Search all 199 natives at once.

ShowNotification

Client
void ShowNotification(string text, table? options)

Posts a real Sims 4 notification that stays in the notification history.

Unlike the Neighborly notify toast, these notifications stay in the game's notification wall. Pass sim to show a portrait.

Parameters

ParameterTypeDescription
textstringMessage.
optionstable?{ title, sim, icon, buttons } – sim shows that Sim's portrait.

Returns

Nothing (void).

Example

ShowNotification('Your landlord says hi and reminds you about the rent.', {
    title = 'Message from your landlord',
    icon = 'letter'
})

ShowToast

Client
void ShowToast(string text, int? duration)

Shows a short line in the middle of the screen that fades away.

Toasts don't stack – a new one replaces the old one. For messages players should be able to read later, use ShowNotification.

Parameters

ParameterTypeDescription
textstringMessage.
durationint?Milliseconds, default 3000.

Returns

Nothing (void).

Example

RegisterNUICallback('saveSettings', function(data, cb)
    SetResourceKvp('settings', data)
    ShowToast('Settings saved', 1500)
    cb({ ok = true })
end)

ShowDialog

Client
string ShowDialog(table options)

Shows a Sims 4 style dialog and waits for the answer. Call it in a thread.

The calling thread waits until the player answers. For forms with several fields use exports.neighborly:inputDialog.

Parameters

ParameterTypeDescription
optionstable{ title, text, okLabel, cancelLabel, sim }.

Returns

string 'ok' or 'cancel'.

Example

local answer = ShowDialog({
    title = 'Job offer',
    text = 'Bluejay Café wants to hire you as a barista. Accept?',
    okLabel = 'Accept',
    cancelLabel = 'Decline'
})
if answer == 'ok' then
    TriggerServerEvent('rtx_cafe:acceptJob')
end

ShowSubtitle

Client
void ShowSubtitle(string text, int? duration)

Shows a subtitle at the bottom of the screen, like a line of dialogue.

Client only: it runs on the local player's PC and affects only their game. Other players don't see the result unless you tell the server.

Parameters

ParameterTypeDescription
textstringSubtitle text.
durationint?Milliseconds, default 4000.

Returns

Nothing (void).

Example

RegisterNetEvent('rtx_cafe:orderTaken', function(baristaName, drink)
    ShowSubtitle(('%s: One %s, coming right up!'):format(baristaName, drink), 4000)
end)

ShowHelpText

Client
void ShowHelpText(string text, int? duration)

Shows a help box in the top left corner.

Client only: it runs on the local player's PC and affects only their game. Other players don't see the result unless you tell the server.

Parameters

ParameterTypeDescription
textstringHelp text. ~F10~ renders a key icon.
durationint?Milliseconds, default 5000.

Returns

Nothing (void).

Example

AddEventHandler('playerSpawned', function()
    if not GetResourceKvp('seenPhoneHint') then
        ShowHelpText('Press ~F10~ to open your phone.', 8000)
        SetResourceKvp('seenPhoneHint', true)
    end
end)

ShowPhoneMessage

Client
void ShowPhoneMessage(string from, string text, string? icon)

Makes the Sim's phone buzz with a text message.

Shows up like a text from another Sim, with the phone buzz. Good for job offers, deliveries and doorbells.

Parameters

ParameterTypeDescription
fromstringSender name.
textstringMessage.
iconstring?Contact icon.

Returns

Nothing (void).

Example

RegisterNetEvent('rtx_phone:sms', function(from, text)
    ShowPhoneMessage(from, text, 'chat')
end)

SetHudVisible

Client
void SetHudVisible(boolean visible)

Shows or hides the game HUD – useful for screenshots and cutscenes.

Hides the game HUD only – NUI pages and Neighborly notifications stay. Remember to show it again.

Parameters

ParameterTypeDescription
visiblebooleanShow or hide.

Returns

Nothing (void).

Example

RegisterCommand('photomode', function()
    local hide = IsHudVisible()
    SetHudVisible(not hide)
    SetChatVisible(not hide)
    ShowToast(hide and 'Photo mode on' or 'Photo mode off', 1200)
end, false)