11.08.2011, 11:16
hello everyone
have me small problem with mysql.
i need return the clan color, and convert to rgba colors,
but the problem its is:
the stock:
the clan color save in mysql table like this:
101,252,11
101 - R
252 - G
11 - B
rgba2hex stock:
split public:
the color everytime its black...
thank in advance to helpers
have me small problem with mysql.
i need return the clan color, and convert to rgba colors,
but the problem its is:
the stock:
pawn Код:
stock GetClanColorName(const clanname[])
{
new szResult[256],Arg[3][70],Info[256];
format(szResult,256,"SELECT `Color` FROM `Clans` WHERE `Name`='%s'",clanname);
mysql_query(szResult);
mysql_store_result();
if(mysql_retrieve_row()) mysql_fetch_row_format(Info,"|");
mysql_free_result();
split(Info,Arg,',');
print(Info);
return rgba2hex(strval(Arg[0]),strval(Arg[1]),strval(Arg[2]));
}
101,252,11
101 - R
252 - G
11 - B
rgba2hex stock:
pawn Код:
stock rgba2hex(r,g,b,a=255) return (r*16777216) + (g*65536) + (b*256) + a;
pawn Код:
public split(const strsrc[], strdest[][], delimiter)
{
new i, li;
new aNum;
new len;
while(i <= strlen(strsrc)){
if(strsrc[i]==delimiter || i==strlen(strsrc)){
len = strmid(strdest[aNum], strsrc, li, i, 128);
strdest[aNum][len] = 0;
li = i+1;
aNum++;
}
i++;
}
return 1;
}
thank in advance to helpers