SA-MP Forums Archive
Login bug again :| - 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: Login bug again :| (/showthread.php?tid=326543)



Login bug again :| - Vrondakis - 17.03.2012

pawn Код:
if(dialogid == 667)
        {
            if(response)
            {
                if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                {
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                    gPlayerLogged[playerid] = 1;
                    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                    SCM(playerid, COLOR_RED, "You have logged in. You may now spawn.");
                }
                else
                {
                    gPlayer[playerid] += 1;

                    if(gPlayer[playerid] == 1)
                    {
                        SCM(playerid, COLOR_RED, "Wrong Password. 1/3");
                    }

                    if(gPlayer[playerid] == 2)
                    {
                        SCM(playerid, COLOR_RED, "Wrong Password. 2/3");
                    }

                   
                    {
                        SCM(playerid, COLOR_RED, "Wrong Password. 3/3. You have been kicked.");
                        Kick(playerid);
                    }
                }
            }
        }
    }
    return 1;
}
When the dialog pops up and I press accept, it shuts the dialog and nothing happends..


Re: Login bug again :| - Vrondakis - 17.03.2012

Bump


Re: Login bug again :| - new121 - 17.03.2012

Do you have AddPlayerClass anywhere in your script? and do you see the left and right arrows and the spawn button, or is the screen just blank?


Re: Login bug again :| - park4bmx - 17.03.2012

Go two questions !
(1) is there any other dialo I'd with the same ID that might be inturupting it ?
(2) is the "Accept" buton on left ot right side ? (what I mean is to check if it is "response")
Edit
Too many closing brackets !
Also there is an unknown statement where u open a bracket with ought a check !


Re: Login bug again :| - Cpt.Shady - 17.03.2012

use lethal admin


Re: Login bug again :| - Vrondakis - 18.03.2012

Quote:
Originally Posted by Cpt.Shady
Посмотреть сообщение
use lethal admin
No. That might be the most unhelpful piece of advice I have ever received on the SA-MP Forums.
Quote:
Originally Posted by park4bmx
Посмотреть сообщение
Go two questions !
(1) is there any other dialo I'd with the same ID that might be inturupting it ?
(2) is the "Accept" buton on left ot right side ? (what I mean is to. Heck if it is "response")
1. Nope
2. You're looking for this.. Right?
pawn Код:
if(fexist(UserPath(playerid)))
        {
            if(gPlayerLogged[playerid] == 0){
            ShowPlayerDialog(playerid, 667, DIALOG_STYLE_INPUT, "Login", "Type your password here.", "Submit", "Cancel");
        }
1. Nope


Re: Login bug again :| - ReneG - 18.03.2012

Might wanna add a !response and kick them if they don't respond. The no-response code is trying to run, but it has nothing to run.


Re: Login bug again :| - Vrondakis - 18.03.2012

...Explain?


Re: Login bug again :| - Alvord - 18.03.2012

You forgot the "else" word on your last statement. Hopefully, that's the only problem.

Try this:
pawn Код:
if(dialogid == 667)
{
    if(response)
    {
        if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
        {
            INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
            gPlayerLogged[playerid] = 1;
            GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
            SCM(playerid, COLOR_RED, "You have logged in. You may now spawn.");
        }
        else
        {
            gPlayer[playerid] += 1;

            if(gPlayer[playerid] == 1)
            {
                SCM(playerid, COLOR_RED, "Wrong Password. 1/3");
            }

            if(gPlayer[playerid] == 2)
            {
                SCM(playerid, COLOR_RED, "Wrong Password. 2/3");
            }

            else
            {
                SCM(playerid, COLOR_RED, "Wrong Password. 3/3. You have been kicked.");
                Kick(playerid);
            }
        }
    }
}
NOTE: I removed two closing brackets and "return 1;" on the last part.


Re: Login bug again :| - park4bmx - 18.03.2012

pawn Код:
if(dialogid == 667)
{
    if(response)
    {
        if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
        {
            INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
            gPlayerLogged[playerid] = 1;
            GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
            SCM(playerid, COLOR_RED, "You have logged in. You may now spawn.");
        }
        else
        {
            gPlayer[playerid] += 1;

            if(gPlayer[playerid] == 1)
            {
                SCM(playerid, COLOR_RED, "Wrong Password. 1/3");
            }else if(gPlayer[playerid] == 2)
            {
                SCM(playerid ,COLOR_RED, "Wrong Password. 2/3");
            }else  if(gPlayer[playerid] == 3){
                SCM(playerid, COLOR_RED, "Wrong Password. 3/3. You have been kicked.");
                Kick(playerid);
            }
        }
    }
}
Just needed to sort out the warnings becouse if there is an else a the end when the "if" statements are seperate that will kick the player if his warning is "=0" too becouse is checking for 1,2 at the same time and when I checks for 2 and is not 2 then it will kick him