SA-MP Forums Archive
[Tutorial] How to create a message with multiple colors - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] How to create a message with multiple colors (/showthread.php?tid=250389)

Pages: 1 2


How to create a message with multiple colors - GangsTa_ - 23.04.2011

Hello. Welcome to my first tutorial. I was watching and searching through the guides on SAMP forums for this section, and didn't find anything. I had problems with it too, the wiki info didn't help too much, I'll give here the full information.

Let's get it started.


Alrighty, let me show you what are we going to learn now. As you can see, the new SA-MP 0.3c version allows you to create a message that could include more colors, not just one that was written like:

Code:
SendClientMessage(playerid, 0xFF0000FF, "Welcome to my SA-MP 0.3c server.");
Here I'll show you how to include more colors in this message such as red, green, blue, yellow..

Alright, so you want this message to appear when someone joins your server.
First of all, you need to read the information from wikipedia. CLICK

The second, if you need all the colors in hexadecimal codes, you can see them at this page, created by RyDeR`: CLICK

Quote:
Originally Posted by RyDeR`
{ "BLUE", "1B1BE0" },
{ "PINK", "E81CC9" },
{ "YELLOW", "DBED15" },
{ "LIGHTGREEN", "8CED15" },
{ "LIGHTBLUE", "15D4ED" },
{ "RED", "FF0000" },
{ "GREY", "BABABA" },
{ "WHITE", "FFFFFF" },
{ "ORANGE", "DB881A" },
{ "GREEN", "37DB45" },
{ "PURPLE", "7340DB" }
Alrighty, you got the colors now.
Let's start with the message. If you need the message like I said, with multiple colors, read below:

We're going to need this message "Welcome to my SA-MP 0.3c server."
However, we want it to be like "Welcome to my SA-MP 0.3c server."

In SA-MP 0.3c, for making a few words look in different colors, you need to put the hexadecimal code into the brackets, like:

pawn Code:
{FF0000}
And the code for the message should look like this, because your making the red message after the closed bracket, the blue color after the next closed bracket, etc.

Look at this code to see an example:

pawn Code:
public OnPlayerConnect(playerid)
{
    SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}Welcome to my {0000FF}SA-MP {DB881A}0.3c {37DB45}server.");
    return 1;
}
Also, forgot to state, maybe you noticed and asked yourself why I put the '0xFFFFFFFF' after the 'playerid'? Because you can put what color you want there, it will have no sense if you create a message with multiple colors.
Let's see what we done:



And here we're done with the messages.

However, SA-MP 0.3c allows us to create not only messages with multiple colors, but also 3D texts, Dialogs, Vehicle Number Plates.

-I will update soon with all those.-



Re: How to create a message with multiple colors - [03]Garsino - 23.04.2011

SA:MP has a problem with messages longer than 150 characters -> (including colour embedding) not showing in chat at all.

As for your code. You never need to put colour embedding right after the first " because you can just put the colour in the colour parameter in SendClientMessage. Like below:
pawn Code:
SendClientMessage(playerid, 0xFF0000FF, "Welcome to my {0000FF}SA-MP {DB881A}0.3c {37DB45}server.");
It will still show the same colours.


Re: How to create a message with multiple colors - GangsTa_ - 23.04.2011

Yeah but I used the same code that I stated and it works, like you see on the screen.


Re: How to create a message with multiple colors - [03]Garsino - 23.04.2011

Quote:
Originally Posted by GangsTa[MD]
View Post
Yeah but I used the same code that I stated and it works, like you see on the screen.
Yeah, I know. I didn't say your code wouldn't work. I just said that you don't need the first {} because you can just put the colour in the second parameter.


Re: How to create a message with multiple colors - GangsTa_ - 24.04.2011

Yeah I got it.


Re: How to create a message with multiple colors - justsomeguy - 24.04.2011

Just what i needed but did not knew how!
Nice tut and great explaining


Re: How to create a message with multiple colors - GangsTa_ - 27.04.2011

No problem, good luck with coding.


How to create a message with multiple colors - Veillavable - 29.04.2011

Its not the close. Its because your placing the "ifsun_flower==1" AFTER you close for the first dialogue. Your going to need a second label then place your if statement after L_Require. Like this:
CODE
_________________
Pocket all your knowledge with your watch and never pull it out in company unless desired.
http://www.chung-sim.com/pinnacle.moviebox.usb.html


Re: How to create a message with multiple colors - GangsTa_ - 29.04.2011

I don't understand what you want.


Re: How to create a message with multiple colors - Niko_boy - 24.05.2011

easy and helpful tutorial :\ ty I MAde Some Mistakes in my script with this thing only now i will able to recover them.


Re: How to create a message with multiple colors - GangsTa_ - 24.05.2011

Yeah, no problem.


Re : How to create a message with multiple colors - Naruto_Emilio - 24.05.2011

Quote:
Originally Posted by Veillavable
View Post
Its not the close. Its because your placing the "ifsun_flower==1" AFTER you close for the first dialogue. Your going to need a second label then place your if statement after L_Require. Like this:
CODE[/url]
What the hell?


Re: How to create a message with multiple colors - GangsTa_ - 25.05.2011

Yeah what the hell?


Re: How to create a message with multiple colors - Kudoz - 21.05.2012

ah thanks! This really helped me to a much more cleaner Join/Leave msgs and other kinds of sendclientmessages!
thanks!
rep++ on ya!


Re: How to create a message with multiple colors - miley1 - 22.05.2012

Gangsta Great Toturial Normally i dont pass Repution fast , But for this ill make a exception +1 rep


Re: How to create a message with multiple colors - Spency - 27.04.2013

You've saved my life with this one mate.

Cheers!


Re: How to create a message with multiple colors - ConnorP - 22.05.2013

what's wrong with this? it doesn't work for me. It just shows exactly how it's typed.

pawn Code:
public OnPlayerConnect(playerid)
{
    SendClientMessage(playerid, 0xFFFFFFAA, "welcome to {0xAA3333AA} my test server {0xFFFFFFAA} blabla.");
    return 1;
}



Re: How to create a message with multiple colors - BlackbirdXd - 13.02.2017

Quote:
Originally Posted by ConnorP
View Post
what's wrong with this? it doesn't work for me. It just shows exactly how it's typed.

pawn Code:
public OnPlayerConnect(playerid)
{
    SendClientMessage(playerid, 0xFFFFFFAA, "welcome to {0xAA3333AA} my test server {0xFFFFFFAA} blabla.");
    return 1;
}
Sorry for bumping btw, I think because you adding 0x to every hex decimal color code in the message you sending try to remove 0x then try again.


Re: How to create a message with multiple colors - Variable™ - 13.02.2017

Quote:
Originally Posted by BlackbirdXd
View Post
Sorry for bumping btw, I think because you adding 0x to every hex decimal color code in the message you sending try to remove 0x then try again.
Please see his last activity.
11/08/2013 05:38 PM

Your thread bumping is actually pointless.


Re: How to create a message with multiple colors - LeonMrBonnie - 13.02.2017

Quote:
Originally Posted by ConnorP
View Post
what's wrong with this? it doesn't work for me. It just shows exactly how it's typed.

pawn Code:
public OnPlayerConnect(playerid)
{
    SendClientMessage(playerid, 0xFFFFFFAA, "welcome to {0xAA3333AA} my test server {0xFFFFFFAA} blabla.");
    return 1;
}
You are using hexadecimal colors, in the text itself you have to use decimal colors.

I would suggest using this site when you want to get some colors: http://www.color-hex.com