[Ajuda] Verificar e criar tabela MySqL
#1

Fiz esse cod para quando o server iniciar verificar se tem uma tabela existente mas sempre quando adiciono mais linha ele da erro no gm


PHP код:
new Query[500];
new 
MySQL:SqL
public 
OnGameModeInit()
{
    
SqL mysql_connect(SQL_HOSTSQL_USERSQL_PASSSQL_DB);
    
mysql_log(WARNING ERROR);
    if(!
mysql_errno(SqL))
    {
        
strcat(SqL"CREATE TABLE IF NOT EXISTS `contas`\
       (`id`INT(11) AUTO_INCREMENT PRIMARY KEY,\
        `usuario`varchar(24) NOT NULL,\
        `senha` varchar(20) NOT NULL,\
        `skin` INT(20) NOT NULL,\
        `aAdmin` INT(11) NOT NULL,\
        `Admin` INT(11) NOT NULL\
        `Gasolina` INT(11) NOT NULL,\
        `Etanol` INT(11) NOT NULL,\
        `Diesel` INT(11) NOT NULL,\
        `GNV` INT(11) NOT NULL,\
        `Dinheiro` INT(11) NOT NULL,\
        `sBancario` INT(11) NOT NULL,\
        `Profissao` INT(11) NOT NULL,\
        `Cidade` INT(11) NOT NULL,\
        `cX` float  NOT NULL,\
        `cY` float  NOT NULL,\ //Linha do erro
        `cZ` float NOT NULL)"
);//Linha do erro
        
mysql_query(SqLQueryfalse);
        print(
"->> Conectado com sucesso ao |BANCO de DADOS|.");
    }
    else print(
"<<- Erro ao conectar ao x|BANCO de DADOS|x.");
    return 
1;

erro ao compilar

Код:
error 075: input line too long (after substitutions)
error 035: argument type mismatch (argument 1)
error 017: undefined symbol "CREATE"
error 017: undefined symbol "TABLE"
fatal error 107: too many error messages on one line
Reply
#2

tire os \ no final das linhas!
Reply
#3

Use esse compilador:
https://sampforum.blast.hk/showthread.php?pid=2768123#pid2768123
Reply
#4

Quote:
Originally Posted by PedroH
Посмотреть сообщение
tire os \ no final das linhas!
Jб fiz o teste mas nгo adiantou em nada. Continua o mesmo erro

Quote:
Originally Posted by RodrigoMSR
Посмотреть сообщение
Tambйm nгo o adiantou, o erro continua o mesmo.
Reply
#5

tente assim:

PHP код:
     new Query[500]; 
    
SqL mysql_connect(SQL_HOSTSQL_USERSQL_PASSSQL_DB); 
    
mysql_log(WARNING ERROR); 
    if(!
mysql_errno(SqL)) 
    { 
         
format(Query500"CREATE TABLE IF NOT EXISTS contas (`id`INT(11) AUTO_INCREMENT PRIMARY KEY, `usuario`varchar(24) NOT NULL, `senha` varchar(20) NOT NULL, `skin` INT(20) NOT NULL, `aAdmin` INT(11) NOT NULL, `Gasolina` INT(11) NOT NULL, `Etanol` INT(11) NOT NULL, `Diesel` INT(11) NOT NULL, `GNV` INT(11) NOT NULL, `Dinheiro` INT(11) NOT NULL, `sBancario` INT(11) NOT NULL, `Profissao` INT(11) NOT NULL, `Cidade` INT(11) NOT NULL, `cX` float  NOT NULL, `cY` float  NOT NULL, `cZ` float NOT NULL)");
         
mysql_query(SqLQueryfalse); 
    } 
se nao consegui tente assim:

