12.06.2015, 09:47
Hello, i have a problem. I made a Login/Register system using MySql, but the problem now is the login. When you try to login even if you put the right password it dosen't work again. here's the onplayerpasswordresponse code:
here's the onplayerdialogresponse:
Oh and my database/tables
pawn Код:
forward OnPasswordResponse(playerid);
public OnPasswordResponse(playerid)
{
new num_fields,num_rows;
cache_get_data(num_rows,num_fields,dbhandel);
if(num_fields==1)
{
iInfo[playerid][loggt] = 1;
iInfo[playerid][score] = cache_get_field_content_int(0,"score",dbhandel);
}
else
{
SendClientMessage(playerid, BJELA, "Ukucana lozinka se ne poklapa sa ovim nalogom.");
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "LOGIN", "UPISITE VASU LOZINK KAKO BI PRISTUPILI SERVERU.", "LOGIN", "OTKAZI");
}
return 1;
}
pawn Код:
if(dialogid==DIALOG_LOGIN)
{
if(response)
{
new name[MAX_PLAYER_NAME],query[128],password[255];
GetPlayerName(playerid,name,sizeof(name));
if(strlen(inputtext)>0)
{
mysql_escape_string(inputtext,password,dbhandel);
format(query,sizeof(query),"SELECT * FROM acoounts WHERE username='%s' AND password='%s'",name,password);
mysql_function_query(dbhandel,query,true,"OnPasswordResponse","i",playerid);
}
else
{
SendClientMessage(playerid,BJELA,"Upisite vasu lozinku!");
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "LOGIN", "UPISITE VASU LOZINK KAKO BI PRISTUPILI SERVERU.", "LOGIN", "OTKAZI");
}
}
else
{
Kick(playerid);
}
return 1;
}