CreateTrayNotification: Difference between revisions
Jump to navigation
Jump to search
m (Added note) |
(Added examples and a note) |
||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Client function}} | {{Client function}} | ||
This functions creates a notification ballon on the desktop. | This functions creates a notification ballon 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 ingame. | |||
If you want to test this function you should use a Timer and switch to your 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 ingame. 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== | ==Syntax== | ||
<syntaxhighlight lang="lua">bool createTrayNotification ( string notificationText, [ string eType, bool useSound ] )</syntaxhighlight> | <syntaxhighlight lang="lua">bool createTrayNotification ( string notificationText, [ string eType = "default", bool useSound = true ] )</syntaxhighlight> | ||
===Required Arguments=== | ===Required Arguments=== | ||
*'''notificationText:''' The text to send in the notification. | *'''notificationText:''' The text to send in the notification. | ||
===Optional Arguments=== | ===Optional Arguments=== | ||
*'''eType:''' The notification icon. Possible values are: '''"default", "info", "warning", "error"''' | *'''eType:''' The notification icon. Possible values are: '''"default", "info", "warning", "error"''' | ||
*'''useSound:''' A boolean value indicating whether or not to play a sound when receiving the notification. | *'''useSound:''' A boolean value indicating whether or not to play a sound when receiving the notification. | ||
==Returns== | ==Returns== | ||
Returns ''true'' if the notification is correctly created, ''false'' otherwise. | Returns ''true'' if the notification is correctly created, ''false'' otherwise. | ||
==Example== | |||
<syntaxhighlight lang="lua"> | |||
-- Note: You have to wait 30 seconds before showing another tray notification, there is no queuing | |||
-- Show a 'Hello World' notification | |||
createTrayNotification( "Hello World" ) | |||
-- Show a notification with a warning symbol | |||
createTrayNotification( "Hello World", "warning" ) | |||
-- Show a default notification without sound | |||
createTrayNotification( "Hello World", "default", false ) | |||
</syntaxhighlight> | |||
==See Also== | ==See Also== | ||
{{Client_utility_functions}} | {{Client_utility_functions}} |
Revision as of 18:30, 20 October 2016
This functions creates a notification ballon on the desktop.
Syntax
bool createTrayNotification ( string notificationText, [ string eType = "default", bool useSound = true ] )
Required Arguments
- notificationText: The text to send in the notification.
Optional Arguments
- eType: The notification icon. Possible values are: "default", "info", "warning", "error"
- useSound: A boolean value indicating whether or not to play a sound when receiving the notification.
Returns
Returns true if the notification is correctly created, false otherwise.
Example
-- Note: You have to wait 30 seconds before showing another tray notification, there is no queuing -- Show a 'Hello World' notification createTrayNotification( "Hello World" ) -- Show a notification with a warning symbol createTrayNotification( "Hello World", "warning" ) -- Show a default notification without sound createTrayNotification( "Hello World", "default", false )
See Also
- createTrayNotification
- downloadFile
- getDevelopmentMode
- getKeyboardLayout
- getLocalization
- isShowCollisionsEnabled
- isShowSoundEnabled
- isTransferBoxAlwaysVisible
- isTransferBoxVisible
- isTrayNotificationEnabled
- setClipboard
- setDevelopmentMode
- setTransferBoxVisible
- setWindowFlashing
- showCol
- showSound
- Shared
- addDebugHook
- base64Decode
- base64Encode
- debugSleep
- decodeString
- encodeString
- fromJSON
- generateKeyPair
- getColorFromString
- getDevelopmentMode
- getDistanceBetweenPoints2D
- getDistanceBetweenPoints3D
- getEasingValue
- getNetworkStats
- getNetworkUsageData
- getPerformanceStats
- getRealTime
- getTickCount
- getTimerDetails
- getTimers
- getFPSLimit
- getUserdataType
- getVersion
- gettok
- isTransferBoxVisible
- setTransferBoxVisible
- hash
- inspect
- interpolateBetween
- iprint
- isOOPEnabled
- isTimer
- killTimer
- md5
- passwordHash
- passwordVerify
- pregFind
- pregMatch
- pregReplace
- removeDebugHook
- resetTimer
- setDevelopmentMode
- setFPSLimit
- setTimer
- ref
- deref
- sha256
- split
- teaDecode
- teaEncode
- toJSON
- tocolor
- getProcessMemoryStats
- utfChar
- utfCode
- utfLen
- utfSeek
- utfSub
- bitAnd
- bitNot
- bitOr
- bitXor
- bitTest
- bitLRotate
- bitRRotate
- bitLShift
- bitRShift
- bitArShift
- bitExtract
- bitReplace