[Ajuda] MySQL
#1

Ola seres humanos( ou nгo, vai saber), estou tendo problemas com mysql! O meu personagem morre quando ele inicia.

PHP код:
// essas linhas eu apaguei, mas olhem como eu coloquei!
    
strcat(vitinho, "CREATE TABLE IF NOT EXISTS `Contas`(`Id` int AUTO_INCREMENT PRIMARY KEY, ");
    
strcat(vitinho, "`Nome` varchar(24) NOT NULL DEFAULT ' ', ");
    
strcat(vitinho, "`Senha` varchar(20) NOT NULL DEFAULT ' ', ");
    
strcat(vitinho, "`Skin` int(10) NOT NULL DEFAULT 0, ");
    
strcat(vitinho, "`Dinheiro` int(20) NOT NULL DEFAULT 0, ");
    
strcat(vitinho, "`Level` int(10) NOT NULL DEFAULT 0, ");
    
strcat(vitinho, "`Vida` float(10) NOT NULL DEFAULT 100.00, ");
    
strcat(vitinho, "`Colete` float(10) NOT NULL DEFAULT 100.00, ");
    
strcat(vitinho, "`Procurado` int(10) NOT NULL DEFAULT 0, ");
    
strcat(vitinho, "`Administrador` int(10) NOT NULL DEFAULT 0, ");
    
strcat(vitinho, "`Moderador` int(10) NOT NULL DEFAULT 0, ");
    
strcat(vitinho, "`Corregedor` int(10) NOT NULL DEFAULT 0, ");
    
strcat(vitinho, "`Comandante` int(10) NOT NULL DEFAULT 0, ");
    
strcat(vitinho, "`Patente` int(10) NOT NULL DEFAULT 0, ");
    
strcat(vitinho, "`Ajudante` int(10) NOT NULL DEFAULT 0, ");
    
strcat(vitinho, "`TemJetpack` int(10) NOT NULL DEFAULT 0)"); 
PHP код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(
dialogid)
    {
        case 
D_REGISTRO:
        {
            new 
query[300];
            if(!
response) Kick(playerid);
            if(
strlen(inputtext) < 4 || strlen(inputtext) > 20 || !strlen(inputtext))
            {
                
ShowPlayerDialog(playerid, D_REGISTRO, DIALOG_STYLE_PASSWORD, "{FF0000}Registro", "Digite sua senha pra se registrar", "Confirmar", "Cancelar");
                
Tentativas[playerid]++;
                return 
SendClientMessage(playerid, 0xFF0000AA, "[ ERRO ]Senhas variam de 4 a 20 caracteres!");
            }
            if(
Tentativas[playerid] == 3) return Kick(playerid);
            
mysql_format(Conexao, query, sizeof(query), "INSERT INTO `Contas`(`Nome`, `Senha`) VALUES ('%s', '%s')", Pname(playerid), inputtext);
            
mysql_query(Conexao, query, false);
        }
        case 
D_LOGIN:
        {
            new 
query[300];
            if(!
response) return Kick(playerid);
            if(
strlen(inputtext) < 4 || strlen(inputtext) > 20 || !strlen(inputtext))
            {
                
ShowPlayerDialog(playerid, D_LOGIN, DIALOG_STYLE_INPUT, "{FF0000}Login", "Digite uma senha pra se logar!", "Confirmar", "Cancelar");
                
Tentativas[playerid]++;
                
SendClientMessage(playerid, 0xFF0000AA, "[ ERRO ]Senha de 4 a 20 caracteres!");
                return 
1;
            }
            if(
Tentativas[playerid] == 3) return Kick(playerid);
            
mysql_format(Conexao, query, sizeof(query), "SELECT `Senha` FROM `Contas` WHERE `Nome`='%s'", Pname(playerid));
            
mysql_query(Conexao, query, true);
            
cache_get_value(0, "Senha", pInfo[playerid][Senha], 20);
            if(!
strcmp(pInfo[playerid][Senha], inputtext, true, 20))
            {
                
mysql_format(Conexao, query, sizeof(query), "SELECT * FROM `Contas` WHERE `Nome`='%s'", Pname(playerid));
                
mysql_query(Conexao, query, true);
                
cache_get_value_int(0, "Skin", pInfo[playerid][Skin]);
                
cache_get_value_int(0, "Dinheiro", pInfo[playerid][Dinheiro]);
                
cache_get_value_int(0, "Level", pInfo[playerid][Level]);
                
cache_get_value_float(0, "Vida", pInfo[playerid][Vida]);
                
cache_get_value_float(0, "Colete", pInfo[playerid][Colete]);
                
cache_get_value_int(0, "Procurado", pInfo[playerid][Procurado]);
                
cache_get_value_int(0, "Administrador", pInfo[playerid][Administrador]);
                
cache_get_value_int(0, "Moderador", pInfo[playerid][Moderador]);
                
cache_get_value_int(0, "Comandante", pInfo[playerid][Comandante]);
                
cache_get_value_int(0, "Patente", pInfo[playerid][Patente]);
                
cache_get_value_int(0, "Ajudante", pInfo[playerid][Ajudante]);
                
cache_get_value_int(0, "TemJetpack", pInfo[playerid][TemJetpack]);
                
SpawnPlayer(playerid);
            }
        }
    }
    return 
1;
} 
Reply


Messages In This Thread
MySQL - by vitinhosamp - 11.10.2018, 22:28
Re: MySQL - by GSantana - 11.10.2018, 22:54
Re: MySQL - by Malandrin - 11.10.2018, 23:14
Re: MySQL - by vitinhosamp - 13.10.2018, 11:20
Re: MySQL - by GSantana - 13.10.2018, 20:02

Forum Jump:


Users browsing this thread: 1 Guest(s)