What's wrong with this code?
#1

All the Prints are being sent to the console, however the userfile isn't having any of the data written to the file.
The PlayerPath is also the right location, it creates the %s.cfg however, nothing is stored to it. It just says the players name as the name of the file.
pawn Code:
new INI:iFile = INI_Open(PlayerPath(playerid));
        print("SaveUserAccount Started");
        INI_SetTag(iFile,"data");
        INI_WriteString(iFile,"IP",pIP[playerid]);
        INI_WriteInt(iFile,"Admin",P_Info[playerid][Admin]);
    INI_WriteInt(iFile,"Cash",GetPlayerCash(playerid));
        INI_WriteInt(iFile,"Score",GetPlayerScore(playerid));
        INI_WriteInt(iFile,"Banned",P_Info[playerid][Banned]);
        INI_WriteInt(iFile,"Kills",P_Info[playerid][Kills]);
        INI_WriteInt(iFile,"Deaths", P_Info[playerid][Deaths]);
        INI_WriteInt(iFile,"Job", P_Info[playerid][Job]);
        INI_WriteInt(iFile,"Rank", P_Info[playerid][Rank]);
        INI_WriteFloat(iFile,"X", P_Info[playerid][pX]);
        INI_WriteFloat(iFile,"Y", P_Info[playerid][pY]);
        INI_WriteFloat(iFile,"Z", P_Info[playerid][pZ]);
        INI_WriteFloat(iFile,"A", P_Info[playerid][pA]);
        INI_WriteInt(iFile,"Int", P_Info[playerid][pInt]);
        INI_WriteInt(iFile,"World", P_Info[playerid][pWorld]);
        INI_WriteInt(iFile,"Faction", P_Info[playerid][Faction]);
        INI_WriteInt(iFile,"CarKey", P_Info[playerid][vKey]);
        INI_WriteInt(iFile,"BizKey", P_Info[playerid][B_Key]);
        INI_WriteInt(iFile,"Skin", GetPlayerSkin(playerid));
        INI_WriteInt(iFile,"Weapon", P_Info[playerid][Gun]);
        INI_WriteInt(iFile,"Bag", P_Info[playerid][B_Bag]);
        INI_WriteInt(iFile,"Licenses", P_Info[playerid][Lic]);
        INI_WriteInt(iFile,"IsNew", P_Info[playerid][New]);
    INI_WriteFloat(iFile,"Armour", P_Info[playerid][pArmour]);
    INI_WriteFloat(iFile,"Health", P_Info[playerid][pHealth]);
        INI_WriteInt(iFile,"Dead", P_Info[playerid][pDead]);
        INI_WriteInt(iFile,"Warnings", P_Info[playerid][Warnings]);
        INI_WriteInt(iFile,"RubberRounds", P_Info[playerid][r_bullets]);
        INI_WriteInt(iFile,"PhoneNum", P_Info[playerid][pPnumber]);
        INI_Close(iFile);
        print("SaveUserAccount Finished");
Serverlog
Code:
[17:29:08] SaveUserAccount Called
[17:29:08] SaveUserAccount Started
[17:29:08] SaveUserAccount Finished
Reply
#2

Hello, Lynn.

Now I don't use INI myself for saving information, however saying that I did look into the Y_INI System on the SAMP Wikipedia and came across this

Code:
INI:INI_Open(filename[])
This function starts the write process, it doesn't actually open a file, just sets up the buffer. On success it returns a handle to the ini with tag INI, on fail it returns INI_NO_FILE (INI:-1)
Have you tried this with your code?

pawn Code:
new INI:iFile = INI_Open(PlayerPath(playerid));
if (file != INI_NO_FILE)
{
        print("SaveUserAccount Started");
        INI_SetTag(iFile,"data");
        INI_WriteString(iFile,"IP",pIP[playerid]);
        INI_WriteInt(iFile,"Admin",P_Info[playerid][Admin]);
    INI_WriteInt(iFile,"Cash",GetPlayerCash(playerid));
        INI_WriteInt(iFile,"Score",GetPlayerScore(playerid));
        INI_WriteInt(iFile,"Banned",P_Info[playerid][Banned]);
        INI_WriteInt(iFile,"Kills",P_Info[playerid][Kills]);
        INI_WriteInt(iFile,"Deaths", P_Info[playerid][Deaths]);
        INI_WriteInt(iFile,"Job", P_Info[playerid][Job]);
        INI_WriteInt(iFile,"Rank", P_Info[playerid][Rank]);
        INI_WriteFloat(iFile,"X", P_Info[playerid][pX]);
        INI_WriteFloat(iFile,"Y", P_Info[playerid][pY]);
        INI_WriteFloat(iFile,"Z", P_Info[playerid][pZ]);
        INI_WriteFloat(iFile,"A", P_Info[playerid][pA]);
        INI_WriteInt(iFile,"Int", P_Info[playerid][pInt]);
        INI_WriteInt(iFile,"World", P_Info[playerid][pWorld]);
        INI_WriteInt(iFile,"Faction", P_Info[playerid][Faction]);
        INI_WriteInt(iFile,"CarKey", P_Info[playerid][vKey]);
        INI_WriteInt(iFile,"BizKey", P_Info[playerid][B_Key]);
        INI_WriteInt(iFile,"Skin", GetPlayerSkin(playerid));
        INI_WriteInt(iFile,"Weapon", P_Info[playerid][Gun]);
        INI_WriteInt(iFile,"Bag", P_Info[playerid][B_Bag]);
        INI_WriteInt(iFile,"Licenses", P_Info[playerid][Lic]);
        INI_WriteInt(iFile,"IsNew", P_Info[playerid][New]);
    INI_WriteFloat(iFile,"Armour", P_Info[playerid][pArmour]);
    INI_WriteFloat(iFile,"Health", P_Info[playerid][pHealth]);
        INI_WriteInt(iFile,"Dead", P_Info[playerid][pDead]);
        INI_WriteInt(iFile,"Warnings", P_Info[playerid][Warnings]);
        INI_WriteInt(iFile,"RubberRounds", P_Info[playerid][r_bullets]);
        INI_WriteInt(iFile,"PhoneNum", P_Info[playerid][pPnumber]);
        INI_Close(iFile);
        print("SaveUserAccount Finished");
}
I'm not saying this is the solution, I'm just trying to help you troubleshoot your problem and come to a solution as fast as possible
Reply
#3

Nope, didn't solve my issue.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)