SA-MP Forums Archive
Problems with INI_ParseFile (y_ini) - 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)
+--- Thread: Problems with INI_ParseFile (y_ini) (/showthread.php?tid=314300)



Problems with INI_ParseFile (y_ini) - Jochemd - 29.01.2012

Hello,

I'm experiences some issues with INI_ParseFile in Y_Ini. It appears to be called like this:...
pawn Код:
INI_ParseFile(string, "LoadAccountPass_data", .bExtra = true, .extra = playerid);
... but then it also calls "LoadAccountPass_data" 7 times and "Store" only contains (null)!

pawn Код:
INI_ParseFile(string, "LoadAccountPass_%s", .bExtra = true, .extra = playerid);
But when I do it like this it doesn't even call it a single time (and yes, I am sure this code gets reached!)

For your information, the callback:

pawn Код:
forward LoadAccountPass_data(playerid, name[], value[]);
public LoadAccountPass_data(playerid, name[], value[])
{
    new Store[129];
    INI_String("Password",Store,sizeof(Store));
    SetPVarString(playerid,"Password",Store);
    return 1;
}
Is there any statement for this?

- Jochem


Re: Problems with INI_ParseFile (y_ini) - Konstantinos - 29.01.2012

OnPlayerConnect to load the data ( Password )
pawn Код:
INI_ParseFile(string, "LoadAccountPass_%s", .bExtra = true, .extra = playerid);
On player login
pawn Код:
// Campare with strcmp password and params/inputtext, if it's correct
INI_ParseFile(string, "LoadAccountPass_%s", .bExtra = true, .extra = playerid);



Re: Problems with INI_ParseFile (y_ini) - Jochemd - 29.01.2012

Yes, that is what I already had, but where I was asking for is why it is not working...


Re: Problems with INI_ParseFile (y_ini) - Konstantinos - 29.01.2012

Do you use Whirlpool?
If yes.
1st Way: You can use enums
pawn Код:
enum pInfo
{
    PLAYER_PASS[ 129 ],
    // Rest
}
new
    PlayerInfo[ MAX_PLAYERS ][ pInfo ];

// --
forward LoadAccountPass_data( playerid, name[ ], value[ ] );
public LoadAccountPass_data( playerid, name[ ], value[ ] )
{
    INI_String( "Password", PlayerInfo[ playerid ][ PLAYER_PASS ], 129 );
    // Rest
    return 1;
}
Or PVars
pawn Код:
forward LoadAccountPass_data( playerid, name[ ], value[ ] );
public LoadAccountPass_data( playerid, name[ ], value[ ] )
{
    if( !strcmp( name, "Password" ) ) SetPVarString( playerid, "PassWord", value );
    return 1;
}



Re: Problems with INI_ParseFile (y_ini) - Jochemd - 29.01.2012

Thanks, but it still didn't answer my question...

Edit: At least I found out why it calls it 7 times, but not why it returns (null)