Player color alpha change.
#1

How can i change just the Alpha channel of the color of the player?

For example, my color currently is 0x94ED40FF, how can I just change the transparency?

Something like
pawn Код:
GetPlayerColor(playerid) +/- 0x000000FF
or something? I know it sounds rubbish, but any ideas? ****** is good into this.
Reply
#2

ANY_COLOR & 0x000000FF will return the alpha part only. This ranges from 0 (00) to 255 (FF)
So you could use this to set the alpha to whatever you like:

NEW_COL = ANY_COLOR - (ANY_COLOR & 0x000000FF) + new_alpha;

Where alpha should not be bigger than 255.
There might be more efficient methods, but this was the first one that came up in my mind.
Reply
#3

Make a function that would change the last two characters which changes the transparency. I think that's it.

EDIT: Not sure if you want to make a command for it. But yeah, to change the transparency, change the last two characters.
Reply
#4

Quote:
Originally Posted by Alvord
Посмотреть сообщение
Make a function that would change the last two characters which changes the transparency. I think that's it.

EDIT: Not sure if you want to make a command for it. But yeah, to change the transparency, change the last two characters.
I know what a HEX code is, I just need to change the Alpha channel via a function or a method, not human method, something that has to do with + and -.


@Mauzen, thanks, gotta try that!
Reply
#5

Код:
NewColor=Color&0xffffff00+Alpha;
this is like the inversion of mauzens idea
Reply
#6

Quote:
Originally Posted by Zh3r0
Посмотреть сообщение
I know what a HEX code is, I just need to change the Alpha channel via a function or a method, not human method, something that has to do with + and -.


@Mauzen, thanks, gotta try that!
Sorry and that's why I edited my post and asked.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)