PDA

View Full Version : [Tutorial] SA-MP GameTextForPlayer + Normal Colors and where to put them.


Ehab1911
19/11/2010, 04:57 AM
Hello, I want to make this Topic to make it easier on you to:
1) Get the colo(u)rs of San Andreas Multiplayer(R) PAWNO.
2) Get the GameTextForPlayer Colors.
3) Help the new scripters like me, to understand where to put GameTextForPlayer's Colors at.


Okay Let's start with #1:

First of all, colors help you to get more focus and wake when you read stuff, because everything in white/black is not really cool, so Colors makes you feel WAY better while reading something plus it helps you to figure out Team-Mates and like in the RPG who is the Don and these stuff. Those colors are used in SendClientMessage. For Example SendClientMessage(playerid, color/colorid, " Hello world.");. So, Lets start.

Now if you want to make a command with colors, like for examle you want to make a teleporting command and to show a Text or something for the player to read, or at least to know where he's at or something.

if (strcmp("/sanfierro", cmdtext, true, 10) == 0)
{
SetPlayerPos(playerid, X,Y,Z); // That's not what we need, these are the coords. You'll find a tutorial on them later on.
SendClientMessage(playerid, COLOR_RED, " Welcome to San Fierro ");
return 1;
}

You see where I wrote COLOR_RED? that's the colors tab in SendClientMessage, You can change that WHEN I give you the defines of the colors, and here are they:

* YOU PUT THEM ON THE TOP OF YOUR SCRIPT UNDER #include<a_samp>.

#define COLOR_GRAD1 0xB4B5B7FF
#define COLOR_GRAD2 0xBFC0C2FF
#define COLOR_GRAD3 0xCBCCCEFF
#define COLOR_GRAD4 0xD8D8D8FF
#define COLOR_GRAD5 0xE3E3E3FF
#define COLOR_GRAD6 0xF0F0F0FF
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x9EC73DAA
#define COLOR_GROVE 0x00FF00FF
#define COLOR_RED 0xAA3333AA
#define COLOR_COOLRED 0xB35959AA
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_PINK 0xFF66FFAA
#define COLOR_DARKRED 0x660000AA
#define COLOR_BRIGHTRED 0xFF0000AA
#define COLOR_INDIGO 0x4B00B0AA
#define COLOR_VIOLET 0x9955DEEE
#define COLOR_GRAYWHITE 0xEEEEFFC4
#define COLOR_LIGHTNEUTRALBLUE 0xabcdef66
#define COLOR_GREENISHGOLD 0xCCFFDD56
#define COLOR_LIGHTBLUEGREEN 0x0FFDD349
#define COLOR_NEUTRALBLUE 0xABCDEF01
#define COLOR_LIGHTCYAN 0xAAFFCC33
#define COLOR_LEMON 0xDDDD2357
#define COLOR_LIGHTRED 0xFF6347AA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_LIGHTGREEN 0x9ACD32AA
#define COLOR_YELLOW 0xDABB3EAA
#define COLOR_YELLOW2 0xF5DEB3AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_FADE1 0xE6E6E6E6
#define COLOR_FADE2 0xC8C8C8C8
#define COLOR_FADE3 0xAAAAAAAA
#define COLOR_FADE4 0x8C8C8C8C
#define COLOR_FADE5 0x6E6E6E6E
#define COLOR_PURPLE 0xC2A2DAAA
#define COLOR_CHAT1 0xF9B7FFAA
#define COLOR_CHAT2 0xE6A9ECAA
#define COLOR_CHAT3 0xC38EC7AA
#define COLOR_CHAT4 0xD2B9D3AA
#define COLOR_CHAT5 0xC6AEC7AA
#define COLOR_ALLDEPT 0xFF8282AA
#define COLOR_NEWS 0x458E1DAA
#define COLOR_OOC 0xE0FFFFAA //this color is for the OOC Messages if u have /o or /ooc chat in your server

Ok, these are the colors, now when you come to make a command you SELECT any color you want by It's name if you do #define COLORNAME it'sid, so you don't need to write down the IDs of the colors, but you need to put just COLOR_NAME like COLOR_PURPLE, you got me? ok good. :)..

