24.08.2018, 02:32
meu sistema de salvamento em Mysql salva numero inteiro string, mas nгo salva Float, (a tabela cria tudo certinho)
PHP код:
public OnGameModeInit()
{
conexao = mysql_connect("198.50.187.244", "GabrielS_1313", "GabrielS_1313", "Q7d68UAUU8");
if(mysql_errno( ))
{
mysql_reconnect(conexao);
printf("[MYSQL] Erro ao conectar a base de dados");
}
else {printf("[MYSQL] Servidor Conectado a base de dados");}
mysql_log(LOG_ERROR | LOG_WARNING);
mysql_function_query(conexao, "CREATE TABLE IF NOT EXISTS `contas` (`nome` VARCHAR(24) NOT NULL,`senha` VARCHAR(16) NOT NULL, `admin` VARCHAR(3) NOT NULL, `email` VARCHAR(30) NOT NULL, `skin` VARCHAR(3) NOT NULL, `vida` VARCHAR(4) NOT NULL, `colete` VARCHAR(4) NOT NULL, `dinheiro` VARCHAR(10) NOT NULL, `sx` VARCHAR(16) NOT NULL, `sy` VARCHAR(16) NOT NULL, `sz` VARCHAR(16) NOT NULL, `data` VARCHAR(12) NOT NULL)", false, "", "");
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
new Query[500], aname[MAX_PLAYER_NAME], dia, mes, ano;
new Float:c[3];
GetPlayerPos(playerid, c[0], c[1], c[2]);
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
getdate(ano, mes, dia);
PlayerInfo[playerid][pSkin] = GetPlayerSkin(playerid);
PlayerInfo[playerid][pDinheiro] = GetPlayerMoney(playerid);
GetPlayerHealth(playerid, PlayerInfo[playerid][pVida]);
GetPlayerArmour(playerid, PlayerInfo[playerid][pColete]);
format(Query, sizeof(Query), "UPDATE `contas` SET `admin`='%d', `skin`='%d', `dinheiro`='%f', `vida`='%f', `colete`='%f', `sx`='%f', `sy`='%f', `sz`='%f', `data`='%d/%d/%d', WHERE `nome` ='%s'", PlayerInfo[playerid][pAdmin], PlayerInfo[playerid][pSkin], PlayerInfo[playerid][pDinheiro], PlayerInfo[playerid][pVida], PlayerInfo[playerid][pColete], c[0], c[1], c[2], dia, mes, ano, aname);
mysql_function_query(conexao, Query, false, "", "");
return 1;
}