How to save and load a text in dini? -
milanosie - 31.01.2012
Hi there, What Function do I use to save and load text from a dini file?
I tried dini_Get but it says it must be assigned to an array:
pawn Код:
CarInfo[i][CarOwner] = dini_Get(file4, "CarOwner");
Re: How to save and load a text in dini? -
Tanush123 - 31.01.2012
Damn i never used dini for 7 months or shit, i think its something like this,
saving
pawn Код:
dini_Set(file4,"CarOwner",String);
and loading must be
pawn Код:
dini_Set(file4,"CarOwner",CarInfo[i][CarOwner]);
Well try that, i might had failed cause i didn't use dini for a long time :P
Re: How to save and load a text in dini? -
milanosie - 31.01.2012
Quote:
Originally Posted by Tanush123
Damn i never used dini for 7 months or shit, i think its something like this,
saving
pawn Код:
dini_Set(file4,"CarOwner",String);
and loading must be
pawn Код:
dini_Set(file4,"CarOwner",CarInfo[i][CarOwner]);
Well try that, i might had failed cause i didn't use dini for a long time :P
|
That loading is wrong I think,
It will set the file thing to an unsetted parameter (CarInfo)
Since on the loading It needs to set the CarInfor[i][CarOwner] to the string(this case name) saved in the file..
Re: How to save and load a text in dini? -
Konstantinos - 31.01.2012
That was correct for loading
pawn Код:
CarInfo[i][CarOwner] = dini_Get(file4, "CarOwner");
But make sure at your enum the
CarOwner is in array
pawn Код:
enum enum_name
{
CarOwner[ MAX_PLAYER_NAME ],
// Rest
}
Re: How to save and load a text in dini? -
milanosie - 31.01.2012
but how that gives me different errors on the setting
Re: How to save and load a text in dini? -
Konstantinos - 31.01.2012
Post the error. It should be:
pawn Код:
enum enum_name
{
CarOwner[ MAX_PLAYER_NAME ],
// Rest
}
pawn Код:
// Set Name
new
Name[ MAX_PLAYER_NAME ], Save_String[ 32 ]; // Or '64' besides on your File Location.
GetPlayerName( playerid, Name, MAX_PLAYER_NAME );
format( Save_String, sizeof( Save_String ), /* Use your path -> */"Load/Vehicles/%s.ini", Name );
// Save
dini_Set( Save_String, "CarOwner", Name );
// Load
dini_Get( Save_String, "CarOwner" );
Re: How to save and load a text in dini? -
milanosie - 31.01.2012
I got it, The saving was ok just missed something in my Loading.
thanks for the effort anyway
Re: How to save and load a text in dini? -
Konstantinos - 31.01.2012
Your Welcome.