Admin Level keep re writing on scriptfiles when relloging
#8

Quote:
Originally Posted by qazwsx
Посмотреть сообщение
This is the register dialog:
pawn Код:
if(dialogid == DIALOG_REGISTER)
    {
        if(response)
        {
            if(!strlen(inputtext))return ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Please Register your account here!","Type your password to make one your account!","Register","Leave");
            new INI:File = INI_Open(UserPath(playerid));
            INI_SetTag(File,"Data");
            INI_WriteInt(File,"Cash",0);
            INI_WriteInt(File,"Scores",0);
            INI_WriteInt(File,"Password",udb_hash(inputtext));
            INI_WriteInt(File,"Kills",0);//and here too
            INI_WriteInt(File,"Deaths",0);//here too
            INI_WriteInt(File,"Admin Level",0);//here too
            INI_WriteInt(File,"VIP Level",0); // heres your error
            INI_Close(File);
            SendClientMessage(playerid,COLOR_GREEN,"[INFO]:You Have succesfully registered!");
            Logged[playerid] = 1;
        }
        if(!response)return Kick(playerid);
    }


This is the related functions in saving stuff:
pawn Код:
public OnPlayerDisconnect(playerid,reason)
{
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"Data");
    INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    INI_WriteInt(File,"Admin Level",PlayerInfo[playerid][pAdmin]);
    INI_WriteInt(File,"Scores",GetPlayerScore(playerid));
    INI_WriteInt(File,"VIP Level",PlayerInfo[playerid][pVip]);
    INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKill]);
    INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeath]);//here your error here must be like in the dialog, will write a new line with other deaths or other vip level
    INI_Close(File);
    return 1;
}
aja !
eureca !
theres your problem !
you must sort it nothin' more
add this in onplayer disconnect
[pawn]
pawn Код:
public OnPlayerDisconnect(playerid,reason)
{
         new INI:File = INI_Open(UserPath(playerid));
         INI_SetTag(File,"Data");
         INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
         INI_WriteInt(File,"Scores",GetPlayerScore(playerid));
         INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKill]);
         INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeath]);
         INI_WriteInt(File,"Admin Level",PlayerInfo[playerid][pAdmin]);
         INI_WriteInt(File,"VIP Level",PlayerInfo[playerid][pVip]);//must be like "onplayerdisconnect" or will save twice and different !
         INI_Close(File);
         return 1;
}
and in dialog

pawn Код:
if(dialogid == DIALOG_REGISTER)
    {
        if(response)
        {
            if(!strlen(inputtext))return ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Please Register your account here!","Type your password to make one your account!","Register","Leave");
            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,"Scores",0);
            INI_WriteInt(File,"Kills",0);
            INI_WriteInt(File,"Deaths",0);
            INI_WriteInt(File,"Admin Level",0);
            INI_WriteInt(File,"VIP Level",0);
            INI_Close(File);
            SendClientMessage(playerid,COLOR_GREEN,"[INFO]:You Have succesfully registered!");
            Logged[playerid] = 1;
        }
        if(!response)return Kick(playerid);
    }
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)