19.03.2015, 12:06
Quote:
Just make sth like this:
Код:
stock ColorBetween(ColorA, ColorB) { new str[11]; valstr(str,ColorA); new x = strval(str); valstr(str,ColorB); new y = strval(str); return x-y; } printf("0x%x",ColorBetween(0xF, 0xA)); //-> Gives u 0x5 |
Quote:
At the very least, the right shift in your HexToInt function for red is wrong. This should be 24. Also you should use the logical right shift (>>>, three shevrons) instead of the arithmetic right shift (>>). With the arithmetic right shift the number will be padded with the value of the MSB, so if you try to shift anything with a red value greater than 7F the number will be padded with 1 in the front and you will end up with very weird results.
|