19.02.2015, 03:36
I wanna to ask something..
What this error mean?
That's happen to DIALOG_REGISTER
This my script.
This my Register script
What this error mean?
pawn Код:
[10:32:11] [debug] AMX backtrace:
[10:32:11] [debug] #0 native mysql_query () [b7447b50] from mysql.so
[10:32:11] [debug] #1 00553e40 in public OnDialogResponse (0x00000016, 0x00000fe7, 0x00000001, 0xffffffff, 0x01e142e0) from tes12.amx
This my script.
pawn Код:
public CheckName(playerid)
{
SetPlayerVirtualWorld(playerid, playerid);
ClearChatbox(playerid);
new
query[300],
string2[128],
playerEscapedName[MAX_PLAYER_NAME],
namap[MAX_PLAYER_NAME],
result[128],
active;
GetPlayerName(playerid, namap, MAX_PLAYER_NAME);
mysql_real_escape_string(namap, playerEscapedName);
format(query, sizeof(query), "SELECT * FROM `playerdata` WHERE `NormalName` = '%s'", playerEscapedName);
mysql_query(query);
mysql_store_result();
if(mysql_num_rows() == 0) {
if(!IsPlayerConnected(playerid)) mysql_free_result(); // Incase they're disconnected since... Sometimes queries F*"!%$" up.
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
if(strlen(playername) > 24) {
SendClientMessage(playerid, COLOR_GREY, "Your name too long, please change to another nickname");
KickWithMessage(playerid);
mysql_free_result();
return 1;
}
WrongPass[playerid] = 0;
ShowMainMenuDialog(playerid, 2);
mysql_free_result();
}
else {
if(!IsPlayerConnected(playerid)) mysql_free_result();
mysql_get_field("pPass", PlayerInfo[playerid][pPass]);
if(active == 0 || active == 2)
{
ShowMainMenuDialog(playerid, 4);
}
mysql_free_result();
}
return 1;
}
pawn Код:
if(dialogid == DIALOG_REGISTER)
{
if(strlen(inputtext) < 1)
{
ShowMainMenuDialog(playerid, 2);
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
new
query[400],
playerEscapedName[MAX_PLAYER_NAME];
mysql_real_escape_string(sendername, playerEscapedName);
format(query, sizeof(query), "SELECT * FROM `playerdata` WHERE `NormalName` = '%s'", playerEscapedName);
mysql_query(query);
mysql_store_result();
if(mysql_num_rows() > 0)
{
SendClientMessageEx(playerid, COLOR_YELLOW, "That username is already taken, please choose a different one.");
return 1;
}
else
{
new
namap[MAX_PLAYER_NAME],
pass[128];
GetPlayerName(playerid, namap, MAX_PLAYER_NAME);
mysql_real_escape_string(namap, sendername);
mysql_real_escape_string(inputtext, pass);
format(query, sizeof(query), "INSERT INTO playerdata (NormalName, pKey, RealActive) VALUES('%s', MD5('%s'), '0')", sendername, pass);
mysql_query(query);
//SetPVarString(playerid, "LogPass", inputtext);
SendClientMessageEx(playerid, COLOR_YELLOW, "Your account has registered");
//ShowMainMenuDialog(playerid, 4);
//OnPlayerLogin(playerid, inputtext);
format(PlayerInfo[playerid][pQuery], 300, "SELECT * FROM `playerdata` WHERE NormalName = '%s' AND pKey = MD5('%s')", sendername, inputtext);
mysql_query(PlayerInfo[playerid][pQuery], THREAD_LOGIN, playerid);
}
mysql_free_result();
}