Convert color to string and opposite
#1

Now I stared to work on new clear self made GM, but I already can't figure out, it is posibble convert string to color and opposite, like, you can adjust your chat color by type color by self.
Reply
#2

Well now it belongs on if you want to have a command like /chatcolour or just have a command with these params /talk [colour] [text]
Reply
#3

I want use it in many ways:

Like SCM instead of SendClientMessage - saw this somewhere.
For chat where leader can change chat color by type /chatcolor 0x0..... and than thats color saving into a file as string and than I can make SendClientMessage(playerid,colorstring[],text);

something like that
Reply
#4

If you understood a Hex you'd know that there's 4 values:

pawn Код:
0xRRGGBBAA
Red, Green, Blue, Alpha

What you should do is use sscanf:

pawn Код:
if(!sscanf(params, "ddd", r, g, b))
And you then have the values that the user imputted, for example:

Код:
/chatcolour 0 30 255
Then use the function (somewhere on the forums) RGBAToHex, which should convert it into Hex.

Then save the Hex to a file.
Reply
#5

That I know, I just think is it posibble to store for example 0x000000FF into a file as for example Color[]

and than read from file as SendClientMessage(playerid,Color[] ?


If I use

/color 0x000000FF
tmp = strtok(....
SendClientMessage(playerid,tmp,"Hello world!");
Reply
#6

Yes, just use sscanf for that.
Reply
#7

Done, done and done thx , its really help me out, everything working well
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)