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
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
| Parameter | Type | Description |
|---|---|---|
text | string | Message. |
options | table? | { 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'
})See also
ShowToast
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
| Parameter | Type | Description |
|---|---|---|
text | string | Message. |
duration | int? | Milliseconds, default 3000. |
Returns
Nothing (void).
Example
RegisterNUICallback('saveSettings', function(data, cb)
SetResourceKvp('settings', data)
ShowToast('Settings saved', 1500)
cb({ ok = true })
end)ShowDialog
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
| Parameter | Type | Description |
|---|---|---|
options | table | { 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')
endShowSubtitle
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
| Parameter | Type | Description |
|---|---|---|
text | string | Subtitle text. |
duration | int? | 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
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
| Parameter | Type | Description |
|---|---|---|
text | string | Help text. ~F10~ renders a key icon. |
duration | int? | 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
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
| Parameter | Type | Description |
|---|---|---|
from | string | Sender name. |
text | string | Message. |
icon | string? | Contact icon. |
Returns
Nothing (void).
Example
RegisterNetEvent('rtx_phone:sms', function(from, text)
ShowPhoneMessage(from, text, 'chat')
end)SetHudVisible
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
| Parameter | Type | Description |
|---|---|---|
visible | boolean | Show 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)IsHudVisible
boolean IsHudVisible()Checks the HUD.
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
This native takes no parameters.
Returns
boolean Whether the HUD is visible.
Example
RegisterCommand('hud', function()
SetHudVisible(not IsHudVisible())
end, false)