02.11.2016, 10:12
Hi,
I have GetPlayerColor, i want to make it half transperent, how to do it?
I have GetPlayerColor, i want to make it half transperent, how to do it?
SetPlayerMarkerVisibility(playerid, alpha = 0xFF) { new oldcolor, newcolor; alpha = clamp(alpha, 0x00, 0xFF); // if an out-of-range value is supplied we'll fix it here first oldcolor = GetPlayerColor(playerid); // get their color - Note: SetPlayerColor must have been used beforehand newcolor = (oldcolor & ~0xFF) | alpha; // first we strip of all alpha data (& ~0xFF) and then we replace it with our desired value (| alpha) return SetPlayerColor(playerid, newcolor); // returns 1 if it succeeded, 0 otherwise }
SetPlayerMarkerVisibility(playerid, 0x7F);
SetPlayerMarkerVisibility(playerid, 0x4C); // 30% (255 * 0.3 = 76.5 (4c)) SetPlayerMarkerVisibility(playerid, 51); // 20% (255 * 0.2 = 51)