Changing color transparency - 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: Changing color transparency (
/showthread.php?tid=579756)
Changing color transparency -
Darkwood17 - 29.06.2015
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.
Respuesta: Changing color transparency -
[DOG]irinel1996 - 29.06.2015
Maybe with
GetPlayerColor, probably you'll have to convert the color to a string to change the transparency.
Re: Changing color transparency -
Darkwood17 - 29.06.2015
Код:
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