26.09.2016, 18:03
Buenas, modifiquй el intro del servidor y al final no funciona como quiero, la cosa estб, cuando entras en OnPlayerConnect busca al usuario...
LogueoUsuario es un CALLBACK, que verifica si el nombre estб correcto, muestra los textdraws del inicio y eso, no es importante, ahн puse lo siguiente
encima de todo, ya con eso puesto ya no muestra el servidor los textdraws de login ni nada, se queda trabado... no hace nada, їpor quй hice eso? porque quiero almacenar si el usuario existe o no porque cuando entras se muestra un menъ para login, registrar... informaciуn ect, entonces si presionas ejemplo login y la CuentaExiste estб en 0 le vuelva a mostrar los textdraws para que se registre, y viceversa es lo que quiero lograr pero no funciona, asн es cuando tocas los textdraws de registro/login
y acб dejo el callback completo de LogueoUsuario
Код:
new Query[130]; mysql_format(MySQL, Query, sizeof Query, "SELECT SQLID, Password, Salt FROM cuentas WHERE Usuario = '%e' LIMIT 1", NombreJugador(playerid)); mysql_tquery(MySQL, Query, "LogueoUsuario", "i", playerid);
Код:
new rows, fields; cache_get_data(rows, fields); if(rows == 1){CuentaExiste[playerid] = 1;} else if(!rows){CuentaExiste[playerid] = 0;}
Код:
if(clickedid == TextdrawsGlobales[3]) { QuitarMenuInicio(playerid), CancelSelectTextDraw(playerid); if(CuentaExiste[playerid] == 0) { cache_get_field_content(0, "Password", InformacionJugador_[playerid][pPassword], MySQL, 65); cache_get_field_content(0, "Salt", InformacionJugador_[playerid][pSalt], MySQL, 11); new string[150]; format(string, sizeof(string), ""#CBLANCO"Bienvenido(a) "#CGRIS_3"%s.\n\n"#CBLANCO"Tu cuenta no estб registrada en nuestra base de datos, Ingresa una contraseсa:", NombreJugador(playerid)); ShowPlayerDialog(playerid, DIALOG_REGISTRO, DIALOG_STYLE_PASSWORD, ""CAZUL"Registro - ", string, "Registrar","Cancelar"); return 1; } else if(CuentaExiste[playerid] == 1) { MostrarMenuInicio(playerid); return 1; } } else if(clickedid == TextdrawsGlobales[4]) { QuitarMenuInicio(playerid), CancelSelectTextDraw(playerid); if(CuentaExiste[playerid] == 0) { MostrarMenuInicio(playerid); return 1; } else if(CuentaExiste[playerid] == 1) { new string[145]; format(string, sizeof(string), ""#CBLANCO"Bienvenido(a) "#CGRIS_3"%s\n\n"#CBLANCO"Tu cuenta estб registrada en nuestra base de datos, Ingresa su contraseсa:", NombreJugador(playerid)); ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, ""CAZUL"Login - ", string, "Ingresar","Cancelar"); return 1; } }
Код:
CALLBACK: LogueoUsuario(playerid) { new rows, fields; cache_get_data(rows, fields); if(rows == 1){CuentaExiste[playerid] = 1;} else if(!rows){CuentaExiste[playerid] = 0;} if(IsRolePlayName(playerid)) { MostrarMenuInicio(playerid), LimpiarPantalla(playerid, 50); TextDrawShowForPlayer(playerid, TextdrawsGlobales[14]), TextDrawShowForPlayer(playerid, TextdrawsGlobales[15]); TextDrawShowForPlayer(playerid, TextdrawsGlobales[16]), TextDrawShowForPlayer(playerid, TextdrawsGlobales[17]); new string[30]; format(string, sizeof(string), "%d usuario(s) conectado(s)", Iter_Count(Player)); TextDrawSetString(TextdrawsGlobales[17], string); SendClientMessage(playerid, COLOR_PIEL, ""); SendClientMessage(playerid, COLOR_PIEL, ""); SendClientMessage(playerid, COLOR_PIEL, "* Informaciуn: Tienes 5 minutos para Ingresar/Registrar una cuenta en el servidor o serбs expulsado."); SendClientMessage(playerid, COLOR_PIEL, ""); SendClientMessage(playerid, COLOR_PIEL, ""); LogueoTiempo[playerid] = SetTimerEx("KickTimer", 50000, 0, "d", playerid); SetPlayerPos(playerid, 2096.8398,-1879.4764,15.000), SetPlayerCameraPos(playerid, 2096.8398,-1879.4764,30), SetPlayerCameraLookAt(playerid, 2080.5161,-1759.1907,13.5656); } else { LimpiarPantalla(playerid, 50); SendClientMessage(playerid, COLOR_PIEL, "Para jugar en este servidor con la modalidad RolePlayes es requerido que utilice el formato nickname Nombre_Apellido. "); SendClientMessage(playerid, COLOR_PIEL, "Debe usar un guiуn bajo (_) entre nombre y apellido."); SendClientMessage(playerid, COLOR_PIEL, "Ejemplo: Antonio Rincon, Jorge Fernandez."); SetTimerEx("KickTimer", 500, false, "d", playerid); } return 1; }