Changing color transparency
#1

Hello,

Is it possible to change player color transparency and keeping the player color, so later I can change the transparency again?

Like:
Код:
From:
SetPlayerColor(playerid, 0xRRGGBBFF);
To:
SetPlayerColor(playerid, 0xRRGGBB00);
And keep player color, only transparency changed.
Reply
#2

Maybe with GetPlayerColor, probably you'll have to convert the color to a string to change the transparency.
Reply
#3

Код:
ToggleTransparency(playerid) 
{ 
    new 
        color = GetPlayerColor(playerid), 
        alpha = color & 0x000000FF; 

    return SetPlayerColor(playerid, color - alpha + ((!alpha) ? 0xFF : 0x00)); 
}
Thanks to Konstantinos for this.
https://sampwiki.blast.hk/wiki/Colour_Embedding#Doing_math
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)