27.11.2014, 17:26
Hello, i have some weird things going on with my register system, when i register it sends a query to the database but it never appears into the database. Also the weird thing is that it always worked and now it has exactly 100 entries in the database and it does not let anyone register anymore. That is kind of weird. This is the log of the mysql:
This is the register dialog:
But when it executes, it seems like it succesfully executes but it doesnt actually appear in the database and i cant login onto the server. Anyone an idea why this doesnt work?
Код:
[19:09:28] [DEBUG] mysql_pquery - connection: 1, query: "INSERT INTO Users (Name,Password, Admin) VALUES ('K1ll3rw0rm2','", callback: "(null)", format: "(null)" [19:09:28] [DEBUG] mysql_pquery - connection: 1, query: "UPDATE Users SET IP = '******' WHERE Name='K1ll3rw0rm2'", callback: "(null)", format: "(null)" [19:09:28] [DEBUG] CMySQLQuery::Execute[] - starting query execution [19:09:28] [DEBUG] CMySQLQuery::Execute[] - starting query execution [19:09:28] [DEBUG] CMySQLQuery::Execute[] - query was successfully executed within 1.631 milliseconds [19:09:28] [ERROR] CMySQLQuery::Execute[] - (error #1364) Field 'Money' doesn't have a default value [19:09:28] [DEBUG] CMySQLQuery::Execute[] - no callback specified, skipping result saving
pawn Код:
Dialog_Register(playerid, response, inputtext[])
{
switch(response)
{
case 1:
{
new escpass[100];
mysql_real_escape_string(inputtext, escpass);
if(AccountExists[playerid])
return SendClientMessage(playerid, 0xFF0000, "[ACCOUNT] You're already registered!");
if(APlayerData[playerid][PlayerLogged] == 1)
return SendClientMessage(playerid, 0xFF0000, "[ACCOUNT] You're already logged in!");
if(strlen(inputtext) < 3 || strlen(inputtext) >= 32)
{
SendClientMessage(playerid, 0xFF0000, "[ACCOUNT] Your password is too short or too long!");
ShowPlayerDialog(playerid, DialogRegister, DIALOG_STYLE_PASSWORD, "Welcome to European Trucking", "Welcome to European Trucking please register in order to play", "Register", "Cancel");
}
CheckMySQL();
new string[500], buf[129];
WP_Hash(buf, 129, escpass);
format(string, sizeof(string), "INSERT INTO Users (Name,Password, Admin) VALUES ('%s','%s', '0')", APlayerData[playerid][Name], buf);
mysql_pquery( Handle, string, "", "" );
AccountExists[playerid] = 1;
SendClientMessage(playerid, 0xFF0000, "[ACCOUNT] Your account has been created, please login now!");
ShowPlayerDialog(playerid, DialogLogin, DIALOG_STYLE_PASSWORD, "Welcome to European Trucking", "Welcome to European Trucking please login in order to play", "Login", "Cancel");
new string1[128], IP[16], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
GetPlayerIp(playerid, IP, sizeof(IP));
format(string1, sizeof(string1), "UPDATE Users SET IP = '%s' WHERE Name='%s'", IP, pName);
mysql_pquery( Handle, string1, "", "" );
SendClientMessage(playerid, 0xFF0000, "You have been given 5.000$ starter money");
GivePlayerCash(playerid, 5000);
SavePlayer(playerid);
}
case 0:
{
Kick(playerid);
}
}
return 1;
}