Guest User

Untitled

a guest
Dec 31st, 2014
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.12 KB | None | 0 0
  1. ==================================================================================================================================
  2. // onplayerconnect
  3. ==================================================================================================================================
  4.     new log[35];
  5.     new regstring[130];
  6.     format(log,sizeof log,"CONTAS/%s.ini",Nome(playerid));
  7.     if(!dini_Exists(log))
  8.     {
  9.         format(regstring,sizeof(regstring),"{FFE4E1}%s, you do not have an account in our database.\nPlease enter a password to register.",Nome(playerid));
  10.         ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"{87CEEB}Register",regstring,"Register","Exit");
  11.         return 1;
  12.     }
  13.     format(regstring,sizeof(regstring),"{FAF0E6}%s, you already have an account in the database.\nPlease enter your password below to log in power.",Nome(playerid));
  14.     ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"{F5F5F5}Login",regstring,"Login","Exit");
  15.  
  16. ==================================================================================================================================
  17. // ondialogresponse
  18. ==================================================================================================================================
  19.  
  20.     new arq[30];
  21.     format(arq,sizeof arq,"CONTAS/%s.ini",Nome(playerid));
  22.     if(dialogid == 1)
  23.     {
  24.         if(response == 1)
  25.         {
  26.             new regstring[130];
  27.             if(!strlen(inputtext)) { // não digitar nada
  28.                 format(regstring,sizeof(regstring),"{FFE4E1}%s, you do not have an account in our database.\nPlease enter a password to register.",Nome(playerid));
  29.                 ShowPlayerDialog(playerid,1,DIALOG_STYLE_PASSWORD,"{87CEEB}Register",regstring,"Register","Exit");
  30.                 return 1;
  31.             }
  32.             dini_Create(arq);
  33.             format(regstring,sizeof(regstring),"{FAF0E6}Congratulations %s, you registered your account.\nEnter your password below to log in power.",Nome(playerid));
  34.             ShowPlayerDialog(playerid,2,DIALOG_STYLE_PASSWORD,"{F5F5F5}Login",regstring,"Login","Exit");
  35.             dini_Set(arq, "Senha", inputtext);
  36.             return 1;
  37.         }
  38.         SendClientMessage(playerid,0xFFFF00,"Você usou a opção 'Sair' e foi kickado pelo servidor!");
  39.         Kick(playerid);
  40.  
  41.     }
  42.     else if(dialogid == 2)
  43.     {
  44.         if(response == 1)
  45.         {
  46.             if(!strlen(inputtext)) { // não digitar nada
  47.                 ShowPlayerDialog(playerid,2,DIALOG_STYLE_PASSWORD,"{F5F5F5}Login","Enter the password correctly.","Login","Exit");
  48.                 return 1;
  49.             }
  50.             if(!strcmp(dini_Get(arq,"Senha"), inputtext))
  51.             {
  52.                 //Aqui coloca-se as variáveis do texto, como Level, dinheiro,etc.
  53.                 Logado[playerid] = 1;
  54.                 OnPlayerLogin(playerid);
  55.                 return 1;
  56.             }
  57.             else
  58.             {
  59.                 ShowPlayerDialog(playerid,2,DIALOG_STYLE_PASSWORD,"{F5F5F5}Login","Enter the password correctly.","Login","Exit");
  60.                 return 1;
  61.             }
  62. //          SendClientMessage(playerid,0xFFFF00,"Você usou a opção 'Sair' e foi kickado pelo servidor!");
  63. //          Kick(playerid);
  64.         }
  65.         else // se der cancel
  66.         {
  67.             SendClientMessage(playerid,0xFFFF00,"You used the Exit option and was kicked by the server!");
  68.             Kick(playerid);
  69.         }
  70.     }
Advertisement
Add Comment
Please, Sign In to add comment