Admin Level keep re writing on scriptfiles when relloging
#1

Hey guys, ive little problem here with my saving system. That is saving system. It is keep re writing when im logged in. Example like this:

pawn Код:
Cash = 0
Scores = 0
Password = 248251233
Kills = 0
Deaths = 0
Admin Level = 3
VIP Level = 0
It was like this. Then i want test by relogging. Then it is re writen become like this:
pawn Код:
Cash = 0
Scores = 0
Password = 248251233
Kills = 0
Deaths = 0
Admin Level = 3
VIP Level = 0
Admin Level = 0
VIP Level = 0
Below is my code:
pawn Код:
if(dialogid == DIALOG_LOGIN)
    {
        if(response)
        {
            if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
            {
                INI_ParseFile(UserPath(playerid),"LoadUser_data", .bExtra = true, .extra = playerid);
                GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                SetPlayerScore(playerid, PlayerInfo[playerid][pScores]);
                SendClientMessage(playerid,COLOR_GREEN,"[INFO]:You have logged in!");
                Logged[playerid] = 1;
            }
            else
            {
                ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Please Login!","Type your password below to login","Login","Leave");
            }
        }
        if(!response) return Kick(playerid);
    }
Can you help me guys? Is there something wrong there

Thanks
Reply
#2

No helps?
Reply
#3

Mind showing us some more things about this ? There is might be something wrong with the command 'setlevel', show your full script related to this.
Reply
#4

Quote:
Originally Posted by iZN
Посмотреть сообщение
Mind showing us some more things about this ? There is might be something wrong with the command 'setlevel', show your full script related to this.
I think this is not just about the /setadmin cmds :/ ...
Because even i didnt use /setadmin command yet, it was keep re writting when i was relloging
anw, this is /setadmin command:

pawn Код:
CMD:setadmin(playerid,params[])
{
    new targetid,level,Name[MAX_PLAYER_NAME],Name2[MAX_PLAYER_NAME],str[128],str2[128];
    if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid,COLOR_BRIGHTRED,"[ERROR]:You Need to be RCON Admin to do this command!");
    if(sscanf(params,"ui",targetid,level))return SendClientMessage(playerid,COLOR_BRIGHTRED,"[ERROR]:Usage:/setadmin ID Level");
    if(PlayerInfo[playerid][pAdmin] == level)return SendClientMessage(playerid,COLOR_BRIGHTRED,"[ERROR]:Player selected is already on that Level!");
    if(level >6)return SendClientMessage(playerid,COLOR_BRIGHTRED,"[ERROR]:Available Level 1-6!");
    GetPlayerName(playerid,Name,sizeof(Name));
    GetPlayerName(targetid,Name2,sizeof(Name2));
    format(str,sizeof(str),"Administrator %s[%d] has promoted %s[%d] to admin level %i",Name,playerid,Name2,targetid,level);
    SendClientMessageToAll(COLOR_PINK,str);
    PlayerInfo[targetid][pAdmin] = level;
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i)&&IsPlayerAdmin(i)||PlayerInfo[i][pAdmin] >=1)
        {
            format(str2,sizeof(str2),"Admin %s[%d]has used /setadmin command!",Name,playerid);
            SendClientMessage(i,COLOR_ORANGE,str);
        }
    }
    return 1;
}
Reply
#5

try this with that cmd
pawn Код:
CMD:setlevel(playerid, params[])
{
    new id, level, string[128], string2[128], name[MAX_PLAYER_NAME], name2[MAX_PLAYER_NAME];

    if(pInfo[playerid][pAdmin] < 5) return SendClientMessage(playerid, -1, "Nono:You don't have the required level to execute this command");
    if(sscanf(params, "ud", id, level)) return SendClientMessage(playerid, -1, "Nana: use /setlevel [ID] [level]");
    if(level > 6) return SendClientMessage(playerid, -1, "No: Level cant be above 6");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "No: That ID isn't connected");
    else
    {
        GetPlayerName(playerid, name, sizeof(name));
        GetPlayerName(id, name2, sizeof(name2));

        pInfo[id][Adminlevel] = level;

        format(string, sizeof(string), "Admin %s has promoted you to admin level %d", name, level);
        format(string2, sizeof(string2), "You have promoted %s to admin level %d", name2, level);

        SendClientMessage(id, -1, string);
        SendClientMessage(playerid, -1, string2);
    }
    return true;
}

i guess that the problem is in register dialog
show me the regiter dialog pls
Reply
#6

Show your saving thing, you are saving it on OnPlayerDisconnect I'm sure. Show the script related to saving functions not all!
Reply
#7

Quote:
Originally Posted by Rafael_Zambrano
Посмотреть сообщение
try this with that cmd
pawn Код:
CMD:setlevel(playerid, params[])
{
    new id, level, string[128], string2[128], name[MAX_PLAYER_NAME], name2[MAX_PLAYER_NAME];

    if(pInfo[playerid][pAdmin] < 5) return SendClientMessage(playerid, -1, "Nono:You don't have the required level to execute this command");
    if(sscanf(params, "ud", id, level)) return SendClientMessage(playerid, -1, "Nana: use /setlevel [ID] [level]");
    if(level > 6) return SendClientMessage(playerid, -1, "No: Level cant be above 6");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "No: That ID isn't connected");
    else
    {
        GetPlayerName(playerid, name, sizeof(name));
        GetPlayerName(id, name2, sizeof(name2));

        pInfo[id][Adminlevel] = level;

        format(string, sizeof(string), "Admin %s has promoted you to admin level %d", name, level);
        format(string2, sizeof(string2), "You have promoted %s to admin level %d", name2, level);

        SendClientMessage(id, -1, string);
        SendClientMessage(playerid, -1, string2);
    }
    return true;
}

i guess that the problem is in register dialog
show me the regiter dialog pls
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);
            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);
    }
Quote:
Originally Posted by iZN
Посмотреть сообщение
Show your saving thing, you are saving it on OnPlayerDisconnect I'm sure. Show the script related to saving functions not all!
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]);
    INI_Close(File);
    return 1;
}
Reply
#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
#9

Quote:
Originally Posted by Rafael_Zambrano
Посмотреть сообщение
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);
    }
Still re writing again :/
Ive typed exaclty the codes that you gave. But still not fixed :/
Please help me
Reply
#10

Quote:

Still re writing again :/
Ive typed exaclty the codes that you gave. But still not fixed :/
Please help me

O.o?
delete the account save and try again
with a new acc
try it
and tell me the result
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)