15.03.2010, 09:11
Whats wrong with loading from a file?
15.03.2010, 11:19
It saves good and stuff, but then after restart it wont load from the file, and everything is 0..
15.03.2010, 12:46
You can try this:
I don't like the way you put spaces everywhere.
pawn Код:
public LoadFamily()
{
new File: file = fopen("family.ini", io_read);
if ( file )
{
new key[ 256 ], Data[ 256 ];
while ( fread( file , Data , sizeof( Data ) ) )
{
key[0] = EOS;
strcat(key, ini_GetKey( Data ), sizeof( key ) );
if( strcmp( key , "FX" , true ) == 0 ) FX = floatstr( ini_GetValue( Data ) );
else if( strcmp( key , "FY" , true ) == 0 ) FY = floatstr( ini_GetValue( Data ) );
else if( strcmp( key , "FZ" , true ) == 0 ) FZ = floatstr( ini_GetValue( Data ) );
else if( strcmp( key , "FerMat" , true ) == 0 ) FerMat = strval( ini_GetValue( Data ) );
else if( strcmp( key , "FerPot" , true ) == 0 ) FerPot = strval( ini_GetValue( Data ) );
else if( strcmp( key , "FerMoney" , true ) == 0 ) FerMoney = strval( ini_GetValue( Data ) );
else if( strcmp( key , "MX" , true ) == 0 ) MX = floatstr( ini_GetValue( Data ) );
else if( strcmp( key , "MY" , true ) == 0 ) MY = floatstr( ini_GetValue( Data ) );
else if( strcmp( key , "MZ" , true ) == 0 ) MZ = floatstr( ini_GetValue( Data ) );
else if( strcmp( key , "MiyMat" , true ) == 0 ) MiyMat = strval( ini_GetValue( Data ) );
else if( strcmp( key , "MiyPot" , true ) == 0 ) MiyPot = strval( ini_GetValue( Data ) );
else if( strcmp( key , "MiyMoney" , true ) == 0 ) MiyMoney = strval( ini_GetValue( Data ) );
}
fclose(file);
}
return 1;
}
15.03.2010, 12:51
Omg Finn... -.- ..
I LOVE YOU!
I LOVE YOU!
« Next Oldest | Next Newest »
Users browsing this thread: 1 Guest(s)