Problem saving playerdata
#1

Hey guys,

I got a problem with saving playerdata into an .ini

When some-one logs out (disconnect), then im getthing this:

Код:
Name=Alusion[NL]
Ip=255.255.255.255 // <-- should be 127.0.0.1
Registered=0 // <-- should be 1
Password=313656198
Level=0
Money=500
Score=0
Vip=0
What to do to get the ip right?

pawn Код:
public OnPlayerDisconnect(playerid, reason)
    {

        new file[200], name[MAX_PLAYER_NAME], ip[16];
        GetPlayerIp(playerid, ip, sizeof(ip));
        GetPlayerName(playerid, name, sizeof(name));
        format(file, sizeof(file), PlayerFile, name);
        dini_Set(file, "Name", name);
        dini_Set(file, "Ip", ip);
        dini_IntSet(file, "Registered", gPlayerInfo[playerid][PLAYER_REGGED]);
        dini_IntSet(file, "Password", gPlayerInfo[playerid][PLAYER_PASS]);
        dini_IntSet(file, "Level", gPlayerInfo[playerid][PLAYER_LEVEL]);
        dini_IntSet(file, "Vip", gPlayerInfo[playerid][PLAYER_VIP]);
        dini_IntSet(file, "Money", GetPlayerMoney(playerid));
        dini_IntSet(file, "Score", GetPlayerScore(playerid));
        gPlayerLogged[playerid] = 0;
        return 1;
    }
Reply
#2

Hi

Try that:

pawn Код:
public OnPlayerConnect(playerid)
{
    new IP[16];
    GetPlayerIp(playerid,IP,16);
    SetPVarString(playerid,"pIP",IP);
    return 1;
}
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new IP[16];
    GetPVarString(playerid,"pIP",IP,sizeof(IP));
    return 1;
}
Reply
#3

Not working, getting thsi now:
Код:
Ip =
If i didn't do this right (down here), please correct me

pawn Код:
public OnPlayerDisconnect(playerid, reason)
    {
        new file[200], name[MAX_PLAYER_NAME], ip[16];
        GetPVarString(playerid,"pIP",ip,sizeof(ip));
        GetPlayerName(playerid, name, sizeof(name));
        format(file, sizeof(file), PlayerFile, name);
        dini_Set(file, "Name", name);
        dini_Set(file, "Ip", ip);
        dini_IntSet(file, "Registered", gPlayerInfo[playerid][PLAYER_REGGED]);
        dini_IntSet(file, "Password", gPlayerInfo[playerid][PLAYER_PASS]);
        dini_IntSet(file, "Level", gPlayerInfo[playerid][PLAYER_LEVEL]);
        dini_IntSet(file, "Vip", gPlayerInfo[playerid][PLAYER_VIP]);
        dini_IntSet(file, "Money", GetPlayerMoney(playerid));
        dini_IntSet(file, "Score", GetPlayerScore(playerid));
        gPlayerLogged[playerid] = 0;
        return 1;
    }
Reply
#4

Hmm, did you added the SetPVarString code I posted under OnPlayerConnect too?
Reply
#5

Yep i did
Reply
#6

hmm, I get this with MySQL some times... Try this:

pawn Код:
stock GetIp(playerid)
{
        new Ip[16];
        GetPlayerIp(playerid, Ip, sizeof(Ip));
        return Ip;
}
then

dini_Set(file, "Ip", GetIp(playerid));
Reply
#7

That didn't work neither It's still 255.255.255.255
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)