SA-MP Forums Archive
[AJUDA] MYSQL - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [AJUDA] MYSQL (/showthread.php?tid=312843)



[AJUDA] MYSQL - Jason` - 23.01.2012

Bem, estou criando um sistema de Gang Zones mas estou com um problema na hora de salvar a cor das gangzones na DB, exemplo: a cor da gangzone seria: 0xE31919FF

Como devo colocar na tabela? Double,Int?

Se a melhor opcao for INT, como posso converter a cor neste formato para integer, porque o codigo do DracoBlue

HexToInt(string[])
{
...
}

como podem ver so convertera a cor se estiver no formato "{E31919}", queria saber como posso converter a cor no formato 0xE31919FF para Integer ou se existe outra maneira melhor para carregar e salvar as cores na DB.


Re: [AJUDA] MYSQL - DreeH - 23.01.2012

pawn Код:
stock IntToHex(int)
{
    new
        str[15];
    format(str, sizeof(str), "%x", int);
    return str;
}
pawn Код:
stock HexToInt(hex)
{
    new
        str[15];
    format(str, sizeof(str), "%i", hex);
    return strval(str);
}



Re: [AJUDA] MYSQL - Jason` - 23.01.2012

vlw dreeh so tinha que mudar o HexToInt pra return strval(str); fiz isso ai deu certo, vlw


Re: [AJUDA] MYSQL - DreeH - 23.01.2012

Й, esqueci deste detalhe, mas, de qualquer forma, obrigado.