mondjuk így:
stock RGB( red, green, blue, alpha )
{
/* Combines a color and returns it, so it can be used in functions.
@red: Amount of red color.
@green: Amount of green color.
@blue: Amount of blue color.
@alpha: Amount of alpha transparency.
-Returns:
A integer with the combined color.
*/
return (red * 16777216) + (green * 65536) + (blue * 256) + alpha;
}
stock strhex(string[])
{
new Param[8];
new red[3], green[3], blue[3], alpha[3];
sscanf(params,\"s[8]\",Param);
format(red, sizeof(red), \"%c%c\", Param, Param[1]);
format(green, sizeof(green), \"%c%c\", Param[2], Param[3]);
format(blue, sizeof(blue), \"%c%c\", Param[4], Param[5]);
if(Param[6] != \'\\0\') format(alpha, sizeof(alpha), \"%c%c\", Param[6], Param[7]);
else alpha = \"FF\";
return = RGB(HexToInt(red), HexToInt(green), HexToInt(blue), HexToInt(alpha));
}
A kód egy részét Zamaroht textdraw editorábol vettem.