#1

Hello, I got a problem with my XP system.. When i go to my accounts directory and set my XP to like 100 then join the server, it loads but when i disconnect it dosent save for some reason...

My code:

pawn Код:
if(dini_Exists(file))
    {
        dini_IntSet(file, "XP", PlayerInfo[playerid][pXP]);
    }
^^ OnPlayerDisconnect

pawn Код:
forward PlayerXPTimer(playerid);
public PlayerXPTimer(playerid)
{
    if(gPlayerLogged[playerid] == 1)
    {
        new file[128];
        new pname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, pname, sizeof(pname));
        format(file, sizeof(file), ACC_FOLDER, pname);
        new string[128];
        TextDrawHideForPlayer(playerid, TDSTATS[playerid]);
        format(string, sizeof(string), "~p~XP:%d", dini_Int(file, "XP"));
        TextDrawSetString(TDSTATS[playerid], string);
        TextDrawShowForPlayer(playerid, TDSTATS[playerid]);
    }
}
^^ The timer that never ends - ( for updating the status of XP ) and that timer in on the login section..

Does anyone know how to fix this

Help xD
Reply
#2

If the "file" path correct?

And what does it save in your userfile?
Reply
#3

Quote:
Originally Posted by Jeffry
Посмотреть сообщение
If the "file" path correct?

And what does it save in your userfile?
Here:
pawn Код:
#define ACC_FOLDER "%s.ini"
^^ thats the directory


and it saves this:

pawn Код:
udbHashPW=1440454223
XP=0
Reply
#4

Are you setting PlayerInfo[playerid][pXP] to the amount of XP in the file when they login?
pawn Код:
PlayerInfo[playerid][pXP] = dini_Int(file, "XP");
Reply
#5

Quote:
Originally Posted by Grim_
Посмотреть сообщение
Are you setting PlayerInfo[playerid][pXP] to the amount of XP in the file when they login?
pawn Код:
PlayerInfo[playerid][pXP] = dini_Int(file, "XP");
No, I set a timer on the login part so it can load the settings... Scroll up.. I've pasted the timer on the topic.

anyways,
this is how it should be right?

pawn Код:
format(string, sizeof(string), "~p~XP:%d", dini_Int(file, "XP"));
        TextDrawSetString(TDSTATS[playerid], string);
Reply
#6

Can you post your OnPlayerDisconnect. I think you first set the variable to "0" and then you save it.
Reply
#7

Sure,
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new file[128];
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    format(file,sizeof(file),ACC_FOLDER,name);
    if(dini_Exists(file))
    {
        dini_IntSet(file, "XP", PlayerInfo[playerid][pXP]);
    }
    gPlayerLogged[playerid] = 0;
    return 1;
}
Reply
#8

Long bump
Reply
#9

Maybe try:

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new file[128];
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    format(file,sizeof(file),ACC_FOLDER,name);
    new tmp[20];
    format(tmp, 20, "%d", PlayerInfo[playerid][pXP]);
    if(dini_Exists(file))
    {
        dini_IntSet(file, "XP", tmp);
    }
    gPlayerLogged[playerid] = 0;
    return 1;
}
Maybe this works...
Reply
#10

Quote:
Originally Posted by Jeffry
Посмотреть сообщение
Maybe try:

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new file[128];
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    format(file,sizeof(file),ACC_FOLDER,name);
    new tmp[20];
    format(tmp, 20, "%d", PlayerInfo[playerid][pXP]);
    if(dini_Exists(file))
    {
        dini_IntSet(file, "XP", tmp);
    }
    gPlayerLogged[playerid] = 0;
    return 1;
}
Maybe this works...
argument type mismatch (argument 3)

Line:
pawn Код:
dini_IntSet(file, "XP", tmp);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)