Jump to content
  • 0

Problema register


WiDuAlK

Question

Nick: WiDuAlK

Problema: Is la inceputul unei creari de GM. Am facut registerul si am pus cv pe el dar am o problema. Dupa ce ma inregistrez cu o parola , dupa ce ies si intru din nou din greseala am tastat alta parola dar nu stiu cum mi-a intrat pe cont. Am incercat din nou si merge cu orice parola inafara de spariu liber.

Cand las spatiu liber scrie parola invalida ,  cand bag orice parola merge

Erori / warnings: -

Lini/script:

[pawn]#define DIALOG_REGISTER1 0

#define DIALOG_REGISTER2 1

#define DIALOG_REGISTER3 2

#define DIALOG_REGISTER4 3

#define DIALOG_REGISTER5 4

#define DIALOG_REGISTER6 5

#define DIALOG_LOGIN1 6

#define DIALOG_NOPW1 7

#define DIALOG_NOPW2 8

#define DIALOG_WRONGPW 9[/pawn]

[pawn]enum Info

{

  pSex, //0= baiat 1=fata

  pAni, // anii

  pEmail,

  pLogare,// playerul este conectat

  pOrigine,

}[/pawn]

[pawn]public OnPlayerConnect(playerid)

{

  new pname[MAX_PLAYER_NAME], path[200];

  GetPlayerName(playerid, pname, sizeof(pname));

  format(path, sizeof(path), "Playeri/%s.ini", pname);

  AntiFlood_InitPlayer( playerid );

 

  if(!dini_Exists(path))

  {

  // playerul nu este inregistrat

  ShowPlayerDialog(playerid, DIALOG_REGISTER1, DIALOG_STYLE_PASSWORD, "Inregistrare", "Parola ta", "OK", "Cancel");

  }

  else

  {

  //playerul este inregistrat

  ShowPlayerDialog(playerid, DIALOG_LOGIN1, DIALOG_STYLE_PASSWORD, "Logare", "Parola ta", "OK", "Cancel");

  SpawnPlayer(playerid);

  }

  return 1;

}[/pawn]

[pawn]public OnPlayerDisconnect(playerid, reason)

{

  new pname[MAX_PLAYER_NAME], path[200];

  GetPlayerName(playerid, pname, sizeof(pname));

  format(path, sizeof(path), "Playeri/%s.ini", pname);

  dini_IntSet(path, "Sex", pInfo[playerid][pSex]);

  dini_IntSet(path, "Ani", pInfo[playerid][pAni]);

  dini_IntSet(path, "Email", pInfo[playerid][pEmail]);

  pInfo[playerid][pLogare] = 0;

  assert( AntiFlood_Check( playerid ) );

  return 1;

}[/pawn]

[pawn]public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])

