[Tutorial] How to create a message with multiple colors
#1

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.-
Reply
#2

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.
Reply
#3

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

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.
Reply
#5

Yeah I got it.
Reply
#6

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

No problem, good luck with coding.
Reply
#8

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
Reply
#9

I don't understand what you want.
Reply
#10

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

Yeah, no problem.
Reply
#12

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?
Reply
#13

Yeah what the hell?
Reply
#14

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

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

You've saved my life with this one mate.

Cheers!
Reply
#17

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;
}
Reply
#18

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.
Reply
#19

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.
Reply
#20

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
Reply


Forum Jump:


Users browsing this thread: 7 Guest(s)