Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. Red Dead Redemption 2

      1. Gameplay
      2. Missions
      3. Help & Support
    2. Red Dead Online

      1. Gameplay
      2. Find Lobbies & Outlaws
      3. Help & Support
    1. Crews & Posses

      1. Recruitment
    2. Events

    1. GTA Online

      1. Arena War
      2. After Hours
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Grand Theft Auto Series

    3. GTA Next

    4. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    5. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA Mods
    6. GTA Chinatown Wars

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    10. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    11. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    12. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    13. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    3. Featured Mods

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption

    2. Rockstar Games

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Programming
      5. Movies & TV
      6. Music
      7. Sports
      8. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. News

    2. Forum Support

    3. Site Suggestions

EduardogomeS_r

DRAW NOTIFICATION with colorful players name

Recommended Posts

EduardogomeS_r

Hello everyone.
I have a problem here, can anyone help me make this notification (with this formatting)?
I'm only able to put only 1 name, without message.

 

R8i3ZSr.jpg

Share this post


Link to post
Share on other sites
Guest
Posted (edited)

Try these control codes in your text string:

~r~ = Red
~b~ = Blue
~g~ = Green
~y~ = Yellow
~p~ = Purple
~o~ = Orange
~c~ = Grey
~m~ = Darker Grey
~u~ = Black
~n~ = New Line
~s~ = Default White
~w~ = White
~h~ = Bold Text

They change whatever text comes after them, so:

"~r~Player ~y~One"

Would write "Player" in red and "One" in yellow.

"Player One~n~Player Two"

Would write "Player One" and then "Player Two" on the line underneath.

 

Bold Text is a toggle, so you place it once to turn bold text on in that line and then again to turn it off. So:

"This is ~h~bold ~h~text"

Would show as:

This is bold text

Edited by Guest

Share this post


Link to post
Share on other sites
EduardogomeS_r
1 hour ago, LeeC2202 said:

Try these control codes in your text string:

~r~ = Red
~b~ = Blue
~g~ = Green
~y~ = Yellow
~p~ = Purple
~o~ = Orange
~c~ = Grey
~m~ = Darker Grey
~u~ = Black
~n~ = New Line
~s~ = Default White
~w~ = White
~h~ = Bold Text

They change whatever text comes after them, so:

"~r~Player ~y~One"

Would write "Player" in red and "One" in yellow.

"Player One~n~Player Two"

Would write "Player One" and then "Player Two" on the line underneath.

 

Bold Text is a toggle, so you place it once to turn bold text on in that line and then again to turn it off. So:

"This is ~h~bold ~h~text"

Would show as:

This is bold text

Thanks for answering.


But what I want is to change the formatting of the player name and put more than one, as in the photo.
Example:

//Function
void Notification(char* msg)
{	
	UI::_SET_NOTIFICATION_TEXT_ENTRY("STRING");
	UI::ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME(msg);
	UI::_DRAW_NOTIFICATION(2000, 1);
}
//Normal usage(correct way)
Notification(PLAYER::GET_PLAYER_NAME(player));

This way it is not possible to format the return (name of the player), including more characters.

//Not allowed 1
Notification(~r~PLAYER::GET_PLAYER_NAME(player));

//Not allowed 2
Notification("~r~PLAYER::GET_PLAYER_NAME(playerone) kills ~b~PLAYER::GET_PLAYER_NAME(playertwo)");

 

Share this post


Link to post
Share on other sites
Guest
Posted (edited)

Why don't you just get the player name values into separate strings and then format the "msg" property before you send it to the Notification() function? It's just basic string building.

 

I don't programme in C++ but this was almost the first answer in the search results.

https://stackoverflow.com/questions/15319859/how-to-concatenate-two-strings-in-c

 

Edited by Guest

Share this post


Link to post
Share on other sites
EduardogomeS_r
31 minutes ago, LeeC2202 said:

Why don't you just get the player name values into separate strings and then format the "msg" property before you send it to the Notification() function? It's just basic string building.

 

I don't programme in C++ but this was almost the first answer in the search results.

https://stackoverflow.com/questions/15319859/how-to-concatenate-two-strings-in-c

 

Thanks dude.

I was thinking about it, but I had many difficulties, because I did not want to use sprintf, I'll think of a solution.

Share this post


Link to post
Share on other sites
Guest

Having a quick look through some C++ stuff, I have no idea whether this will even work but the principles behind getting the char * values and the string creation seems to indicate it might. At worst, it might give you an idea of something.

std::string p1String(PLAYER::GET_PLAYER_NAME(playerone));
std::string p2String(PLAYER::GET_PLAYER_NAME(playertwo));

std::string notifyMsgString = "~r~" + p1String + " kills ~b~" + p2String;

std::vector<char> notifyMsg(notifyMsgString.begin(), notifyMsgString.end());
notifyMsg.push_back('\0');

Notification(&notifyMsg[0]);

I am sure if one of the C++ coders pops by, they will correct the errors I have probably made.

Share this post


Link to post
Share on other sites
EduardogomeS_r
13 hours ago, LeeC2202 said:

Having a quick look through some C++ stuff, I have no idea whether this will even work but the principles behind getting the char * values and the string creation seems to indicate it might. At worst, it might give you an idea of something.

std::string p1String(PLAYER::GET_PLAYER_NAME(playerone));
std::string p2String(PLAYER::GET_PLAYER_NAME(playertwo));

std::string notifyMsgString = "~r~" + p1String + " kills ~b~" + p2String;

std::vector<char> notifyMsg(notifyMsgString.begin(), notifyMsgString.end());
notifyMsg.push_back('\0');

Notification(&notifyMsg[0]);

I am sure if one of the C++ coders pops by, they will correct the errors I have probably made.

Looks cool, I will try. Thank you.

Share this post


Link to post
Share on other sites
AdryaNN53

Another method:

char* StringToChar(std::string string) {
	return _strdup(string.c_str());
}

std::string One = PLAYER::GET_PLAYER_NAME(Player1);
std::string Two = PLAYER::GET_PLAYER_NAME(Player2);
std::string Result = One + " kills " + Two;
Notification(StringToChar(Result));

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • 2 Users Currently Viewing
    0 members, 0 Anonymous, 2 Guests

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.