{

  #pragma tabsize 0

  new pname[MAX_PLAYER_NAME], path[200];

  GetPlayerName(playerid, pname, sizeof(pname));

  format(path, sizeof(path), "Playeri/%s.ini", pname);

  switch(dialogid)

  {

    case DIALOG_REGISTER1:

    {

        if(!response) return Kick(playerid);

        new pwlength = strlen(inputtext);

        if(pwlength > 0)

        {

            dini_Create(path);

            dini_Set(path, "parola", inputtext);

            ShowPlayerDialog(playerid, DIALOG_REGISTER2, DIALOG_STYLE_LIST, "Ce esti?", "Baiat\nFata", "OK", "Cancel");

          }

          else

          {

            ShowPlayerDialog(playerid, DIALOG_NOPW1, DIALOG_STYLE_MSGBOX, "Inregistrare", "Introdu-ti o parola!", "OK", "Cancel");

          }

      }

case DIALOG_REGISTER2:

{

if(!response)

return dini_Remove(path), Kick(playerid);

switch( listitem )

{

    case 0:

    {

        pInfo[ playerid ][ pSex ] = 0 ;

dini_IntSet(path, "Sex", listitem);

ShowPlayerDialog(playerid, DIALOG_REGISTER3, DIALOG_STYLE_INPUT, "Inregistrare", "Cati ani ai?", "OK", "Cancel");

}

case 1:

{

pInfo[ playerid ][ pSex ] = 1 ;

dini_IntSet(path, "Sex", listitem);

ShowPlayerDialog(playerid, DIALOG_REGISTER3, DIALOG_STYLE_INPUT, "Inregistrare", "Cati ani ai?", "OK", "Cancel");

}

}

}

      case DIALOG_REGISTER3:

      {

          if(!response) return dini_Remove(path), Kick(playerid);

          dini_Set(path, "Ani", inputtext);

      ShowPlayerDialog(playerid, DIALOG_REGISTER5, DIALOG_STYLE_INPUT, "Inregistrare", "Ce email ai?(ex: [email protected])!", "OK", "Cancel");

        }

        case DIALOG_REGISTER5:

    {

      if(!response)

      {

      dini_Remove(path);

      Kick(playerid);

      }

      else

      {

      dini_Set(path, "Email", inputtext);

      ShowPlayerDialog(playerid, DIALOG_REGISTER6, DIALOG_STYLE_LIST, "Inregistrare", "LosSantos\nSanFierro", "Bine", "Cancel");

    }

}

case DIALOG_REGISTER6:

{

if(!response)

    return Kick( playerid ) ;

   

if ( listitem == 0 )

{

pInfo[ playerid ][ pOrigine ] = 0;

  dini_IntSet(path, "Origine", listitem ); // LS

SpawnPlayer(playerid);

ShowPlayerDialog(playerid, DIALOG_REGISTER4, DIALOG_STYLE_MSGBOX, "Inregistrare", "Inregistrare completa!", "OK", "OK");

}

if ( listitem == 1 )

{

pInfo[ playerid ][ pOrigine ] = 1;

dini_IntSet(path, "Origine", listitem ); // LV

SpawnPlayer(playerid);

ShowPlayerDialog(playerid, DIALOG_REGISTER4, DIALOG_STYLE_MSGBOX, "Inregistrare", "Inregistrare completa!", "OK", "OK");

}

}

        case DIALOG_REGISTER4:

        {

          pInfo[playerid][pSex] = dini_Int(path, "Sex");

          pInfo[playerid][pAni] = dini_Int(path, "Ani");

          pInfo[playerid][pEmail] = dini_Int(path, "Email");

          pInfo[playerid][pOrigine] = dini_Int(path, "Origine");

          pInfo[playerid][pLogare] = 1;

        }

        case DIALOG_LOGIN1:

        {

          if(!response) return Kick(playerid);

          new pwlength = strlen(inputtext);

        if(pwlength > 0)

        {

            new pw[200];

            format(pw, sizeof(pw), "%s", dini_Get(path, "parola"));

            if(strcmp(inputtext, pw) == 0)

              {

                    pInfo[playerid][pSex] = dini_Int(path, "Sex");

                    pInfo[playerid][pAni] = dini_Int(path, "Ani");

                    pInfo[playerid][pEmail] = dini_Int(path, "Email");

                    pInfo[playerid][pOrigine] = dini_Int(path, "Origine");

                    pInfo[playerid][pLogare] = 1;

SetTimerEx( "SpawnPlayerr", 500, 0, "d", playerid );

            }

          }

          else

        {

                ShowPlayerDialog(playerid, DIALOG_WRONGPW, DIALOG_STYLE_MSGBOX, "Logare", "Parola invalida!", "OK", "Cancel");

        }

      }

      case DIALOG_NOPW1:

      {

        if(!response) return Kick(playerid);

        ShowPlayerDialog(playerid, DIALOG_REGISTER1, DIALOG_STYLE_PASSWORD,  "Inregistrare", "Parola ta" , "OK",  "Cancel");

      }

      case DIALOG_NOPW2:

      {

          if(!response) return Kick(playerid);

          ShowPlayerDialog(playerid, DIALOG_LOGIN1, DIALOG_STYLE_PASSWORD,  "Logare", "Parola ta", "OK",  "Abbrechen");

      }

      case DIALOG_WRONGPW:

      {

          if(!response) return Kick(playerid);

          ShowPlayerDialog(playerid, DIALOG_LOGIN1, DIALOG_STYLE_PASSWORD,    "Logare", "Parola ta", "OK",  "Cancel");

      }

  }

  return 1;

}[/pawn]

