createTrayNotification | Multi Theft Auto: Wiki Skip to content

createTrayNotification

Client-side
Server-side
Shared

Manual Review Required

Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.


This function creates a notification balloon on the desktop.

Note

MTA won't show any tray notifications if the MTA window is focused, because there is no reason to show tray notifications if you are in-game. If you want to test this function you should use a Timer and switch to your desktop.

Note

You can only show a tray notification every 30 seconds.

Syntax

bool createTrayNotification ( string notificationText, [ string iconType = "default", bool useSound = true ] )
Required Arguments
  • notificationText: The text to send in the notification.
Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use.

  • iconType (default: "default"): The notification icon type. Possible values are: "default" (the MTA icon), "info", "warning", "error"
  • useSound (default: true): A boolean value indicating whether or not to play a sound when receiving the notification.

Returns

  • bool: value

Returns true if the notification is correctly created, false otherwise.

Code Examples

shared
-- Note: You have to wait 30 seconds before showing another tray notification, there is no queuing
createTrayNotification("Hello World") -- Show a 'Hello World' notification
createTrayNotification("Hello World", "warning") -- Show a notification with a warning symbol
createTrayNotification("Hello World", "default", false) -- Show a default notification without sound