Problems and y_ini.inc
#1

Hi,
I've been trying to convert fIni (a newer version of bIni by DraKiNs) to Y_INI because prior system was giving me loading issues, some stuff wouldn't load correctly.

I've changed the saving part to save data correctly; tested. What is not working correctly is the loading part, to be more specific the loading.

Say I have this file:
pawn Код:
Password=7800ACA2256BE177C289327017033B8FC9962471837E834AB29A86153025ADB490B618C7F36713E3698E8FDA3D5DE74C73478EC7C3FB11089BC56DEBD25E9E8
Prefix=None
Cash=0
Admin=0
Helper=0
Age=20
Sex=0
Skin=35
Then this script:
pawn Код:
new playerName[24], userFile[64];
GetPlayerName( playerid, playerName, 24 );
format( userFile, sizeof (userFile), UserPath(playerid) );
INI_ParseFile(userFile, "Load_User_Data", .bExtra = true, .extra = playerid );
pawn Код:
forward Load_User_Data( playerid, name[], value[] );
public Load_User_Data( playerid, name[], value[] )
{
    ResetServerMoney( playerid );
    if( LoadedData[playerid] == 1 ) return 1;

    printf("name[]: %s", name);
    printf("value[]: %s", value);
   
    INI_String( "Prefix", PlayerInfo[playerid][Prefix], 128 );
    INI_Int( "Cash", PlayerInfo[playerid][Cash] );
    INI_Int( "Admin", PlayerInfo[playerid][Admin] );
    INI_Int( "Helper", PlayerInfo[playerid][Helper] );
    INI_Int( "Age", PlayerInfo[playerid][Age] );
    INI_Int( "Sex", PlayerInfo[playerid][Sex] );
    INI_Int( "Skin", PlayerInfo[playerid][Skin] );
However it doesn't load correctly! The variables are set to 0 instead of the data written in the file, and debugging gives me the following:
pawn Код:
[23:35:33] value[]: 7800ACA2256BE177C289327017033B8FC9962471837E834AB29A86153025ADB490B618C7F36713E3698E8FDA3D5DE74C73478EC7C3FB11089BC56DEBD25E9E8
[23:35:33] name[]: Password
The key "password" is the first line of the file, and I don't need it in this case, as it's read only when I want to check if an input text matches the hashed password. I've also altered a bit the y_ini code to make it function with "=" signs without spaces, this way:
x = 1
becomes:
x=1

I want to know how to load the data correctly, if I'm doing it wrong. Thanks in advance.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)