SetPlayerColor issue -
Shaneisace - 19.02.2013
Ok so wanting to set a Player color blue for example this way works fine
pawn Код:
#define COLOR_BLUE 0x2641FE00
SetPlayerColor(playerid,COLOR_BLUE);
or
pawn Код:
SetPlayerColor(playerid, 0x2641FE00);
But i have the color loading from mysql which
(Which looks like this 2507262) all works well as it prints "2641FE" like normal
but having issues making it the correct color for SetPlayerColor i need to know how can i make it 0x2641FE00 so it defines the correct color?
Since i can't use strings i can't find a way around it
example:
pawn Код:
SetPlayerColor(playerid,PlayerInfo[playerid][pColor]);
It's not even a color i'm trying to define
But this works fine
pawn Код:
format(string, sizeof(string), "This is your {%x}Color", PlayerInfo[playerid][pColor]);
SendClientMessage(playerid, COLOR_WHITE ,string);
That works fine just need a way of correctly setting it for PlayerSetColor, if anyone knows how that would be great full
P.S I've tried searching the forums but getting no luck with it.
Re: SetPlayerColor issue -
zDevon - 19.02.2013
Why not store their color as a string instead and store the names of your defines?
Re: SetPlayerColor issue -
Shaneisace - 19.02.2013
Quote:
Originally Posted by zDevon
Why not store their color as a string instead and store the names of your defines?
|
From what I've read you have to store than as integers and not as strings
It's only the SetPlayerColor i'm only having the issues with
Re: SetPlayerColor issue -
MP2 - 19.02.2013
Colors are integers. Hex is an integer. They work vise-versa. Just save/load it as an integer.
Re: SetPlayerColor issue -
Shaneisace - 19.02.2013
Quote:
Originally Posted by MP2
Colors are integers. Hex is an integer. They work vise-versa. Just save/load it as an integer.
|
I do, but the color is no where near what it displays in SendClientMessage which is the issue i'm having also i save them as %i if that's any help?
Also i need it to load as an RBGA so i can make it no display on the mini-map which pretty sure >>> 8 can cover?
Re: SetPlayerColor issue -
zDevon - 19.02.2013
Quote:
Originally Posted by Shaneisace
From what I've read you have to store than as integers and not as strings
It's only the SetPlayerColor i'm only having the issues with
|
I meant if you were to store, instead of the color's value, it's define. I.e storing COLOR_BLUE in PlayerInfo[playerid][pColor].
Re: SetPlayerColor issue -
Shaneisace - 19.02.2013
Quote:
Originally Posted by zDevon
I meant if you were to store, instead of the color's value, it's define. I.e storing COLOR_BLUE in PlayerInfo[playerid][pColor].
|
oh i can't, cause the player can choose their own color, which is why it's stored the way i have it lol but struggling to get my head around the setplayercolor :P
EDIT:
When i try to this:
pawn Код:
stock GetColor(hex)
{
new
str[15];
format(str, sizeof(str), "0x%6x00", hex);
return str;
}
i get this error: error 035: argument type mismatch (argument 2) but this would give me the value for the correct color due to the string
EDIT:
this can be closed now, i fixed it using << 8 appears to have solved the issue