22.06.2011, 00:38
PHP код:
stock IntToHex(number) // Dutils.inc
{
new m=1;
new depth=0;
while (number>=m) {
m = m*16;
depth++;
}
depth--;
new str[255];
for (new i = depth; i >= 0; i--)
{
str[i] = ( number & 0x0F) + 0x30;
str[i] += (str[i] > '9') ? 0x07 : 0x00;
number >>= 4;
}
str[8] = '\0';
return str;
}
public OnPlayerConnect(playerid)
{
new string[100];
format(string,sizeof(string),"%x%x%x", random(255), random(255), random(255));
SetPlayerColor(playerid,IntToHex(strval(string)));
return true;
}