SA-MP Forums Archive
[AJUDA] Login Registro - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [AJUDA] Login Registro (/showthread.php?tid=248231)



[AJUDA] Login Registro - Carl_Thuse - 12.04.2011

Olб pessoal,
Fui fazer um simples dialog para a pessoa se Logar/Registrar, mas acabou tudo errado!
Bug's: Quando o player se Loga, ele nгo efetua o login e nгo spawna o player..
CODE:
pawn Код:
//Nгo vou postar as news porque nгo adianta muita coisa..
//Requestclass
    if(PlayerInfo[playerid][pContaR] != 0)
        {
            ShowPlayerDialog(playerid,logard,DIALOG_STYLE_INPUT,"Login","Bem vindo Novamente\n Vocк jб possui uma Conta!\n Pode se Logar!","Logar","Sair");
        }
        else if(PlayerInfo[playerid][pContaR] != 1)
        {
            ShowPlayerDialog(playerid,registrod,DIALOG_STYLE_INPUT,"Registro","Bem Vindo\n Vocк nгo possui uma Conta\n Pode se registrar!","Registrar","Sair");
        }
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    new stringA[128];
    if(response)
    {
        if(dialogid == logard)
        {
              if(strlen(inputtext))
              {
                    new tmppass[64];
                    strmid(tmppass, tmp, 0, strlen(cmdtext), 255);
                    Encrypt(tmppass);
                    OnPlayerLogin(playerid,tmppass);
              }
              else
              {
                    new loginstring[128];
                    new loginname[64];
                    GetPlayerName(playerid,loginname,sizeof(loginname));
                    format(loginstring,sizeof(loginstring),"Senha Incorreta!\n Digite Sua Senha Novamente:",loginname);
                    ShowPlayerDialog(playerid,logard,DIALOG_STYLE_INPUT,"Logar",loginstring,"Logar","Sair");
                    gPlayerLogTries[playerid] += 1;
                    if(gPlayerLogTries[playerid] == 4) { Ban(playerid); }
              }
        }
        if(dialogid == registrod)
        {
          if(strlen(inputtext))
          {
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(stringA, sizeof(stringA), "%s.ini", sendername);
                new File: hFile = fopen(stringA, io_read);
                if(hFile)
                {
                    //SendClientMessage(playerid, COLOR_YELLOW, "Nome De Usuario jб estб sendo usado.");
                    fclose(hFile);
                    return 1;
                }
                new tmppass[64];
                strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
                Encrypt(tmppass);
                OnPlayerRegister(playerid,tmppass);
            }
            else
            {
                new regstring[128];
                new regname[64];
                GetPlayerName(playerid,regname,sizeof(regname));
                format(regstring,sizeof(regstring),"Bem Vindo Novato %s\nVocк ainda nгo se registrou\nEscolha sua Senha:",regname);
                ShowPlayerDialog(playerid,registrod,DIALOG_STYLE_INPUT,"Registrar",regstring,"Registrar","Sair");
            }
        }
    }
    else
    {
        Kick(playerid);
    }
//....
Alguem descobriu alguma imperfeiзгo (No pawn tem que ser tudo perfeito ) ?
Se alguem puder ajudar fico grato


Re: [AJUDA] Login Registro - Macintosh - 12.04.2011

Poste o OnPlayerLogin.


Re: [AJUDA] Login Registro - Carl_Thuse - 12.04.2011

http://pastebin.com/tBM3wbKr


Re: [AJUDA] Login Registro - Macintosh - 12.04.2011

pawn Код:
if(PlayerInfo[playerid][pContaR] != 0)
        {
            ShowPlayerDialog(playerid,logard,DIALOG_STYLE_INPUT,"Login","Bem vindo Novamente\n Vocк jб possui uma Conta!\n Pode se Logar!","Logar","Sair");
        }
        else if(PlayerInfo[playerid][pContaR] != 1)
        {
            ShowPlayerDialog(playerid,registrod,DIALOG_STYLE_INPUT,"Registro","Bem Vindo\n Vocк nгo possui uma Conta\n Pode se registrar!","Registrar","Sair");
        }
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    new stringA[128];
    if(response)
    {
        if(dialogid == logard)
        {
              if(strlen(inputtext))
              {
                    new tmppass[64];
                    strmid(tmppass, tmp, 0, strlen(cmdtext), 255);
                    Encrypt(tmppass);
                    OnPlayerLogin(playerid,tmppass);
                    SpawnPlayer(playerid); //adiзгo aqui
              }
              else
              {
                    new loginstring[128];
                    new loginname[64];
                    GetPlayerName(playerid,loginname,sizeof(loginname));
                    format(loginstring,sizeof(loginstring),"Senha Incorreta!\n Digite Sua Senha Novamente:",loginname);
                    ShowPlayerDialog(playerid,logard,DIALOG_STYLE_INPUT,"Logar",loginstring,"Logar","Sair");
                    gPlayerLogTries[playerid] += 1;
                    if(gPlayerLogTries[playerid] == 4) { Ban(playerid); }
              }
        }
        if(dialogid == registrod)
        {
          if(strlen(inputtext))
          {
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(stringA, sizeof(stringA), "%s.ini", sendername);
                new File: hFile = fopen(stringA, io_read);
                if(hFile)
                {
                    //SendClientMessage(playerid, COLOR_YELLOW, "Nome De Usuario jб estб sendo usado.");
                    fclose(hFile);
                    return 1;
                }
                new tmppass[64];
                strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
                Encrypt(tmppass);
                OnPlayerRegister(playerid,tmppass);
            }
            else
            {
                new regstring[128];
                new regname[64];
                GetPlayerName(playerid,regname,sizeof(regname));
                format(regstring,sizeof(regstring),"Bem Vindo Novato %s\nVocк ainda nгo se registrou\nEscolha sua Senha:",regname);
                ShowPlayerDialog(playerid,registrod,DIALOG_STYLE_INPUT,"Registrar",regstring,"Registrar","Sair");
            }
        }
    }
    else
    {
        Kick(playerid);
    }
//....
Se nгo der certo procura outra login box.


Re: [AJUDA] Login Registro - Carl_Thuse - 12.04.2011

Uhum jб coloquei SpawnPlayer..
Porem nгo achei mais nenhuma login box '-'