How to store colors in variable -
GospodinX - 03.08.2018
Hi guys,
I wan to store color in variable(like 0x80FF80FF etc)
I'm try this
it don't work)
1)
Код:
new color;
if(sscanf(inputtext, "d", color)) return SCM...
ClanInfo[CLAN_COLOR] = color;
2)
Код:
new color[25];
if(sscanf(inputtext, "s", color)) return SCM...
ClanInfo[CLAN_COLOR] = color;
I get error(in line ClanInfo...)
Quote:
must be assigned to an array
|
3)
Код:
new color;
if(sscanf(inputtext, "s", color)) return SCM...
ClanInfo[CLAN_COLOR] = color;
My server crash with this.
4)
Код:
new color[20];
if(sscanf(inputtext, "s[20]", color)) return SCM...
ClanInfo[CLAN_COLOR] = strval(color);
I don't have idea what to try...
Re: How to store colors in variable -
Dayrion - 03.08.2018
2)
Код:
new color[25];
if(sscanf(inputtext, "s", color)) return SCM...
ClanInfo[CLAN_COLOR] = color;
I get error(in line ClanInfo...)
What are you trying to do with that? ^
Re: How to store colors in variable -
DBZdabIt3Bro7 - 03.08.2018
Use X to define a Hexadecimal value.
PHP код:
new color;
sscanf(inputtext, "x", color);
https://sampwiki.blast.hk/wiki/Format
Re: How to store colors in variable -
RichardMagrao - 28.01.2019
where can i get color codes?
Re: How to store colors in variable -
fiki574 - 29.01.2019
Quote:
Originally Posted by GospodinX
My server crash with this.
4)
Код:
new color[20];
if(sscanf(inputtext, "s[20]", color)) return SCM...
ClanInfo[CLAN_COLOR] = strval(color);
I don't have idea what to try...
|
strval(string) tries to convert a string number to normal number, like so: "20" (string) -> strval -> 20 (integer)
I guess you're trying to store colors in format like "red", "green", "blue", etc. and calling strval upon those values crashes the server. So, you actually need to make a function that will "translate" the input color string to appropriate hex code.
Re: How to store colors in variable -
SytonicX - 29.01.2019
It's better if you defined your colors so you can use it more than once later on instead of using it like that..
Here is an example of how to define a color:
Код:
#define COLOR_WHITE (0xFFFFFFFF)