MySQL Problem
#1

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:

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]));
}
the clan color save in mysql table like this:

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;
split public:

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;
}
the color everytime its black...

thank in advance to helpers
Reply


Messages In This Thread
MySQL Problem - by EviLpRo - 11.08.2011, 11:16
Re: MySQL Problem - by MadeMan - 11.08.2011, 11:38
Re: MySQL Problem - by XGh0stz - 11.08.2011, 11:43
Re: MySQL Problem - by EviLpRo - 11.08.2011, 16:12

Forum Jump:


Users browsing this thread: 1 Guest(s)