Ui::setNotificationMessage: Difference between revisions

From RAGE Multiplayer Wiki
No edit summary
m (Minor edits)
 
(6 intermediate revisions by 4 users not shown)
Line 1: Line 1:
picName1 &amp; picName2 must match. Possibilities: 'CHAR_SIMEON', 'CHAR_DEFAULT', 'CHAR_FACEBOOK', 'CHAR_SOCIAL_CLUB', 'CHAR_BLOCKED', 'CHAR_ALL_PLAYERS_CONF'<br><br><br>flash is a bool for fading in.<br>iconTypes:<br>1 : Chat Box<br>2 : Email<br>3 : Add Friend Request<br>4 : Nothing<br>5 : Nothing<br>6 : Nothing<br>7 : Right Jumping Arrow<br>8 : RP Icon<br>9 : $ Icon<br><br>'sender' is the very top header. This can be any old string.<br>'subject' is the header under the sender.
See [[Notification Pictures]] for a list of notification pictures. Pictures from this link have the same '''textureDict''' and '''textureName'''.
 
Also some of them needs to be requested with [[Graphics::requestStreamedTextureDict]].
 
==Syntax==
==Syntax==
<syntaxhighlight lang="javascript">mp.game.ui.setNotificationMessage(picName1, picName2, flash, iconType, sender, subject);</syntaxhighlight>
<syntaxhighlight lang="javascript">mp.game.ui.setNotificationMessage(textureDict, textureName, flash, iconType, sender, subject);</syntaxhighlight>
 
===Icon types===
* '''No Icon''': 0, 4, 5, 6
* '''Speech Bubble''': 1
* '''Message''': 2
* '''Friend Request''': 3
* '''Arrow''': 7
* '''RP''': 8
* '''Money''': 9
 
=== Required Arguments ===
=== Required Arguments ===
*'''picName1:''' String
*'''textureDict:''' {{RageType|String}}
*'''picName2:''' String
*'''textureName:''' {{RageType|String}}
*'''flash:''' Boolean
*'''flash:''' {{RageType|Boolean}}
*'''iconType:''' int
*'''iconType:''' {{RageType|Int}}
*'''sender:''' String
*'''sender:''' {{RageType|String}}
*'''subject:''' String
*'''subject:''' {{RageType|String}}
 
===Return value===
===Return value===
*'''int'''
*{{RageType|Int}}
 
==Example==
==Example==
<syntaxhighlight lang="javascript">
{{ClientsideCode|
// todo
<pre>
</syntaxhighlight>
const notifyWithPicture = () => {
mp.game.ui.setNotificationTextEntry('STRING');
mp.game.ui.setNotificationMessage('CHAR_RON', 'CHAR_RON', false, 2, 'New Message', 'Hello World!');
};
 
notifyWithPicture();
</pre>
}}
Output:
[[File:outputnative.png|200px]]
 
Values '''textureDict''' and '''textureName''' gives you ability to make custom notifcation pictures using: [[Using_DLC_Packs_with_Custom_Textures]]
{{ClientsideCode|
<pre>
// Before using your custom textures you must request them by this function
mp.game.graphics.requestStreamedTextureDict('notifications', true);
 
const notifyWithPicture = () => {
mp.game.ui.setNotificationTextEntry('STRING');
mp.game.ui.setNotificationMessage('notifications', 'rage', false, 2, 'New Message', 'Hi, now your notifications look ~y~beast');
};
 
notifyWithPicture();
</pre>
}}
Output:
[[File:outputcustom.png|200px]]
 
or using in-game sprites and textures (see [[Textures]]):
{{ClientsideCode|
<pre>
// Just in case you should request textureDict
mp.game.graphics.requestStreamedTextureDict('commonmenu', true);
 
const notifyWithPicture = () => {
mp.game.ui.setNotificationTextEntry('STRING');
return mp.game.ui.setNotificationMessage('commonmenu', 'mp_specitem_cash', false, 9, 'New notification!', 'Your account has been charged');
};
 
notifyWithPicture();
</pre>
}}
Output:
[[File:outputcustom2.png|200px]]
 
==See also==
==See also==
{{Ui_s_function_c}}
{{Ui_s_function_c}}
[[Category:Clientside API]]
[[Category:Clientside API]]
[[Category:UI API]]
[[Category:UI API]]
[[Category:TODO: Example]]

Latest revision as of 12:22, 5 December 2020

See Notification Pictures for a list of notification pictures. Pictures from this link have the same textureDict and textureName.

Also some of them needs to be requested with Graphics::requestStreamedTextureDict.

Syntax

mp.game.ui.setNotificationMessage(textureDict, textureName, flash, iconType, sender, subject);

Icon types

  • No Icon: 0, 4, 5, 6
  • Speech Bubble: 1
  • Message: 2
  • Friend Request: 3
  • Arrow: 7
  • RP: 8
  • Money: 9

Required Arguments

  • textureDict: String
  • textureName: String
  • flash: Boolean
  • iconType: Int
  • sender: String
  • subject: String

Return value

  • Int

Example

Client-Side
const notifyWithPicture = () => {
	mp.game.ui.setNotificationTextEntry('STRING');
	mp.game.ui.setNotificationMessage('CHAR_RON', 'CHAR_RON', false, 2, 'New Message', 'Hello World!');
};

notifyWithPicture();

Output:

Values textureDict and textureName gives you ability to make custom notifcation pictures using: Using_DLC_Packs_with_Custom_Textures

Client-Side
// Before using your custom textures you must request them by this function
mp.game.graphics.requestStreamedTextureDict('notifications', true);

const notifyWithPicture = () => {
	mp.game.ui.setNotificationTextEntry('STRING');
	mp.game.ui.setNotificationMessage('notifications', 'rage', false, 2, 'New Message', 'Hi, now your notifications look ~y~beast');
};

notifyWithPicture();

Output:

or using in-game sprites and textures (see Textures):

Client-Side
// Just in case you should request textureDict
mp.game.graphics.requestStreamedTextureDict('commonmenu', true);

const notifyWithPicture = () => {
	mp.game.ui.setNotificationTextEntry('STRING');
	return mp.game.ui.setNotificationMessage('commonmenu', 'mp_specitem_cash', false, 9, 'New notification!', 'Your account has been charged');
};

notifyWithPicture();

Output:

See also