SA-MP Forums Archive
Dialog login . - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Dialog login . (/showthread.php?tid=101423)



Dialog login . - _Ben_[Fux-c.co.il RP] - 10.10.2009

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 ?






Re: Dialog login . - Mikep. - 10.10.2009

What errors?

Try this:

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



Re: Dialog login . - _Ben_[Fux-c.co.il RP] - 10.10.2009

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


Re: Dialog login . - _Ben_[Fux-c.co.il RP] - 10.10.2009

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)


Re: Dialog login . - MenaceX^ - 10.10.2009

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


Re: Dialog login . - Mikep. - 10.10.2009

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
  }
}



Re: Dialog login . - _Ben_[Fux-c.co.il RP] - 10.10.2009

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..


Re: Dialog login . - Joe Staff - 10.10.2009

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);



Re: Dialog login . - MenaceX^ - 10.10.2009

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


Re: Dialog login . - _Ben_[Fux-c.co.il RP] - 10.10.2009

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.