SA-MP Forums Archive
I have problem with registration multiple dialogs.(Need some explanation or help) - 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)
+--- Thread: I have problem with registration multiple dialogs.(Need some explanation or help) (/showthread.php?tid=417200)



I have problem with registration multiple dialogs.(Need some explanation or help) - TrueForYourSelf - 20.02.2013

So here is my on dialog Response.. Now I need to make like male, female etc on player registration.

I looked in ****** but couldn't find what I was looking for..

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
     if(
dialogid == dregister)
     {
        if(!
response) return Kick(playerid); 
        if(
response)
        {
            if(!
strlen(inputtext)) 
            {
                
ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_INPUT,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.\nPlease enter the password!","Register","Quit");
                return 
1;
            }
            new 
hashpass[129]; 
            
WP_Hash(hashpass,sizeof(hashpass),inputtext);
            new 
INI:file INI_Open(Path(playerid));
            
INI_SetTag(file,"Player's Data");
            
INI_WriteString(file,"Password",hashpass);
            
INI_WriteInt(file,"AdminLevel",0);
            
INI_WriteInt(file,"VIPLevel",0);
            
INI_WriteInt(file,"Money",0);
            
INI_WriteInt(file,"Scores",0);
            
INI_WriteInt(file,"Kills",0);
            
INI_WriteInt(file,"Deaths",0);
            
INI_WriteInt(file,"Sex",0);
            
INI_WriteInt(file,"Member",0);
            
INI_WriteInt(file,"Leader",0);
            
INI_WriteInt(file,"House",0);
            
INI_WriteInt(file,"House1",0);
            
INI_WriteInt(file,"Car",0);
            
INI_WriteInt(file,"Car1",0);
            
INI_WriteInt(file,"Phone",0);
            
INI_WriteInt(file,"Number",0);
            
INI_WriteInt(file,"Skin",0);
            
INI_WriteInt(file,"Health",0);
            
INI_WriteInt(file,"Armor",0);
             
INI_WriteInt(file,"Player",0);
             
INI_WriteInt(file,"Fighting",0);
             
INI_WriteInt(file,"Walking",0);
             
INI_WriteInt(file,"Religion",0);
             
INI_WriteInt(file,"Accent",0);
             
INI_WriteInt(file,"WeaponSkill",0);
             
INI_WriteInt(file,"WeaponSkill1",0);
             
INI_WriteInt(file,"WeaponSkill2",0);
             
INI_WriteInt(file,"WeaponSkill3",0);
             
INI_WriteInt(file,"WeaponSkill4",0);
             
INI_WriteInt(file,"WeaponSkill5",0);
             
INI_WriteInt(file,"WeaponSkill6",0);
             
INI_WriteInt(file,"WeaponSkill7",0);
             
INI_WriteInt(file,"WeaponSkill8",0);
             
INI_WriteInt(file,"WeaponSkill9",0);
             
INI_WriteInt(file,"WeaponSkill10",0);
             
INI_WriteInt(file,"WeaponSkill11",0);
             
INI_WriteInt(file,"WeaponSkill12",0);
             
INI_WriteInt(file,"Cashbox",0);
             
INI_WriteInt(file,"Race",0);
             
INI_WriteInt(file,"DM",0);
             
INI_WriteInt(file,"Warning",0);
            
INI_WriteInt(file,"Banned",0);
             
INI_WriteInt(file,"IpBanned",0);
             
INI_WriteInt(file,"Respect",0);
             
INI_WriteInt(file,"Dice",0);
              
INI_WriteInt(file,"Ciggaretes",0);
              
INI_WriteInt(file,"Fork",0);
              
INI_WriteInt(file,"Spoon",0);
            
INI_WriteInt(file,"Drink",0);
            
INI_WriteInt(file,"Ciggars",0);
            
INI_WriteInt(file,"Sprunk",0);
            
INI_WriteInt(file,"Beer",0);
            
INI_WriteInt(file,"Wine",0);
            
INI_WriteInt(file,"Hennesy",0);
            
INI_WriteInt(file,"JackDaniels",0);
            
INI_WriteInt(file,"Coke",0);
            
INI_WriteInt(file,"Vodka",0);
            
INI_Close(file);
            
SendClientMessage(playerid,-1,"You have been successfully registered");
            return 
1;
        }
     }
     if(
dialogid == dlogin)
     {
        if(!
response) return Kick(playerid); 
        if(
response)
        {
            new 
hashpass[129];
            
WP_Hash(hashpass,sizeof(hashpass),inputtext);
            if(!
strcmp(hashpass,pInfo[playerid][Pass]))
            {
                
INI_ParseFile(Path(playerid),"loadaccount_user",.bExtra true, .extra playerid);
                
SetPlayerScore(playerid,pInfo[playerid][Scores]);
                
GivePlayerMoney(playerid,pInfo[playerid][Money]);
                
SendClientMessage(playerid,-1,"Welcome back! You have successfully logged in");
            }
            else
               {
                   
ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPUT,"Login","Welcome back. This account is registered. \nInsert your password to login to your account.\nIncorrect password!","Login","Quit");
                return 
1;
            }
        }
     }
    return 
1;

So Maybe someone could help me out.. With this question..

You don't need to make code but you could explain me how it could be possible to do.


Thank you for your time.
With Regards TrueForYourSelf.


Re: I have problem with registration multiple dialogs.(Need some explanation or help) - Jstylezzz - 20.02.2013

You have to add the ShowPlayerDialog in one of the dialog responses that get called, for example
pawn Код:
if(dialogid == dregister)
     {
        if(!response) return Kick(playerid);  
        if(response)
        {
         //stuff here
         ShowPlayerDialog(...);//next dialog here
        }
     }
Just call the next dialog in the response, and make a new dialogresponse for that, and just continue like that


Re: I have problem with registration multiple dialogs.(Need some explanation or help) - TrueForYourSelf - 20.02.2013

with case ? like to switch dialogs right?


Re: I have problem with registration multiple dialogs.(Need some explanation or help) - Jstylezzz - 20.02.2013

No, just do the ShowPlayerDialog like I showed, and then add if(dialogid == nextdialog) with the stuff you want to do in that dialog..
I will try to make a good example in just a minute


Re: I have problem with registration multiple dialogs.(Need some explanation or help) - TrueForYourSelf - 20.02.2013

Big thanks you I'm sorry for that I don't get it right...


Re: I have problem with registration multiple dialogs.(Need some explanation or help) - Jstylezzz - 20.02.2013

I would do it like this, trigger the new dialog as soon as the player is done with the last one:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == register1)
    {
    //do the register stuff
    ShowPlayerDialog(playerid,register2,....);
    }
    if(dialogid == register2)
    {
    //do some other register stuff here
    ShowPlayerDialog(playerid,register3,....);
    }
    return 1;
}



Re: I have problem with registration multiple dialogs.(Need some explanation or help) - TrueForYourSelf - 20.02.2013

All is fine thank you