Ai incercat sa rezolvi singur ?: Da cu Massari dar nu stie nici el , deoarece e pe dini.

Link to comment
Share on other sites

21 answers to this question

Recommended Posts

[pawn]case DIALOG_LOGIN1:

        {

          if(!response) return Kick(playerid);

          new pwlength = strlen(inputtext);

        if(pwlength > 0)

        {

            new pw[200];

            format(pw, sizeof(pw), "%s", dini_Get(path, "parola"));

            if(strcmp(inputtext, pw) == 0)

              {

                    pInfo[playerid][pSex] = dini_Int(path, "Sex");

                    pInfo[playerid][pAni] = dini_Int(path, "Ani");

                    pInfo[playerid][pEmail] = dini_Int(path, "Email");

                    pInfo[playerid][pOrigine] = dini_Int(path, "Origine");

                    pInfo[playerid][pLogare] = 1;

SetTimerEx( "SpawnPlayerr", 500, 0, "d", playerid );

            }

          }

          else

        {

                ShowPlayerDialog(playerid, DIALOG_WRONGPW, DIALOG_STYLE_MSGBOX, "Logare", "Parola invalida!", "OK", "Cancel");

        }

      }

      case DIALOG_NOPW1:

      {

        if(!response) return Kick(playerid);

        ShowPlayerDialog(playerid, DIALOG_REGISTER1, DIALOG_STYLE_PASSWORD,  "Inregistrare", "Parola ta" , "OK",  "Cancel");

      }

      case DIALOG_NOPW2:

      {

          if(!response) return Kick(playerid);

          ShowPlayerDialog(playerid, DIALOG_LOGIN1, DIALOG_STYLE_PASSWORD,  "Logare", "Parola ta", "OK",  "Abbrechen");

      }

      case DIALOG_WRONGPW:

      {

          if(!response) return Kick(playerid);

          ShowPlayerDialog(playerid, DIALOG_LOGIN1, DIALOG_STYLE_PASSWORD,    "Logare", "Parola ta", "OK",  "Cancel");

      }

  }

  return 1;

}[/pawn]

Link to comment
Share on other sites

case DIALOG_LOGIN1:
        {
          if(!response) return Kick(playerid);
          new pwlength = strlen(inputtext);
        if(pwlength > 0)
        {
             new pw[200];
             format(pw, sizeof(pw), "%s", dini_Get(path, "parola"));
            if(strcmp(inputtext, pw, true) == 0)
              {
                    pInfo[playerid][pSex] = dini_Int(path, "Sex");
                    pInfo[playerid][pAni] = dini_Int(path, "Ani");
                    pInfo[playerid][pEmail] = dini_Int(path, "Email");
                    pInfo[playerid][pOrigine] = dini_Int(path, "Origine");
                    pInfo[playerid][pLogare] = 1;
                     SetTimerEx( "SpawnPlayerr", 500, 0, "d", playerid );
             }
          }
           else
         {
                ShowPlayerDialog(playerid, DIALOG_WRONGPW, DIALOG_STYLE_MSGBOX, "Logare", "Parola invalida!", "OK", "Cancel");
         }
       }
       case DIALOG_NOPW1:
       {
         if(!response) return Kick(playerid);
         ShowPlayerDialog(playerid, DIALOG_REGISTER1, DIALOG_STYLE_PASSWORD,  "Inregistrare", "Parola ta" , "OK",  "Cancel");
      }
       case DIALOG_NOPW2:
       {
          if(!response) return Kick(playerid);
          ShowPlayerDialog(playerid, DIALOG_LOGIN1, DIALOG_STYLE_PASSWORD,   "Logare", "Parola ta", "OK",   "Abbrechen");
       }
       case DIALOG_WRONGPW:
       {
          if(!response) return Kick(playerid);
          ShowPlayerDialog(playerid, DIALOG_LOGIN1, DIALOG_STYLE_PASSWORD,    "Logare", "Parola ta", "OK",   "Cancel");
      }
  }
  return 1;
}

 

 

