Dialog login .
#1

Hello,

I create Dialog login..

So now I Got little problem :S

This is the code in "/login":
pawn Код:
strmid(tmppass, tmp, 0, strlen(cmdtext), 255);
            OnPlayerLogin(playerid,tmppass);

So, I want to move it to the dialog code .
Like that:
pawn Код:
if(dialogid == 1)
    {
        if(!response) { return 1; }
             // The code is here .
    }

Offcourse I tried and got errors.

How to make it working fine in dialog ?



Reply
#2

What errors?

Try this:

pawn Код:
if(dialogid == 1 && response)
{
  // Login Code
}
Reply
#3

I mean, what the code should I do ?


The orginal code is:
strmid(tmppass, tmp, 0, strlen(cmdtext), 255);
OnPlayerLogin(playerid,tmppass);


But When I put this on the dialog, I got errors
Reply
#4

I add it to my dialog code:

pawn Код:
new tmppass[64];
        strmid(strval(tmppass), inputtext, 0, strlen(dialogid), 255);
        OnPlayerLogin(playerid,tmppass);
And I got one error.

argument type mismatch (argument 1)
Reply
#5

I suppose OnPlayerLogin's second parameter is an array. So you shouldn't do strval.
Reply
#6

Well this is my whole login system:

Command:
pawn Код:
new s[128],pName[24];
GetPlayerName(playerid, pName, 24);
format(s,sizeof(s),"Welcome back, %s!\n\nYou must login to continue!\n\nPlease enter your password below:",pName);
ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Login to your account",s,"Login","Clear");
OnDialogResponse:
pawn Код:
if(dialogid == 2)
{
  if(!response)
  {
    new s[128];
    format(s,sizeof(s),"Welcome back, %s!\n\nYou must login to continue!\n\nPlease enter your password below:",ReturnPlayerName(playerid));
    return ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Login to your account",s,"Login","Clear");
  }
  if(PASSWORD_CHECK_HERE)
  {
    // Login code
  }
  else
  {
    // Wrong password
  }
}
Reply
#7

Quote:
Originally Posted by MenaceX^
I suppose OnPlayerLogin's second parameter is an array. So you shouldn't do strval.
If I delete the strval, the error showing again..
Reply
#8

Your error is this

pawn Код:
new tmppass[64];
strmid(strval(tmppass), inputtext, 0, strlen(dialogid), 255);
OnPlayerLogin(playerid,tmppass);
dialogid is not a string, it's best to just remove strmid and use inputtext instead of tmppass.

pawn Код:
OnPlayerLogin(playerid,inputtext);
Reply
#9

pawn Код:
strmid(strval(tmppass), inputtext, 0, strlen(dialogid), 255);
dialogid is an integer, you can't check its lenght.
Reply
#10

Quote:
Originally Posted by Joe Staff
Your error is this

pawn Код:
new tmppass[64];
strmid(strval(tmppass), inputtext, 0, strlen(dialogid), 255);
OnPlayerLogin(playerid,tmppass);
dialogid is not a string, it's best to just remove strmid and use inputtext instead of tmppass.

pawn Код:
OnPlayerLogin(playerid,inputtext);
That was help ^^




Ty all.
Can lock this thread.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)