sscanf and decimals
#1

This is what I use to load my objects from files

pawn Код:
forward LoadObjects();
public LoadObjects()
{
    new File:file, str[128];
    format(str, sizeof str, "CoDS/Maps/%s/Map.ini", MapName);
    file = fopen(str, io_read);
    if (!file) return 0;
    new
      line[128],
      count,
      modelid,
      Float:X, Float:Y, Float:Z,
      Float:rX, Float:rY, Float:rZ;
    while (fread(file, line))
    {
      if (!sscanf(line, "iffffff", modelid, X, Y, Z, rX, rY, rZ))
      {
        CreateObject(modelid, X, Y, Z, rX, rY, rZ);
        count++;
      }
    }
    fclose(file);
    return count;
}
The only problem being if there is more than 6 decimal places it returns the float as 0.000000

Is there anyway I can fix this without having to go through every object and deleting some decimals?
Reply


Messages In This Thread
sscanf and decimals - by Gappy - 05.10.2009, 04:15
Re: sscanf and decimals - by Gappy - 05.10.2009, 11:04
Re: sscanf and decimals - by dice7 - 05.10.2009, 12:11
Re: sscanf and decimals - by Gappy - 05.10.2009, 21:20
Re: sscanf and decimals - by Doktor - 05.10.2009, 21:40
Re: sscanf and decimals - by Gappy - 05.10.2009, 22:50

Forum Jump:


Users browsing this thread: 1 Guest(s)