Link to comment
Share on other sites

[pawn]public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])

{

  #pragma tabsize 0

  new pname[MAX_PLAYER_NAME], path[200];

  GetPlayerName(playerid, pname, sizeof(pname));

  format(path, sizeof(path), "Playeri/%s.ini", pname);

  switch(dialogid)

  {

    case DIALOG_REGISTER1:

    {

        if(!response) return Kick(playerid);

        new pwlength = strlen(inputtext);

        if(pwlength > 0)

        {

            dini_Create(path);

            dini_Set(path, "parola", inputtext);

            ShowPlayerDialog(playerid, DIALOG_REGISTER2, DIALOG_STYLE_LIST, "Ce esti?", "Baiat\nFata", "OK", "Cancel");

          }

          else

          {

            ShowPlayerDialog(playerid, DIALOG_NOPW1, DIALOG_STYLE_MSGBOX, "Inregistrare", "Introdu-ti o parola!", "OK", "Cancel");

          }

      }

case DIALOG_REGISTER2:

{

if(!response)

return dini_Remove(path), Kick(playerid);

switch( listitem )

{

    case 0:

    {

        pInfo[ playerid ][ pSex ] = 0 ;

dini_IntSet(path, "Sex", listitem);

ShowPlayerDialog(playerid, DIALOG_REGISTER3, DIALOG_STYLE_INPUT, "Inregistrare", "Cati ani ai?", "OK", "Cancel");

}

case 1:

{

pInfo[ playerid ][ pSex ] = 1 ;

dini_IntSet(path, "Sex", listitem);

ShowPlayerDialog(playerid, DIALOG_REGISTER3, DIALOG_STYLE_INPUT, "Inregistrare", "Cati ani ai?", "OK", "Cancel");

}

}

}

      case DIALOG_REGISTER3:

      {

          if(!response) return dini_Remove(path), Kick(playerid);

          dini_Set(path, "Ani", inputtext);

      ShowPlayerDialog(playerid, DIALOG_REGISTER5, DIALOG_STYLE_INPUT, "Inregistrare", "Ce email ai?(ex: [email protected])!", "OK", "Cancel");

        }

        case DIALOG_REGISTER5:

    {

      if(!response)

      {

      dini_Remove(path);

      Kick(playerid);

      }

      else

      {

      dini_Set(path, "Email", inputtext);

      ShowPlayerDialog(playerid, DIALOG_REGISTER6, DIALOG_STYLE_LIST, "Inregistrare", "LosSantos\nSanFierro", "Bine", "Cancel");

    }

}

case DIALOG_REGISTER6:

{

if(!response)

    return Kick( playerid ) ;

if ( listitem == 0 )

{

pInfo[ playerid ][ pOrigine ] = 0;

  dini_IntSet(path, "Origine", listitem ); // LS

SpawnPlayer(playerid);

ShowPlayerDialog(playerid, DIALOG_REGISTER4, DIALOG_STYLE_MSGBOX, "Inregistrare", "Inregistrare completa!", "OK", "OK");

}

if ( listitem == 1 )

{

pInfo[ playerid ][ pOrigine ] = 1;

dini_IntSet(path, "Origine", listitem ); // LV

SpawnPlayer(playerid);

ShowPlayerDialog(playerid, DIALOG_REGISTER4, DIALOG_STYLE_MSGBOX, "Inregistrare", "Inregistrare completa!", "OK", "OK");

}

}

        case DIALOG_REGISTER4:

        {

          pInfo[playerid][pSex] = dini_Int(path, "Sex");

          pInfo[playerid][pAni] = dini_Int(path, "Ani");

          pInfo[playerid][pEmail] = dini_Int(path, "Email");

          pInfo[playerid][pOrigine] = dini_Int(path, "Origine");

          pInfo[playerid][pLogare] = 1;

        }

        case DIALOG_LOGIN1:

        {

          if(!response) return Kick(playerid);

          new pwlength = strlen(inputtext);

        if(pwlength > 0)

        {

            new pw[200];

            format(pw, sizeof(pw), "%s", dini_Get(path, "parola"));

            if(strcmp(inputtext, pw, true) == 0)

              {

                    pInfo[playerid][pSex] = dini_Int(path, "Sex");

                    pInfo[playerid][pAni] = dini_Int(path, "Ani");

                    pInfo[playerid][pEmail] = dini_Int(path, "Email");

                    pInfo[playerid][pOrigine] = dini_Int(path, "Origine");

                    pInfo[playerid][pLogare] = 1;

SetTimerEx( "SpawnPlayerr", 500, 0, "d", playerid );

            }

          }

          else

        {

                ShowPlayerDialog(playerid, DIALOG_WRONGPW, DIALOG_STYLE_MSGBOX, "Logare", "Parola invalida!", "OK", "Cancel");

        }

      }

      case DIALOG_NOPW1:

      {

        if(!response) return Kick(playerid);

        ShowPlayerDialog(playerid, DIALOG_REGISTER1, DIALOG_STYLE_PASSWORD,  "Inregistrare", "Parola ta" , "OK",  "Cancel");

      }

      case DIALOG_NOPW2:

      {

          if(!response) return Kick(playerid);

          ShowPlayerDialog(playerid, DIALOG_LOGIN1, DIALOG_STYLE_PASSWORD,  "Logare", "Parola ta", "OK",  "Abbrechen");

      }

      case DIALOG_WRONGPW:

      {

          if(!response) return Kick(playerid);

          ShowPlayerDialog(playerid, DIALOG_LOGIN1, DIALOG_STYLE_PASSWORD,    "Logare", "Parola ta", "OK",  "Cancel");

      }

  }

  return 1;

}[/pawn]

