29.05.2016, 02:43
Quote:
With bitwise operation you would basically do the same
Also nearly all colors in sa-mp are stored in RGBA color = 0xFFFF00FF; // Yellow with full alpha First you would extract each color red = color >>> 24; // shifting everything by 24 bits to the right green = color >> 16 & 0xFF; // shifting and extracting the rightmost 8 bit blue = color >> 8 & 0xFF; After that you simply multiply it and check if it went over 255 Additionally be sure that VALUE is a positive number red = min(0xFF, red * VALUE); // same for green and blue At the end you put it together color = red << 24 | green << 16 | blue << 8 | color & 0xFF; |