Saving Accounts
#1

Hello! Merry christmas everybody!

Still, I need some help, haha!

Accounts won't save on my server. It used to do that, but not anymore. Is this caused by streamer of sscanf plugins?

If not, I can show you some code.
Reply
#2

show the code
Reply
#3

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch( dialogid )
    {
        case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_GREY"Registering...",""COL_GREY"You have entered an invalid {FF6347}password{B4B5B7}.\n"COL_GREY"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,"Admin",0);
                INI_WriteInt(File,"VIP",0);
                INI_WriteInt(File,"Wanted",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_WriteInt(File,"Jailed",0);
                INI_WriteInt(File,"Muted",0);
                INI_WriteInt(File,"Cash",0);
                INI_WriteInt(File,"Score",0);
                INI_WriteInt(File,"Banned",0);
                INI_Close(File);

            }
        }

        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_LGREEN"Success",""COL_LGREEN"You have successfully logged in!","Ok","");
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_GREY"Login",""COL_GREY"You have entered an incorrect {FF6347}password{B4B5B7}.\n"COL_GREY"Type your password below to login.","Login","Quit");
                }
                return 1;
            }
        }
    }
    return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    return 1;
}
/******************************************************************************/
/**********************************< STOCKS >**********************************/
stock UserPath(playerid)
{
    new string[1000],playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid,playername,sizeof(playername));
    format(string,sizeof(string),PATH,playername);
    return string;
}
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    if(IsBeingSpeced[playerid] == 1)
    {
        foreach(Player,i)
        {
            if(spectatorid[i] == playerid)
            {
                TogglePlayerSpectating(i, 0);
            }
        }
    }
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    INI_WriteInt(File,"VIP",PlayerInfo[playerid][pVIP]);
    INI_WriteInt(File,"Wanted",GetPlayerWantedLevel(playerid));
    INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
    INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
    INI_WriteInt(File,"Jailed",PlayerInfo[playerid][pJailed]);
    INI_WriteInt(File,"Muted",PlayerInfo[playerid][pMuted]);
    INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    INI_WriteInt(File,"Score",GetPlayerScore(playerid));
    INI_WriteInt(File,"Banned",PlayerInfo[playerid][pBanned]);
    INI_Close(File);

    IsOnDuty[playerid] = 0;
    IsGodMode[playerid] = 0;
    //from here
    PlayerInfo[playerid][pAdmin] = 0;
    PlayerInfo[playerid][pVIP] = 0;
    //etc.
pawn Код:
public OnPlayerConnect(playerid)
{
    if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_LBLUE"Login",""COL_GREY"Type your password below to login.","Login","Quit");
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_LRED"Registering...",""COL_GREY"Type your password below to register this account","Register","Quit");
    }
    IsOnDuty[playerid] = 0;
    IsGodMode[playerid] = 0;
    return 1;
}
Reply
#4

show me your define and stock .
Reply
#5

pawn Код:
public LoadUser_data(playerid,name[],value[])
{
    INI_Int("Password",PlayerInfo[playerid][pPass]);
    INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
    INI_Int("VIP",PlayerInfo[playerid][pVIP]);
    INI_Int("Wanted",PlayerInfo[playerid][pWanted]);
    INI_Int("Kills",PlayerInfo[playerid][pKills]);
    INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
    INI_Int("Jailed",PlayerInfo[playerid][pJailed]);
    INI_Int("Muted",PlayerInfo[playerid][pMuted]);
    INI_Int("Cash",PlayerInfo[playerid][pCash]);
    INI_Int("Score",PlayerInfo[playerid][pScore]);
    INI_Int("Banned",PlayerInfo[playerid][pBanned]);
    return 1;
}
pawn Код:
enum pInfo
{
    pPass,
    pAdmin,
    pVIP,
    pWanted,
    pKills,
    pDeaths,
    pJailed,
    pMuted,
    pCash,
    pScore,
    pBanned
}
new PlayerInfo[MAX_PLAYERS][pInfo];
pawn Код:
#define PATH "/AdminSystem/Account/%s.ini"
Код:
 forward LoadUser_data(playerid,name[],value[]);
pawn Код:
stock UserPath(playerid)
{
    new string[1000],playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid,playername,sizeof(playername));
    format(string,sizeof(string),PATH,playername);
    return string;
}
This is pretty much everything that has anything to do with the admin system account save.. It used to save, I believe. I won't say for sure that it did, though.
Reply
#6

did you add folder inscript files AdminSystem/Account ?
Reply
#7

Add a folder in AdminSystem/Account . Like i set #define UserPath "Users/%s.ini" and i created a new folder with name "Users" now after every registration data saves in that folder and new file is created whenever a person register him/herself
Reply
#8

Quote:
Originally Posted by Arxalan
Посмотреть сообщение
Add a folder in AdminSystem/Account . Like i set #define UserPath "Users/%s.ini" and i created a new folder with name "Users" now after every registration data saves in that folder and new file is created whenever a person register him/herself
Try to set 777 rights of scriptfiles/Users folders both
Reply
#9

That's the thing. I have created that destination but they won't save. That's why I wondered if there were something wrong with the script. But it shouldn't be. It should work..
Reply
#10

I still haven't figured it out. Anyone help me out?

In short, what my problem is:

The accounts that gets registered when they join, don't save. No accounts show up in the folder. What's wrong?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)