Help on colors calculation !!! - 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)
+--- Thread: Help on colors calculation !!! (
/showthread.php?tid=536798)
Help on colors calculation !!! -
FilesMAker - 12.09.2014
To change a player transparency for a player we do this:
For visible:
SetPlayerMarkerForPlayer(i, playerid, (GetPlayerColor(playerid) | 0x000000FF));
And to hide him we use :
SetPlayerMarkerForPlayer(i, playerid, (GetPlayerColor(playerid) & 0xFFFFFF00));
My question is about the color calculation, those calculs allow to change Transparency without touching color, but how to change color without touching the transparency ??
Thanks !
Re: Help on colors calculation !!! -
Affan - 12.09.2014
pawn Код:
stock SetPlayerColorAlpha(playerid, alpha) //By Betamaster
{
new r, g, b, a;
HexToRGBA(GetPlayerColor(playerid), r, g, b, a);
SetPlayerColor(playerid, RGBAToHex(r, g, b, alpha));
}
stock HexToRGBA(colour, &r, &g, &b, &a) //By Betamaster
{
r = (colour >> 24) & 0xFF;
g = (colour >> 16) & 0xFF;
b = (colour >> 8) & 0xFF;
a = colour & 0xFF;
}
So use it like
pawn Код:
SetPlayerColorAlpha(playerid, yourvalue);
Re : Help on colors calculation !!! -
FilesMAker - 12.09.2014
Thanks Affan, I don't want to set alpha I want to set color without touching alpha, but your help gave me the solution on an other way! Thanks to both of you (Affan & Betamaster)
[+1 Rep]