Now Tutorial #2:

You might ask what is GameTextForPlayer. GameTextForPlayer is a text BUT it comes with textdraw thingie, so It's not like the ClientMessage, It's like when you Enter any vehicle in Single Player, it shows a text of the name of the car, that's a GameText. So, GameText has 7 types/styles, I'll attach them while I writing the tutorial. Also it has it's own timer. Here is an Example:

if (strcmp("/sanfierro", cmdtext, true, 10) == 0)
{
GameTextForPlayer(playerid,"Welcome to San Fierro",2000,5);//<-- that's what we need now.
SetPlayerPos(playerid,X,Y,Z);
return 1;
}

now as you see, I wrote GameTextForPlayer(PLAYERID,"MSG",TIMER,STYLE);

playerid: The playerid to show the text to.

const string[]: The text you want to display on the screen.

time: The time you want the text to display for, in milliseconds.

style: The style you want to show the text in.

Now you Wonder: WHERE TO PUT THE COLORS IN THE GAMETEXT?

Well GameText's colors are way different than the ClientMessage's Colors.

They're:

~r~ red
~g~ green
~b~ blue
~w~ white
~y~ yellow
~p~ purple
~l~ black
~n~ new line
~h~ lighter color

As you notice there is a "~" that covers the first charachter of the color name. like ~g~ = green. Now I'm gonna show you how to put these colors in the message. If you scroll up you'll notice I put the GameText in a command, now let me just explain it without that command.

GameTextForPlayer(playerid,"Welcome to San Fierro",2000,5);//<-- that's what we need now.

You See the Message: " Welcome to San Fierro " ? Now BETWEEN The message's Charachters these colors could be at. For example:

GameTextForPlayer(playerid,"~r~Welcome ~y~to ~g~San ~p~Fierro",2000,5);//<-- that's what we need now.

That will make:

Welcome = Red
to = Yellow
San = Green
and Fierro = Purple

So, These are the colors, now lets talk about GameText styles. There are 7 STYLES for GameText message.
0) http://wiki.sa-mp.com/wroot/images2/0/00/Game-text-type0.jpg
1) http://wiki.sa-mp.com/wroot/images2/e/ef/Game-text-type1.jpg
2) http://wiki.sa-mp.com/wroot/images2/4/47/Game-text-type2.jpg
3) http://wiki.sa-mp.com/wroot/images2/1/13/Game-text-type3.jpg
4) http://wiki.sa-mp.com/wroot/images2/1/1b/Game-text-type4.jpg
5) http://wiki.sa-mp.com/wroot/images2/1/14/Game-text-type5.jpg
6) http://wiki.sa-mp.com/wroot/images2/4/4c/Game-text-type6.jpg

Now you can put these Styles/Types of GameText in this row:

GameTextForPlayer(playerid,"Welcome To San Fierro",3000,HERE);
so you Replace HERE with a type/style of the 6 styles/types.
E.G.

GameTextForPlayer(playerid,"Welcome To San Fierro",3000,6);//this will put Style/Type number 6..

So this is the tutorial that I wanted to make for you guys, I hope this was helpful.

Lorenc_
21/11/2010, 05:20 AM
Huh, Why'd you duplicate the same topic?

Aleluja
21/11/2010, 08:18 PM
Nice Tutorial. ;)

Ehab1911
22/11/2010, 12:51 PM
Thanks Aleluja :D

Dime
22/11/2010, 07:43 PM
All this is in samp wiki

Iphone1234g
13/06/2011, 03:37 PM
dont copy other idea's just think new not old!

Ehab1911
13/06/2011, 04:04 PM
Yes, this was an old topic of me, I just posted it here, to make it easty-to-find for players who doesn't know about the wiki :)

L84S
13/06/2011, 06:31 PM
Nice tutorial Ehab.
Continue to strive :D
Sry for my bad english.

Jack_Rocker
13/06/2011, 10:24 PM
Nice! Keep stealing tutorials and you will do just fine!

Cenation
14/06/2011, 01:57 AM
nice but it is also on samp wiki and on SAMP forums too....

Ehab1911
21/07/2011, 05:25 PM
up2help