PHP код:
        strcat(SqL"CREATE TABLE IF NOT EXISTS `contas`\
       (`id`INT(11) AUTO_INCREMENT PRIMARY KEY,\
        `usuario`varchar(24) NOT NULL,\
        `senha` varchar(20) NOT NULL,\
        `skin` INT(20) NOT NULL,\
        `aAdmin` INT(11) NOT NULL,\
        `Admin` INT(11) NOT NULL,\
        `Gasolina` INT(11) NOT NULL,\
        `Etanol` INT(11) NOT NULL,\
        `Diesel` INT(11) NOT NULL,\
        `GNV` INT(11) NOT NULL,\
        `Dinheiro` INT(11) NOT NULL,\
        `sBancario` INT(11) NOT NULL,\
        `Profissao` INT(11) NOT NULL,\
        `Cidade` INT(11) NOT NULL,\
        `cX` float  NOT NULL,\
        `cY` float  NOT NULL,\
        `cZ` float NOT NULL)"
);
        
mysql_query(SqLQueryfalse); 
OBS: Certifique-se de tirar todos os espaзos depois da \


se nao der tente dessa forma:

PHP код:
new string[512];
strcat(string,"texto aqui, texto aqui, texto aqui, texto aqui, texto aqui, texto aqui, texto aqui, texto aqui, ");
strcat(string,"texto aqui, texto aqui, texto aqui, texto aqui, texto aqui, texto aqui, texto aqui, texto aqui, ");
strcat(string,"texto aqui, texto aqui, texto aqui, texto aqui, texto aqui, texto aqui, texto aqui, texto aqui, ");
mysql_query(string); 
exemplo:
PHP код:
    strcat(query"CREATE TABLE IF NOT EXISTS contas(ID int AUTO_INCREMENT PRIMARY KEY, Nome varchar(24) NOT NULL, Senha int NOT NULL, Registro varchar(60) NOT NULL, Score int(20) DEFAULT 0, Admin int(20) DEFAULT 0, Skin int DEFAULT 230, Clan varchar(25) DEFAULT 'Nenhum', ClanL int DEFAULT 0, Dinheiro int(20) DEFAULT 0, Matou int(10) DEFAULT 0, Morreu int(10) DEFAULT 0, IP varchar(20) DEFAULT '255.255.255.255', Banido int(10) DEFAULT 0, Ban_admin varchar(24) DEFAULT 'Ninguem', ");
    
strcat(query"Ban_motivo varchar(100) DEFAULT 'Nenhum', Ban_time int DEFAULT 0, Fome float DEFAULT 100.0, Sede float DEFAULT 100.0, Vida float DEFAULT 100.0, Colete float DEFAULT 100.0, pX float DEFAULT 0.0, pY float DEFAULT 0.0, pZ float DEFAULT 0.0, pA float DEFAULT 0.0, pInt int DEFAULT 0, pWorld int DEFAULT 0, Arma0 int DEFAULT 0, Arma1 int DEFAULT 0, Arma2 int DEFAULT 0, Arma0A int DEFAULT 0, Arma1A int DEFAULT 0, Arma2A int DEFAULT 0, LDTime int DEFAULT 0, Exp int DEFAULT 1, ");
    
strcat(query"Online int DEFAULT 0, OnlineT int DEFAULT 0)"); 
Reply
#6

Colocou os arquivos na pasta pawno correta? Tente compilar abrindo o pawno da pasta.
Reply
#7

Quote:
Originally Posted by PedroH
Посмотреть сообщение
tente assim:

PHP код:
     new Query[500]; 
    
SqL mysql_connect(SQL_HOSTSQL_USERSQL_PASSSQL_DB); 
    
mysql_log(WARNING ERROR); 
    if(!
mysql_errno(SqL)) 
    { 
         
format(Query500"CREATE TABLE IF NOT EXISTS contas (`id`INT(11) AUTO_INCREMENT PRIMARY KEY, `usuario`varchar(24) NOT NULL, `senha` varchar(20) NOT NULL, `skin` INT(20) NOT NULL, `aAdmin` INT(11) NOT NULL, `Gasolina` INT(11) NOT NULL, `Etanol` INT(11) NOT NULL, `Diesel` INT(11) NOT NULL, `GNV` INT(11) NOT NULL, `Dinheiro` INT(11) NOT NULL, `sBancario` INT(11) NOT NULL, `Profissao` INT(11) NOT NULL, `Cidade` INT(11) NOT NULL, `cX` float  NOT NULL, `cY` float  NOT NULL, `cZ` float NOT NULL)");
         
mysql_query(SqLQueryfalse); 
    } 
