Player color alpha change. - 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: Player color alpha change. (
/showthread.php?tid=263043)
Player color alpha change. -
Zh3r0 - 20.06.2011
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.
Re: Player color alpha change. -
Mauzen - 20.06.2011
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.
Re: Player color alpha change. -
Alvord - 20.06.2011
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.
Re: Player color alpha change. -
Zh3r0 - 20.06.2011
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!
Re: Player color alpha change. -
Babul - 20.06.2011
Код:
NewColor=Color&0xffffff00+Alpha;
this is like the inversion of mauzens idea
Re: Player color alpha change. -
Alvord - 20.06.2011
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.