if(dialogid == DIALOG_REGISTER) {
if(!response) return Kick(playerid);
if(response) {
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Please enter a valid password!", "Please enter a valid registration password\nTo continue press Register\n\nOxiRegister 1.0\n", "Register", "Quit");
else {
new vidainicial = 100;
new skininicial = 7;
SetPlayerSkin(playerid, skininicial);
SHA256_PassHash(inputtext, HASH_SENHA, pInfo[playerid][pSenha], 64);
GetPlayerIp(playerid, ip, sizeof(ip));
format(query, sizeof(query), "INSERT INTO `accounts` (`Username`, `Senha`, `IP`, `hp`, `playerlskin`) VALUES ('%s', '%s', '%s', '%i', '%i')"
, GetName(playerid), pInfo[playerid][pSenha], ip, vidainicial, skininicial);
mysql_query(ConnectMYSQL,query);
pInfo[playerid][Registered] = true;
pInfo[playerid][LoggedIn] = true;
Logado[playerid] = 1;
SendClientMessage(playerid, COLOR_GREY, "Conta registrada!");
cache_get_value_int(0, "UserID", pInfo[playerid][UserID]);
firstlogin[playerid] = true;
OnPlayerLogin(playerid);
}
}
return 1;
}
|
Coloque para printar o erro da query no console, depois mande-o aqui.
|
if(dialogid == DIALOG_REGISTER) {
if(!response) return Kick(playerid);
if(response) {
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Please enter a valid password!", "Please enter a valid registration password\nTo continue press Register\n\nOxiRegister 1.0\n", "Register", "Quit");
else {
new vidainicial = 100;
new skininicial = 7;
SetPlayerSkin(playerid, skininicial);
SHA256_PassHash(inputtext, HASH_SENHA, pInfo[playerid][pSenha], 64);
GetPlayerIp(playerid, ip, sizeof(ip));
format(query, sizeof(query), "INSERT INTO `accounts` (`Username`, `Senha`, `IP`, `hp`, `playerlskin`) VALUES ('%s', '%s', '%s', '%i', '%i')"
, GetName(playerid), pInfo[playerid][pSenha], ip, vidainicial, skininicial);
mysql_query(ConnectMYSQL,query);
printf("Dialog register MySQL error: %d", mysql_errno(ConnectMYSQL));
pInfo[playerid][Registered] = true;
pInfo[playerid][LoggedIn] = true;
Logado[playerid] = 1;
SendClientMessage(playerid, COLOR_GREY, "Conta registrada!");
cache_get_value_int(0, "UserID", pInfo[playerid][UserID]);
firstlogin[playerid] = true;
OnPlayerLogin(playerid);
}
}
return 1;
}
|
Код:
if(dialogid == DIALOG_REGISTER) {
if(!response) return Kick(playerid);
if(response) {
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Please enter a valid password!", "Please enter a valid registration password\nTo continue press Register\n\nOxiRegister 1.0\n", "Register", "Quit");
else {
new vidainicial = 100;
new skininicial = 7;
SetPlayerSkin(playerid, skininicial);
SHA256_PassHash(inputtext, HASH_SENHA, pInfo[playerid][pSenha], 64);
GetPlayerIp(playerid, ip, sizeof(ip));
format(query, sizeof(query), "INSERT INTO `accounts` (`Username`, `Senha`, `IP`, `hp`, `playerlskin`) VALUES ('%s', '%s', '%s', '%i', '%i')"
, GetName(playerid), pInfo[playerid][pSenha], ip, vidainicial, skininicial);
mysql_query(ConnectMYSQL,query);
printf("Dialog register MySQL error: %d", mysql_errno(ConnectMYSQL));
pInfo[playerid][Registered] = true;
pInfo[playerid][LoggedIn] = true;
Logado[playerid] = 1;
SendClientMessage(playerid, COLOR_GREY, "Conta registrada!");
cache_get_value_int(0, "UserID", pInfo[playerid][UserID]);
firstlogin[playerid] = true;
OnPlayerLogin(playerid);
}
}
return 1;
}
|
[21:36:07] [join] Bugreg has joined the server (IP) [21:36:11] Dialog register MySQL error: 1364
|
public OnQueryError(errorid, error[], callback[], query[], connectionHandle){ printf("-"); printf("[Erro id: %i", errorid); printf("da callback: %s.", callback); printf("Query: %s]", query); printf("-"); return 1; } |
public OnQueryError(errorid, const error[], const callback[], const query[], MySQL:handle) {
printf("-");
printf("[Erro id: %i", errorid);
printf("da callback: %s.", callback);
printf("Query: %s]", query);
printf("-");
return 1;
}
|
Код:
[21:36:07] [join] Bugreg has joined the server (IP) [21:36:11] Dialog register MySQL error: 1364 Vocк deve substituir "NOT NULL" e "NULL" por "DEFAULT" (no CREATE TABLE), assim prй-definirб as colunas. Exemplo: Код:
CREATE TABLE IF NOT EXISTS contas(ID int AUTO_INCREMENT PRIMARY KEY, Nome varchar(24) NOT NULL, Senha int NOT NULL, Score int(20) DEFAULT 0, Skin int(20) DEFAULT 26, Email varchar(100) DEFAULT 'nenhum@nada.com') |
if(dialogid == DIALOG_REGISTER) {
if(!response) return Kick(playerid);
if(response) {
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Please enter a valid password!", "Please enter a valid registration password\nTo continue press Register\n\nOxiRegister 1.0\n", "Register", "Quit");
else {
SHA256_PassHash(inputtext, HASH_SENHA, pInfo[playerid][pSenha], 64);
GetPlayerIp(playerid, ip, sizeof(ip));
format(query, sizeof(query), "INSERT INTO `accounts` (`Username`, `Senha`, `IP`) VALUES ('%e', '%s', '%s')"
, GetName(playerid), pInfo[playerid][pSenha], ip);
mysql_query(ConnectMYSQL,query);
printf("Dialog register MySQL error: %d", mysql_errno(ConnectMYSQL));
pInfo[playerid][Registered] = true;
pInfo[playerid][LoggedIn] = true;
Logado[playerid] = 1;
SendClientMessage(playerid, COLOR_GREY, "Registered account!");
cache_get_value_int(0, "UserID", pInfo[playerid][UserID]);
firstlogin[playerid] = true;
OnPlayerLogin(playerid);
}
}
return 1;
}
[09:35:22] [join] Bugregistro has joined the server (IP) [09:35:31] Dialog register MySQL error: 1406 [09:35:55] [part] Bugregistro has left the server (0:1)