How to save and load a text in dini?
#1

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");
Reply
#2

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
Reply
#3

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..
Reply
#4

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
}
Reply
#5

but how that gives me different errors on the setting
Reply
#6

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" );
Reply
#7

I got it, The saving was ok just missed something in my Loading.
thanks for the effort anyway
Reply
#8

Your Welcome.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)