SA-MP Forums Archive
Problem saving playerdata - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problem saving playerdata (/showthread.php?tid=258397)



Problem saving playerdata - Wesley221 - 30.05.2011

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;
    }



AW: Problem saving playerdata - Julian12345 - 30.05.2011

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;
}



Re: Problem saving playerdata - Wesley221 - 30.05.2011

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;
    }



AW: Problem saving playerdata - Julian12345 - 30.05.2011

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


Re: Problem saving playerdata - Wesley221 - 30.05.2011

Yep i did


Re: Problem saving playerdata - Georgelopez1 - 30.05.2011

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));


Re: Problem saving playerdata - Wesley221 - 31.05.2011

That didn't work neither It's still 255.255.255.255