Help on colors calculation !!!
#1

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 !
Reply
#2

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);
Reply
#3

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]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)