[Tutorial] [0.3c] - Easy colors!
#1

0.3c Easy Colors
The easiest!
Instead of putting {RRGGBB} text and all that, i found a rather better way, which for me, it's the best so far.
It just simple to use, you will see, i already made a #define list with some colors.
It will be easier to read the text you have written there, instead of reading always {FF9035} etc....


The define list with colors
pawn Код:
#define COL_EASY           "{FFF1AF}"
#define COL_WHITE          "{FFFFFF}"
#define COL_BLACK          "{0E0101}"
#define COL_GREY           "{C3C3C3}"
#define COL_GREEN          "{6EF83C}"
#define COL_RED            "{F81414}"
#define COL_YELLOW         "{F3FF02}"
#define COL_ORANGE         "{FFAF00}"
#define COL_LIME           "{B7FF00}"
#define COL_CYAN           "{00FFEE}"
#define COL_LIGHTBLUE      "{00C0FF}"
#define COL_BLUE           "{0049FF}"
#define COL_MAGENTA        "{F300FF}"
#define COL_VIOLET         "{B700FF}"
#define COL_PINK           "{FF00EA}"
#define COL_MARONE         "{A90202}"
#define COL_CMD            "{B8FF02}"
#define COL_PARAM          "{3FCD02}"
#define COL_SERVER         "{AFE7FF}"
#define COL_VALUE          "{A3E4FF}"
#define COL_RULE           "{F9E8B7}"
#define COL_RULE2          "{FBDF89}"
#define COL_RWHITE         "{FFFFFF}"
#define COL_LGREEN         "{C9FFAB}"
#define COL_LRED           "{FFA1A1}"
#define COL_LRED2          "{C77D87}"
I used "{RRGGBB}' , with " " because we are actually inserting that into the string.
Here is a small look.
pawn Код:
SendClientMessage ( playerid,-1, ""#COL_RED"TEXT"#COL_YELLOW" TEXT"#COL_BLUE" TEXT"#COL_MAGENTA" TEXT"#COL_VIOLET" TEXT"#COL_WHITE" TEXT" );
Yeah, it may look a bit long, but at least it's a lot easier to read!Actually, no, reading it in these pawn tags won't make it look easy.
Copy paste into your gm and check it for yourself!

How to actually insert it?
Just simply add , exactly like this!
pawn Код:
"#COL_GREEN"
The above code, goes straight into the string!
Like this
pawn Код:
SendClientMessage( playerid, -1, "   "#COL_GREEN" This is Green!  "#COL_RED" This is Red!!   "#COL_BLUE"  This is Blue!!");
What we are doing is, inserting the {RRGGBB} code into the string using #COL_BLABLA
You can make your own defines with a color picker found on internet!
If you find this not useful just tell me.
I hope this helps you.
Reply
#2

Wow, thanks for all teh sexeh defines
Reply
#3

Nice man,thanks
Reply
#4

I found this method a few months ago, but didn't quite saw the possibilities. This describes a possible use of it, good job. Even though this isn't really a tutorial ^^
Reply
#5

Quote:
Originally Posted by Hiddos
Посмотреть сообщение
I found this method a few months ago, but didn't quite saw the possibilities. This describes a possible use of it, good job. Even though this isn't really a tutorial ^^
It's more of a show off or a help thread.
Thanks anyway.
Reply
#6

Quote:
Originally Posted by Hiddos
Посмотреть сообщение
I found this method a few months ago, but didn't quite saw the possibilities. This describes a possible use of it, good job. Even though this isn't really a tutorial ^^
Wait a minute, SA:MP 0.3c has just been made public for a week? xD
Reply
#7

Quote:
Originally Posted by Jochemd
Посмотреть сообщение
Wait a minute, SA:MP 0.3c has just been made public for a week? xD
This method, with #Blabla, it's around since forever!
Now it's the time for a good use of this method.
Reply
#8

Nice,good for beginers!

PS: My english is too bad!
Reply
#9

You don't really need the #.

pawn Код:
#define WHITE           "{FFFFFF}"
#define RED             "{FF0000}"
#define BLUE            "{0000FF}"
#define GREEN           "{00FF00}"
#define BLACK           "{000000}"
pawn Код:
SendClientMessage(playerid, 0xFFFFFFFF, ""BLACK" BLACK TEXT "WHITE" WHITE TEXT "RED" RED TEXT "BLUE" BLUE TEXT "GREEN" GREEN TEXT");
Reply
#10

Great job
Reply
#11

Thanks dude
Reply
#12

Quote:
Originally Posted by Finn
View Post
You don't really need the #.

pawn Code:
#define WHITE           "{FFFFFF}"
#define RED             "{FF0000}"
#define BLUE            "{0000FF}"
#define GREEN           "{00FF00}"
#define BLACK           "{000000}"
pawn Code:
SendClientMessage(playerid, 0xFFFFFFFF, ""BLACK" BLACK TEXT "WHITE" WHITE TEXT "RED" RED TEXT "BLUE" BLUE TEXT "GREEN" GREEN TEXT");
But having a # in front, makes it easier to read.But yeah, true.
Reply
#13

Quote:
Originally Posted by Zh3r0
View Post
pawn Code:
#define COL_WHITE          "{FFFFFF}"
#define COL_BLACK          "{0E0101}"
#define COL_GREY           "{C3C3C3}"
#define COL_GREEN          "{6EF83C}"
#define COL_RED            "{F81414}"
#define COL_YELLOW         "{F3FF02}"
#define COL_ORANGE         "{FFAF00}"
#define COL_LIME           "{B7FF00}"
#define COL_CYAN           "{00FFEE}"
...
More easy:
pawn Code:
stock hexToCol(hex)
{
new str[9];
format(str,9,"{%x}",hex);
return str;
}
   printf("%s",hexToCol(0xFF77EE));
   #define Color:xxx 0xFF77EE
   printf("%s",hexToCol(Color:xxx));
___
Nice tut,good for newbie
Reply
#14

Quote:
Originally Posted by Gavibro
View Post
More easy:
pawn Code:
stock hexToCol(hex)
{
new str[9];
format(str,9,"{%x}",hex);
return str;
}
   printf("%s",hexToCol(0xFF77EE));
   #define Color:xxx 0xFF77EE
   printf("%s",hexToCol(Color:xxx));
___
Nice tut,good for newbie
Not really... And I'm not a newbie. That be clear.
Reply
#15

show me where i say "zhero is a newbie".I just say "Nice tut,good for newbie",so this tutorial is easy to understand for beginners/newbie
xD
Reply
#16

Quote:
Originally Posted by Gavibro
View Post
More easy:
pawn Code:
stock hexToCol(hex)
{
new str[9];
format(str,9,"{%x}",hex);
return str;
}
   printf("%s",hexToCol(0xFF77EE));
   #define Color:xxx 0xFF77EE
   printf("%s",hexToCol(Color:xxx));
___
Nice tut,good for newbie
Zh3r0's method (defines) are a lot better and faster option than having a function for such a thing.

This is not only for newbies and this is not really a tutorial. More like a filterscript or include.
Reply
#17

Quote:
Originally Posted by Finn
View Post
Zh3r0's method (defines) are a lot better and faster option than having a function for such a thing.

This is not only for newbies and this is not really a tutorial. More like a filterscript or include.

"here's a working code, find out yourself what the fuck it does" is not a tutorial.
Can't agree more, but i actually explained what it does...
Reply
#18

Quote:
Originally Posted by Zh3r0
View Post
Can't agree more, but i actually explained what it does...
You have some small explanation how to use the code, not what it does.

I removed that last part from my post cuz I thought it might offend you, but damn I was too slow and you got to see it. lol
Reply
#19

Quote:
Originally Posted by Finn
View Post
You have some small explanation how to use the code, not what it does.

I removed that last part from my post cuz I thought it might offend you, but damn I was too slow and you got to see it. lol
No, it's good, i accept criticism too. I never get angry unless Calgon is speaking...
But i guess the majority understand what this is...
I explained how to use it, i guess the defines already explains what it does.
Reply
#20

Nice work man. I like this.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)