SA-MP Forums Archive
y_ini big problem - 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: y_ini big problem (/showthread.php?tid=298623)



y_ini big problem - [RS]Monk - 21.11.2011

hi i have a problem...register/login dialogs work only for id 0..idk whats the problem,tell me what part of script i need to post so you can see whats the problem...please help


Re: y_ini big problem - JaTochNietDan - 21.11.2011

Show us the contents of your OnDialogResponse callback.


Re: y_ini big problem - [RS]Monk - 22.11.2011

PHP Code:
    switch(dialogid)
    {
        case 
REGISTER:
        {
            if(!
response) return Kick(playerid);
            if(
response)
            {
                if(!
strlen(inputtext)) return ShowPlayerDialog(playeridREGISTERDIALOG_STYLE_INPUT"{B0B0B0}Register","{FFFFFF}Type your password below to register a new account.","Register","Cancel");
                new 
INI:File INI_Open(UserPath(playerid));
                
INI_SetTag(File,"data");
                
INI_WriteInt(File,"Password",udb_hash(inputtext));
                
INI_WriteInt(File,"Cash",0);
                
INI_WriteInt(File,"Score",0);
                
INI_WriteInt(File,"Skin",0);
                
INI_WriteInt(File,"Admin",0);
                
INI_WriteInt(File,"Kills",0);
                
INI_WriteInt(File,"Deaths",0);
                
INI_WriteInt(File,"Online",0);
                
INI_WriteInt(File,"Locked",0);
                
INI_WriteInt(File,"SaveSkin",0);
                
INI_Close(File);
            }
        }
        case 
LOGIN:
        {
            if(!
response) return Kick(playerid);
            if(
response)
            {
                if(
udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                {
                    
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra true, .extra playerid);
                    
OnPlayerLogin(playerid);
                }
                else
                {
                    
ShowPlayerDialog(playeridLOGINDIALOG_STYLE_INPUT,"{B0B0B0}Login",""RED"You have entered an incorrect password.\n{FFFFFF}Welcome back to {33E82A}San Andreas Stunt Evolution.{FFFFFF}\n\nThis account is already registered.Login to access your account:","Login","Cancel");
                }
                return 
1;
            }
        }
    } 



Re: y_ini big problem - [MG]Dimi - 22.11.2011

It's not about OnDialogResponse. It's about OnPlayerConnect since id>0 doesn't get Dialog at all


Re: y_ini big problem - aRoach - 22.11.2011

Give us OnPlayerConnect, that thing with ShowPlayerDialog( ... ); for Login/Register


Re: y_ini big problem - [RS]Monk - 22.11.2011

PHP Code:
    if(fexist(UserPath(playerid)))
    {
        
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra true, .extra playerid);
        
ShowPlayerDialog(playeridLOGINDIALOG_STYLE_INPUT,"{B0B0B0}Login","{FFFFFF}Welcome back to {33E82A}San Andreas Stunt Evolution.{FFFFFF}\n\nThis account is already registered.Login to access your account:","Login","Cancel");
    }
    else
    {
        
ShowPlayerDialog(playeridREGISTERDIALOG_STYLE_INPUT,"{B0B0B0}Register","{FFFFFF}Type your password below to register a new account.","Register","Cancel");
    } 



Re: y_ini big problem - JaTochNietDan - 22.11.2011

Can you tell us what happens exactly? Does the dialog show for everyone and it's just when the player selects something in the dialog that it doesn't work, or does the dialog not show for everyone in the first place?


Re: y_ini big problem - [RS]Monk - 22.11.2011

only player id 0 can see register/login dialog..


Re: y_ini big problem - aRoach - 22.11.2011

pawn Code:
if(!fexist(UserPath(playerid))) ShowPlayerDialog(playerid, REGISTER, DIALOG_STYLE_INPUT,"{B0B0B0}Register","{FFFFFF}Type your password below to register a new account.","Register","Cancel");
else ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_INPUT,"{B0B0B0}Login","{FFFFFF}Welcome back to {33E82A}San Andreas Stunt Evolution.{FFFFFF}\n\nThis account is already registered.Login to access your account:","Login","Cancel");
And put this:
pawn Code:
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
In your Login Dialog.....


Re: y_ini big problem - JaTochNietDan - 22.11.2011

In what context is this snippet of code that you posted?

pawn Code:
if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_INPUT,"{B0B0B0}Login","{FFFFFF}Welcome back to {33E82A}San Andreas Stunt Evolution.{FFFFFF}\n\nThis account is already registered.Login to access your account:","Login","Cancel");
    }
    else
    {
        ShowPlayerDialog(playerid, REGISTER, DIALOG_STYLE_INPUT,"{B0B0B0}Register","{FFFFFF}Type your password below to register a new account.","Register","Cancel");
    }
I can't really see how that wouldn't show for anyone but ID 0, assuming that the value of playerid is being passed correctly in whatever callback you're using.