SA-MP Forums Archive
[Suggestion] Color embedding - 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: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Suggestion] Color embedding (/showthread.php?tid=194400)



[Suggestion] Color embedding - scottyishere - 29.11.2010

Isn't it possible instead of the {FFFFF} to be able to put {COLOR_YELLOW} since we already have them defined in our script. Redefining everything would be awful.

I would suggest this format:
pawn Код:
format(str,sizeof(str),"{%d}Hello, I am {%d}scottyishere",COLOR_YELLOW,COLOR_GREEN);
Also there's a little problem, the color embedding things are taking string space.
Like if I have a str[128] string and my chars are 127, if I add color embedding the last letters won't be seen. I need to make the string bigger which costs a lot of memory.
Can this be fixed anyhow?


Re: [Suggestion] Color embedding - JaTochNietDan - 29.11.2010

You can insert hex in format using %x


Re: [Suggestion] Color embedding - scottyishere - 29.11.2010

Ow... yeah your right! Didn't knew that.

Thanks, but the second problem still remains.


Re: [Suggestion] Color embedding - kurta999 - 29.11.2010

Or this ?

pawn Код:
SendClientMessage(playerid, COLOR_WHITE, "{" #COLOR_YELLOW "}Hello, {" #COLOR_WHITE "} this is my server.");



Re: [Suggestion] Color embedding - Mauzen - 29.11.2010

You put the color code into the string like any other text, and samp comverts it later. So no, there is no other way than increasing the string size.


Re: [Suggestion] Color embedding - scottyishere - 29.11.2010

Quote:
Originally Posted by JaTochNietDan
Посмотреть сообщение
You can insert hex in format using %x
An example?


Re: [Suggestion] Color embedding - PlayLSX - 29.11.2010

pawn Код:
format(str,sizeof(str),"%xHello, I am %xscottyishere",COLOR_YELLOW,COLOR_GREEN);



Re: [Suggestion] Color embedding - scottyishere - 29.11.2010

I have this code:

pawn Код:
SendFormattedMessage(playerid,COLOR_WHITE,">> Vehicle engine: %xOFF",COLOR_ERROR);
This is the SendFormattedMessage function:

pawn Код:
#define SendFormattedMessage(%0,%1,%2) do{new _str[128]; format(_str,128,%2); SendClientMessage(%0,%1,_str);}while(FALSE)
and it doesn't display any modified colors. Just some random text where the %x is.

Any ideas?


Re: [Suggestion] Color embedding - scottyishere - 29.11.2010

Unfortunately the %x is not working:

pawn Код:
#define COLOR_RED 0xCD000000
pawn Код:
format(str,128,"Hello, I like %xcheese",COLOR_RED);
SendClientMessage(playerid,COLOR_WHITE,str);
The output is a random characters where the %x is. Also if I add { } between the %x = {%x} it returns a different color from the defined one.

Any ideas?


Re: [Suggestion] Color embedding - Slice - 29.11.2010

The values for chat colors are without alpha; therefore, 0x00FF00FF should be 0x00FF00.