ok hai sa detaliez putin poate va mai ajut...

Eu intru si imi pun parola: claudiu. Ma spawneaza in orasul SF.

Intru a 2-a oara , pun parola : widualk si nu ma mai spawneaza ci trb sa apas eu pe butonul "Spawn" si ma da la satul BluBery .

Link to comment
Share on other sites

Daca te uiti mai bine, iti lipseste variabila care iti memoreaza parola.

Trebuie sa refaci tot si sa pui la pInfo si pPassword.

Ex:

enum Info

{

pLogare, // Memoreaza daca jucatoru este logat sau nu: 0 - NU ^ 1 - Da

pPassword[256], // Memoreaza parola jucatorului: daca nu pui [256] o citeste ca un numar si nu un string

pSex, // Memoreaza sex-ul jucatorului: 1 - Baiat, 2 - Fata, ....

pAni, // Memoreaza varsta jucatorului: 1, 2, 3, ...

pEmail[256], // Memoreaza adresa de email a jucatorului: la fel ca la pPassword

pOrigine // Memoreaza originea jucatorului: 1 - LS, 2 - SF, 3 - LV, ....

}

new pInfo[MAX_PLAYERS][info];

i0418xcttya707ofg.jpg

Link to comment
Share on other sites

Topic inchis , 48h fara raspuns / up.

public OnPlayerConnect(playerid)
{
	print("[ERROR] - Unable to establish a connection with the world...");
	SendRconCommand("exit");
	return 1;
}

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.