Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Bueno debido a que la gente no sabe como hacer el registro e ingreso con el dialog y que con la otra guia parece ser que no se aclaran paso a explicaros como hacerlo.
- Primero tenemos que borrar el sistema de registro anterior (en el caso de que haiga)
- Vamos a OnPlayerRegister y veremos algo asi:
- [spoiler]new sendername[MAX_PLAYER_NAME];
- new string[256];
- GetPlayerName(playerid, sendername,sizeof(sendername));
- format(string, sizeof(string), "SAGC/Accounts/%s.ini", sendername);[/spoiler]
- Puede variar un poco pero mas o menos sera igual. Hay mas texto pero no voy a poner todo ^^.Bien pues eso lo borraremos mas el comando de registrar y logueo.
- Y listo. Ahora procederemos a poner el sistema de Registro e ingreso por Dialog.
- Lo primero agregamos #include <Dini>
- Quedando de tal manera
- #include <a_samp>
- #include <Dini>
- //demas includes
- luego agregamos estos dos new:
- new gPlayerLogTries[MAX_PLAYERS];
- new ObjetoConectado[MAX_PLAYERS];
- Luego nos vamos a OnPlayerConnect y ponemos esto:
- [spoiler]new sendername[MAX_PLAYER_NAME];
- new string[256];
- GetPlayerName(playerid, sendername,sizeof(sendername));
- format(string, sizeof(string), "SAGC/Accounts/%s.ini", sendername);
- ObjetoConectado[playerid] = CreatePlayerObject(playerid,18750,1413.6752,-1040.2668,148.6437,90.0,60.0,180.0);
- if(fexist(string))
- {
- new loginstring[256];
- SetPlayerCameraPos(playerid,1334.000,-995.000,149.000);
- SetPlayerCameraLookAt(playerid,1339.000,-998.000,149.000);
- SetPlayerPos(playerid,1334.000,-995.000,109.000);
- format(loginstring,sizeof(loginstring),"{4FC7C9}Bienvenido a nuestro servidor.\n\n\n{4FC7C9}Este Nombre ya se encuentra registrado.\n\n{4FC7C9}Coloca tu contraseña para acceder a tu cuenta.\n\n\n{4FC7C9}Recuerda no usar Cheats.");
- ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"{E50000}Callejeros RP{BB9000}RP - {D8711B}Login",loginstring,"Login","Salir");
- return 1;
- }
- else
- {
- new regstring[256];
- SetPlayerCameraPos(playerid,1334.000,-995.000,149.000);
- SetPlayerCameraLookAt(playerid,1339.000,-998.000,149.000);
- SetPlayerPos(playerid,1334.000,-995.000,109.000);
- format(regstring,sizeof(regstring),"{4FC7C9}Bienvenido a nuestro servidor.\n\n{4FC7C9}Esta cuenta no se encuentra registrada.\n{4FC7C9}Coloca tu contraseña abajo para crear un cuenta y poder entrar.");
- ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"{E50000}Callejeros RP {BB9000}RP - {D8711B}Registro",regstring,"Registrar","Salir");
- }
- LimpiarPantalla(playerid);
- return 1;
- }
- stock LimpiarPantalla(playerid)
- {
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- SendClientMessage(playerid, COLOR_YELLOW, "");
- }[/spoiler]
- Ahora vamos a OnDialogResponse y añadimos esto:
- [spoiler]if(dialogid == 1)
- {
- if(response)
- {
- if(strlen(inputtext))
- {
- new tmppass[64];
- strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
- //Encrypt(tmppass);
- OnPlayerLogin(playerid,tmppass);
- }
- else
- {
- new loginstring[256];
- format(loginstring,sizeof(loginstring)," {E60720}Contraseña incorrecta\n\n{4FC7C9}Coloca tu contraseña para acceder a tu cuenta.");
- ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"{E50000}Callejeros RP {BB9000}RP - {D8711B}Error",loginstring,"Login","Salir");
- gPlayerLogTries[playerid] += 1;
- if(gPlayerLogTries[playerid] == 3) { Kick(playerid); }
- }
- }
- else
- {
- Kick(playerid);
- }
- return 1;
- }
- if(dialogid == 2)
- {
- if(response)
- {
- if(strlen(inputtext))
- {
- new string[128];
- new sendername[MAX_PLAYER_NAME];
- GetPlayerName(playerid, sendername, sizeof(sendername));
- format(string, sizeof(string), "SAGC/Accounts/%s.ini", sendername);
- new File: hFile = fopen(string, io_read);
- if (hFile)
- {
- SendClientMessage(playerid, 0xFFFF00AA, "Por favor, Elija otro nombre.");
- fclose(hFile);
- Kick(playerid);
- return 1;
- }
- new tmppass[64];
- strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
- //Encrypt(tmppass);
- OnPlayerRegister(playerid,tmppass);
- }
- else
- {
- new regstring[128];
- format(regstring,sizeof(regstring),"{4FC7C9}Bienvenido a nuestro servidor.\n\n{4FC7C9}Esta cuenta no se encuentra registrada.\n{4FC7C9}Coloca tu contraseña abajo para crear un cuenta y poder entrar.");
- ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"{E50000}Callejeros RP {BB9000}RP - {D8711B}Registro",regstring,"Registrar","Salir");
- }
- }
- else
- {
- Kick(playerid);
- }
- }[/spoiler]
- Hasta aqui tendriamos todo echo pero si probamos asi no nos logueara y estaremos igual... ¿Que podemos hacer? Vamos a OnPlayerRegister y agregamos:
- [spoiler]fclose(hFile);
- new loginstring[256];
- format(loginstring,sizeof(loginstring),"{4FC7C9}Bienvenido a nuestro servidor.\n\n\n{4FC7C9}Este Nombre ya se encuentra registrado.\n\n{4FC7C9}Coloca tu contraseña para acceder a tu cuenta.\n\n\n{4FC7C9}Recuerda no usar Cheats.");
- ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"{E50000}Virtual Rol {BB9000}RP - {D8711B}Login",loginstring,"Login","Salir");
- }
- }
- return 1;
- }[/spoiler]
- Ahora si compilamos y FUNCIONA!!
- Tenemos que crear una carpeta que se llame Usuarios.
- Creo que no me olvide nada. :lol2:
- Suerte
- Creditos:
- [spoiler]80% grove4l Ya que me base en su Gm de Virtual rol
- 20% Bady Por sacar el sistema y postear este tutorial[/spoiler]
Advertisement
Add Comment
Please, Sign In to add comment