Y_ini Problem! [Rep+]
#1

All the stats except Password and Ip aren`t saving!

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new h, m, s;
    TotalGameTime(playerid, h, m, s);
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    INI_WriteInt(File,"Score",GetPlayerScore(playerid));
    INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
    INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
    INI_WriteInt(File,"Banned",PlayerInfo[playerid][pBanned]);
    INI_WriteInt(File,"Cookies",PlayerInfo[playerid][pCookies]);
    INI_WriteInt(File,"Vip",PlayerInfo[playerid][pVip]);
    INI_WriteInt(File,"Seconds",s);
    INI_WriteInt(File,"Minutes",m);
    INI_WriteInt(File,"Hours",h);
    INI_WriteString(File, "Ip",GetPlayerIPEx(playerid));
    INI_Close(File);
    return 1;
}
Reply
#2

For IP use this :
Add this below new h, m, s.
pawn Код:
new pIp[16];
pawn Код:
Replace that IP with this
GetPlayerIp(playerid, pIp, sizeof(pIp));
INI_WriteString(File,"Ip",PlayerInfo[playerid][pIp]);
Not sure if it will work, Just try.
Reply
#3

Just a note: I recommend that you make something to store money in else you will have alot of hacked money in your server.
Reply
#4

First i need to fix this problem. Then i will improve security.
Reply
#5

INI_WriteString is for writing a string, not an integer, so you should use INI_WriteInt for saving an IP
at registering system or code you use,
the password would be:
pawn Код:
INI_WriteString(File, "Password", inputtext);
or what ever you use as text for the password
Reply
#6

There is no problems with ip saving.

And IP is a string.
Reply
#7

I'd like to point out that getting the IP while a player is disconnecting, the IP will be 255.255.255.255

Also about the password, I don't see any reason why would you like to save the password again. Write the password in the file once a player is about to register and save the password again only if a player wants to change their password. Anything else is pretty much pointless to me.
Reply
#8

I dont save Password on each Disconnect.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)