02.07.2011, 22:40
Hello, i have a problem with reading using Y_INI.
When i disconnect server it write the data but when i join...it doesen't load..
Here is the code:
When i disconnect server it write the data but when i join...it doesen't load..
Here is the code:
pawn Код:
forward Load_Player_Data( playerid, name[ ], value[ ] );
public Load_Player_Data( playerid, name[ ], value[ ] ) // This helps reading with INI_ParseFile
{
INI_Int( "MONEY", RPlayerData[ playerid ][ R_MONEY ] ); // Read Money
INI_Int( "SCORE", RPlayerData[ playerid ][ R_SCORE ] ); // Read Score
INI_Int( "LEVEL", RPlayerData[ playerid ][ R_LEVEL ] ); // Read Level
return 1;
}
LoadStats( playerid )
{
new UserFile[ 32 ];
format( UserFile, sizeof ( UserFile ), "Radmin/%s.ini", pName( playerid ) ); // Format the file...
INI_ParseFile( UserFile, "Load_Player_%s", .bExtra = true, .extra = playerid); // ParseFile( advanced reading )
}
SaveStats( playerid )
{
new UserFile[ 32 ];
format( UserFile, sizeof ( UserFile ), "Radmin/%s.ini", pName( playerid ) ); // Format the file...
new INI:file = INI_Open( UserFile ); // Create and open the file...
INI_SetTag( file, "Data" ); // Set the tag "Data"
INI_WriteInt( file, "MONEY", RPlayerData[ playerid ][ R_MONEY ] ); // Write Money
INI_WriteInt( file, "SCORE", RPlayerData[ playerid ][ R_SCORE ] ); // Write Score
INI_WriteInt( file, "LEVEL", RPlayerData[ playerid ][ R_LEVEL ] ); // Write Level
INI_Close( file ); // Close File
}