case DIALOGO_INGRESO:{
if(!response) return Kick(playerid);
static Hash[65], Query[75];
SHA256_PassHash(inputtext, InformacionJugador_[playerid][jSalt], Hash, 64);
if(!strcmp(Hash, InformacionJugador_[playerid][jPassword])){
mysql_format(dbHandle, Query, sizeof Query, "SELECT * FROM usuarios WHERE Usuario='%e' LIMIT 1", GetPlayerNameEx(playerid));
mysql_tquery(dbHandle, Query, "CargarUsuario_", "i", playerid);
}else{
MostrarDialog_(playerid, DIALOGO_INGRESO);
}
}
CALLBACK: CargarUsuario_(playerid){
LimpiarP(playerid);
static rows, fields;
cache_get_data(rows, fields);
Loop(i, 2) TextDrawHideForPlayer(playerid, LoginServer_[i]);
GetPlayerName(playerid, InformacionJugador_[playerid][jNombre], MAX_PLAYER_NAME + 1);
InformacionJugador_[playerid][jPosicion][0] = cache_get_field_content_float(0, "Pos0");
InformacionJugador_[playerid][jPosicion][1] = cache_get_field_content_float(0, "Pos1");
InformacionJugador_[playerid][jPosicion][2] = cache_get_field_content_float(0, "Pos2");
InformacionJugador_[playerid][jDinero] = cache_get_field_content_int(0, "Dinero");
InformacionJugador_[playerid][jNivel] = cache_get_field_content_int(0, "Nivel");
InformacionJugador_[playerid][jSkin] = cache_get_field_content_int(0, "Skin");
//
SetPlayerScore(playerid, InformacionJugador_[playerid][jNivel]);
DineroPlayer_(playerid, InformacionJugador_[playerid][jDinero]);
TogglePlayerSpectating(playerid, false);
InformacionJugador_[playerid][jSpawn] = 1;
SetSpawnInfo(playerid, 0, InformacionJugador_[playerid][jSkin], InformacionJugador_[playerid][jPosicion][0], InformacionJugador_[playerid][jPosicion][1], InformacionJugador_[playerid][jPosicion][2], 68.307, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
return 1;
}
|
en la funcion CargarUsuario_ no se ve nada mal, quiza sea la query del DIALOGO_INGRESO
|
public OnPlayerConnect(playerid)
{
for(new _informacion@jugador: i; i < _informacion@jugador; i++)
InformacionJugador_[playerid][i] = 0;
//
SetPlayerColor(playerid, 0xb3b3b3FF);
TogglePlayerSpectating(playerid, true);
//
static Query[96], Usuario[MAX_PLAYER_NAME + 1];
GetPlayerName(playerid, Usuario, sizeof Usuario);
mysql_format(dbHandle, Query, sizeof Query, "SELECT SQLID, Password, Salt FROM usuarios WHERE Usuario='%e' LIMIT 1", Usuario);
mysql_tquery(dbHandle, Query, "VerificarUsuario_", "i", playerid);
return 1;
}
CALLBACK: VerificarUsuario_(playerid){
static rows, fields;
cache_get_data(rows, fields);
PlayAudioStreamForPlayer(playerid, "https://dl.dropboxusercontent.com/s/fvrfgq5mw45nhoe/newintro.mp3");
LimpiarP(playerid);
Loop(i, 2) TextDrawShowForPlayer(playerid, LoginServer_[i]);
InterpolateCameraPos(playerid, 2169.808105, -1659.838256, 103.374832, 2167.935058, -1136.155029, 106.361320, 30000);
InterpolateCameraLookAt(playerid, 2169.811035, -1659.351928, 103.347076, 2167.435058, -1136.148559, 106.344200, 30000);
if(!rows) return MostrarDialog_(playerid, DIALOGO_REGISTRO);
//
InformacionJugador_[playerid][jSQLID] = cache_get_field_content_int(0, "SQLID");
cache_get_field_content(0, "Password", InformacionJugador_[playerid][jPassword], dbHandle, 65);
cache_get_field_content(0, "Salt", InformacionJugador_[playerid][jSalt], dbHandle, 11);
MostrarDialog_(playerid, DIALOGO_INGRESO);
return 1;
}
MostrarDialog_(playerid, dialogid, adicionalid=0){
switch(dialogid){
case DIALOGO_REGISTRO:{
static string[141];
switch(adicionalid){
case 0: format(string, sizeof(string), "Bienvenido a "#SERVER_NOMBRE", %s.\n\nEl personaje no estб registrado en la base de datos, introduzca la contraseсa.", NombreJ_(playerid));
}
ShowPlayerDialog(playerid, DIALOGO_REGISTRO, DIALOG_STYLE_INPUT, "Registro (1 / 2) - Contraseсa.", string, "Aceptar", "Cancelar");
}
case DIALOGO_INGRESO:{
static string[141];
switch(adicionalid){
case 0: format(string, sizeof(string), "Bienvenido a "#SERVER_NOMBRE", %s.\n\nEl personaje %s estб registrado en la base de datos, introduzca la contraseсa.", NombreJ_(playerid));
}
ShowPlayerDialog(playerid, DIALOGO_INGRESO, DIALOG_STYLE_INPUT, "Logueo - "#SERVER_NOMBRE".", string, "Ingresar", "Cancelar");
}
case DIALOGO_CORREO:{
switch(adicionalid){
case 0: ShowPlayerDialog(playerid, DIALOGO_CORREO, DIALOG_STYLE_INPUT, "Registro (2 / 2) - Correo.", "Introduzca una direcciуn de correo en el siguiente campo.\n\nLa misma te servirб para recuperar la cuenta en caso de perdida.", ">", "-");
}
}
}
return 1;
}
mysql_format(dbHandle, Query, sizeof Query, "SELECT * FROM usuarios WHERE Usuario='%e' LIMIT 1", GetPlayerNameEx(playerid));
mysql_format(dbHandle, Query, sizeof Query, "SELECT * FROM ґusuariosґ WHERE Usuario='%e' LIMIT 1", GetPlayerNameEx(playerid));
|
Intenta cambiando
PHP код:
PHP код:
|
mysql_format(dbHandle, Query, sizeof(Query), "SELECT * FROM `usuarios` WHERE `Usuario`='%e' LIMIT 1", GetPlayerNameEx(playerid));