17.11.2017, 21:54
Hello guys, i have a little problem with the encrypt of password, if you login but you dont put your password right, you will spawn with the coordenate 0,0,0,0,0 health 0, etc.. its a little bug, but i don't know if i'm making it correctly, this is the code that i have... pd: is my GM since 0
Код:
//QueryFinish forward OnQueryFinish(resultid, extraid, ConnectionHandle); public OnQueryFinish(resultid, extraid, ConnectionHandle) { new Rows, Field, content[20]; if(resultid != 0) { cache_get_data(Rows, Field); } switch(resultid) { case 1: { if(Rows == 1) { } else if(!Rows) { Kick(extraid); } } case 2: { if(Rows == 1) { cache_get_field_content(0, "id_account", content); gpi[extraid][id] = strval(content); cache_get_field_content(0, "taxi", content); gpi[extraid][CheckTaxi] = strval(content); new gquery[256]; format(gquery, sizeof(gquery), "SELECT `password` = SHA1('%s'), `email` = SHA1('%s') FROM `accounts` WHERE name='%s'",gpi[extraid][Password],gpi[extraid][email],gname(extraid)); mysql_function_query(gmysql, gquery, true, "", "",2, extraid); ShowPlayerDialog(extraid, login1, DIALOG_STYLE_INPUT,"Esta cuenta esta registrada", "Ingresa tu email:","Siguiente","Salir"); } else if(!Rows) { ShowPlayerDialog(extraid, register1, DIALOG_STYLE_INPUT,"Esta cuenta no esta registrada","Ingresa un email (valido):","Siguiente","Salir"); } } } return 1; } //DIALOG RESPONSE public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { new stringp[128], stringe[128]; switch(dialogid) { case login1: { if(!response) Kick(playerid); if(!strcmp(inputtext, gpi[playerid][email])) { return ShowPlayerDialog(playerid, login2, DIALOG_STYLE_PASSWORD, "[TNW] Loguear cuenta", "Ingrese su contraseсa:", "Entrar", "Salir"); } else { SendClientMessage(playerid, -1, "[TNW] {D0FF00}Error: {FFFFFF}Email incorrecto, intentelo de nuevo."); ShowPlayerDialog(playerid, login1, DIALOG_STYLE_INPUT, "[Error] Email incorrecto", "Ingrese su email", "Siguiente", "Salir"); } } case login2: { if(!response) Kick(playerid); if(!strcmp(inputtext, gpi[playerid][Password])) { OnPlayerLoad(playerid); } else { SendClientMessage(playerid, -1, "[TNW] {D0FF00}Error: {FFFFFF}Contraseсa incorrecta, intentelo de nuevo."); ShowPlayerDialog(playerid, login2, DIALOG_STYLE_PASSWORD, "[Error] Contraseсa incorrecta", "Ingrese su contraseсa", "Siguiente", "Salir"); } } case register1: { if(!response) return Kick(playerid); if(strlen(inputtext) < 10) { SendClientMessage(playerid, -1, "[TNW] {D0FF00}Error: {FFFFFF}Por favor ingrese un email valido."); return ShowPlayerDialog(playerid, register1, DIALOG_STYLE_INPUT, "[Error] Verifique su email","Ingresa un email (valido):", "Siguiente", "Salir"); } else { format(stringe, sizeof(stringe), "%s", inputtext); gpi[playerid][email] = stringe; return ShowPlayerDialog(playerid, register2, DIALOG_STYLE_INPUT, "[TNW] Registrando cuenta paso 2/3", "Ingrese una contraseсa para su cuenta:", "siguiente", "salir"); } } case register2: { if(!response) return Kick(playerid); if(strlen(inputtext) < 3) { SendClientMessage(playerid, -1, "[TNW] {D0FF00}Error: {FFFFFF}Su contraseсa debe tener mбs de 3 caracteres."); return ShowPlayerDialog(playerid, register2, DIALOG_STYLE_INPUT, "[Error] Verifique su contraseсa", "Ingrese una contraseсa para su cuenta:", "Siguiente", "Salir"); } else { format(stringp, sizeof(stringp), "%s", inputtext); gpi[playerid][Password] = stringp; return ShowPlayerDialog(playerid, register3, DIALOG_STYLE_LIST, "[TNW] Registrando cuenta paso 3/3", "\nHombre \nMujer ", "Siguiente", "Salir"); } } case register3: { switch(listitem) { case 0: gpi[playerid][gender] = 1; case 1: gpi[playerid][gender] = 2; } new gquery[256]; format(gquery, sizeof(gquery), "INSERT INTO `accounts` (name, password, email) VALUES ('%s',SHA1('%s'), SHA1('%s'))",gname(playerid), gpi[playerid][Password],gpi[playerid][email]); mysql_function_query(gmysql, gquery, true, "OnAccountRegister", "ii", 0, playerid); } } return 1; }