Ui::addTextComponentSubstringPlayerName: Difference between revisions

From RAGE Multiplayer Wiki
(Added example of usage with different fonts)
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
� Description :<br><br> Processes a string and removes the player name(max len 99)<br> You can use this function to create notifications/subtitles<br>--------------------------------------------------------------------<br>� Usage(Colors) :<br><br> ~r~ = red<br> ~y~ = yellow<br> ~g~ = green<br> ~b~ = light blue<br> ~w~ = white<br> ~p~ = purple<br> ~n~ = new line<br>--------------------------------------------------------------------<br>� Example (C++):<br><br>void ShowNotification(char *text)  <br>{ <br>        UI::_SET_NOTIFICATION_TEXT_ENTRY('STRING'); <br>        UI::ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME(text); <br>        UI::_DRAW_NOTIFICATION(FALSE, FALSE); // if first param = 1, the message flashes 1 or 2 times<br>}<br><br>� Colors example : <br><br>string red = '~r~Red test';<br>string white_and_yellow = '~w~White and ~y~yellow';<br>string text_with_double_line = 'First line.~n~Second line';<br><br>You can also call fonts which are defined in: common/data/ui/fontmap.xml, see example below<br><br>This native (along with 0x5F68520888E69014 and 0x94CF4AC034C9C986) do not actually filter anything. They simply add the provided text (as of 944)
� Description :<br><br> Processes a string and removes the player name(max len 99)<br> You can use this function to create notifications/subtitles<br>--------------------------------------------------------------------<br>� Usage(Colors) :<br><br> ~r~ = red<br> ~y~ = yellow<br> ~g~ = green<br> ~b~ = light blue<br> ~w~ = white<br> ~p~ = purple<br> ~n~ = new line<br>--------------------------------------------------------------------<br>� Example (C++):<br><br>void ShowNotification(char *text)  <br>{ <br>        UI::_SET_NOTIFICATION_TEXT_ENTRY('STRING'); <br>        UI::ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME(text); <br>        UI::_DRAW_NOTIFICATION(FALSE, FALSE); // if first param = 1, the message flashes 1 or 2 times<br>}<br><br>� Colors example : <br><br>string red = '~r~Red test';<br>string white_and_yellow = '~w~White and ~y~yellow';<br>string text_with_double_line = 'First line.~n~Second line';<br><br>You can also call fonts which are defined in: common/data/ui/'''[[Fontmap.xml|fontmap.xml]]''', along with 'html' style colours and font sizes, see example below<br><br>This native (along with 0x5F68520888E69014 and 0x94CF4AC034C9C986) do not actually filter anything. They simply add the provided text (as of 944)
==Syntax==
==Syntax==
<syntaxhighlight lang="javascript">mp.game.ui.addTextComponentSubstringPlayerName(text);</syntaxhighlight>
<syntaxhighlight lang="javascript">mp.game.ui.addTextComponentSubstringPlayerName(text);</syntaxhighlight>
Line 8: Line 8:
==Example==
==Example==
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
mp.game.ui.addTextComponentSubstringPlayerName(`<font face="ChaletComprime-CologneSixty">font</font> renders fine`);
mp.game.ui.addTextComponentSubstringPlayerName(`<font face="ChaletComprime-CologneSixty" size="16" color="rgb(123,213,123)">font</font> renders fine`);
</syntaxhighlight>
</syntaxhighlight>
==See also==
==See also==

Latest revision as of 16:30, 12 February 2018

� Description :

Processes a string and removes the player name(max len 99)
You can use this function to create notifications/subtitles
--------------------------------------------------------------------
� Usage(Colors) :

~r~ = red
~y~ = yellow
~g~ = green
~b~ = light blue
~w~ = white
~p~ = purple
~n~ = new line
--------------------------------------------------------------------
� Example (C++):

void ShowNotification(char *text)
{
UI::_SET_NOTIFICATION_TEXT_ENTRY('STRING');
UI::ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME(text);
UI::_DRAW_NOTIFICATION(FALSE, FALSE); // if first param = 1, the message flashes 1 or 2 times
}

� Colors example :

string red = '~r~Red test';
string white_and_yellow = '~w~White and ~y~yellow';
string text_with_double_line = 'First line.~n~Second line';

You can also call fonts which are defined in: common/data/ui/fontmap.xml, along with 'html' style colours and font sizes, see example below

This native (along with 0x5F68520888E69014 and 0x94CF4AC034C9C986) do not actually filter anything. They simply add the provided text (as of 944)

Syntax

mp.game.ui.addTextComponentSubstringPlayerName(text);

Required Arguments

  • text: String

Return value

  • Undefined

Example

mp.game.ui.addTextComponentSubstringPlayerName(`<font face="ChaletComprime-CologneSixty" size="16" color="rgb(123,213,123)">font</font> renders fine`);

See also