Register And Login dialog problems
#2

Ok, i found that the problem is in OnPlayerDisconnect!

But, i still need help!, now i have this :
pawn Код:
new REGKICK[MAX_PLAYERS];
And :

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch( dialogid )
    {
        case DIALOG_REGISTER:
        {
            if(!response)
            {
                Kick(playerid);
                REGKICK[playerid] = 1;
                return 1;
            }
            else
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_LIGHTBLUE"Type your password below to register a new account.","Register","Quit");
                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,"Admin",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_Close(File);

                ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Thank you for registering!","Ok","");
            }
        }

        case DIALOG_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);
                    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                    ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_LIGHTBLUE"Type your password below to login.","Login","Quit");
                }
                return 1;
            }
        }
    }
    return 1;
}
And :

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    if(REGKICK[playerid] == 1) return 1;
    else
    {
        new INI:File = INI_Open(UserPath(playerid));
        INI_SetTag(File,"data");
        INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
        INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
        INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
        INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
        INI_Close(File);
        GetPlayerPos(playerid, pX[playerid], pY[playerid], pZ[playerid]);
        GetPlayerFacingAngle(playerid, A[playerid]);
        INI_SetTag(File, "Saved Position Data");
        INI_WriteFloat(File, "X", pX[playerid]);
        INI_WriteFloat(File, "Y", pY[playerid]);
        INI_WriteFloat(File, "Z", pZ[playerid]);
        INI_WriteFloat(File, "Angle", A[playerid]);
        INI_WriteInt(File, "Interior", GetPlayerInterior(playerid));
        INI_WriteInt(File, "VirtualWorld", GetPlayerVirtualWorld(playerid));
        INI_Close(File);
    }
    return 1;
}
The problem is,

it still creates my user file even with that REGKICK..

Please help!
Reply


Messages In This Thread
Register And Login dialog problems - by SilverKiller - 25.03.2013, 16:18
Re: Register And Login dialog problems - by SilverKiller - 25.03.2013, 16:39
Re: Register And Login dialog problems - by SilverKiller - 26.03.2013, 11:30
Re: Register And Login dialog problems - by newbienoob - 26.03.2013, 11:33
Re: Register And Login dialog problems - by SilverKiller - 26.03.2013, 11:45

Forum Jump:


Users browsing this thread: 1 Guest(s)