Whats wrong with loading from a file?
#1

http://pawn.pastebin.com/ArYQaVAn

Somehow it doesnt load from ini, but it saves fine.. ?
Reply
#2

It saves good and stuff, but then after restart it wont load from the file, and everything is 0..
Reply
#3

You can try this:
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;
}
I don't like the way you put spaces everywhere.
Reply
#4

Omg Finn... -.- ..


I LOVE YOU!

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)