se nao consegui tente assim:

PHP код:
        strcat(SqL"CREATE TABLE IF NOT EXISTS `contas`\
       (`id`INT(11) AUTO_INCREMENT PRIMARY KEY,\
        `usuario`varchar(24) NOT NULL,\
        `senha` varchar(20) NOT NULL,\
        `skin` INT(20) NOT NULL,\
        `aAdmin` INT(11) NOT NULL,\
        `Admin` INT(11) NOT NULL,\
        `Gasolina` INT(11) NOT NULL,\
        `Etanol` INT(11) NOT NULL,\
        `Diesel` INT(11) NOT NULL,\
        `GNV` INT(11) NOT NULL,\
        `Dinheiro` INT(11) NOT NULL,\
        `sBancario` INT(11) NOT NULL,\
        `Profissao` INT(11) NOT NULL,\
        `Cidade` INT(11) NOT NULL,\
        `cX` float  NOT NULL,\
        `cY` float  NOT NULL,\
        `cZ` float NOT NULL)"
);
        
mysql_query(SqLQueryfalse); 
OBS: Certifique-se de tirar todos os espaзos depois da \


se nao der tente dessa forma:

PHP код:
new string[512];
strcat(string,"texto aqui, texto aqui, texto aqui, texto aqui, texto aqui, texto aqui, texto aqui, texto aqui, ");
strcat(string,"texto aqui, texto aqui, texto aqui, texto aqui, texto aqui, texto aqui, texto aqui, texto aqui, ");
strcat(string,"texto aqui, texto aqui, texto aqui, texto aqui, texto aqui, texto aqui, texto aqui, texto aqui, ");
mysql_query(string); 
exemplo:
PHP код:
    strcat(query"CREATE TABLE IF NOT EXISTS contas(ID int AUTO_INCREMENT PRIMARY KEY, Nome varchar(24) NOT NULL, Senha int NOT NULL, Registro varchar(60) NOT NULL, Score int(20) DEFAULT 0, Admin int(20) DEFAULT 0, Skin int DEFAULT 230, Clan varchar(25) DEFAULT 'Nenhum', ClanL int DEFAULT 0, Dinheiro int(20) DEFAULT 0, Matou int(10) DEFAULT 0, Morreu int(10) DEFAULT 0, IP varchar(20) DEFAULT '255.255.255.255', Banido int(10) DEFAULT 0, Ban_admin varchar(24) DEFAULT 'Ninguem', ");
    
strcat(query"Ban_motivo varchar(100) DEFAULT 'Nenhum', Ban_time int DEFAULT 0, Fome float DEFAULT 100.0, Sede float DEFAULT 100.0, Vida float DEFAULT 100.0, Colete float DEFAULT 100.0, pX float DEFAULT 0.0, pY float DEFAULT 0.0, pZ float DEFAULT 0.0, pA float DEFAULT 0.0, pInt int DEFAULT 0, pWorld int DEFAULT 0, Arma0 int DEFAULT 0, Arma1 int DEFAULT 0, Arma2 int DEFAULT 0, Arma0A int DEFAULT 0, Arma1A int DEFAULT 0, Arma2A int DEFAULT 0, LDTime int DEFAULT 0, Exp int DEFAULT 1, ");
    
strcat(query"Online int DEFAULT 0, OnlineT int DEFAULT 0)"); 
Resolvido. testei todas as opзхes e funcionou.

Agora gostaria que pude-se a arrumar o problema do meu servidor que so ler apenas um plugin.

https://sampforum.blast.hk/showthread.php?tid=640431
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)