LoadObjectsFromFile Needed ! Get IN !
#1

Hey,
I Need a function wich will load all of my objects from a ini file.

I saw this function -
Код:
stock LoadObjectsFromFile(const filename[])
{
        new Objects_loaded;
        if(!fexist(filename))
        return printf("[Objects] Couldn't load objects from %s [Reason : File doesn't exist]", filename);

        new File:Handler = fopen(filename, io_read);
        if(!Handler) return printf("[Objects] Couldn't load objects from %s [Reason : I/O Error]", filename);

        new Line[256], Index = -1, Model, Float:PosX, Float:PosY, Float:PosZ, Float:RotX, Float:RotY, Float:RotZ,Float:DrawDistance;
        Objects_loaded = 0;
        while(fread(Handler, Line))
        {
        Index++;
                new EOL = strfind(Line, ";", false);
                if(EOL != -1) strdel(Line, EOL - 1, sizeof Line - 1);
        else
                {
                        printf("[Objects] Error reading @LineIndex %i from %s (EOL not found)", Index, filename);
                        continue;
                }
                if(!sscanf(Line[13], "p<,>iffffffF(100)", Model, PosX, PosY, PosZ, RotX, RotY, RotZ, DrawDistance))
                {
                CreateObject(Model, PosX, PosY, PosZ, RotX, RotY, RotZ, DrawDistance);
                Objects_loaded++;
        }
        else printf("[Objects] Error reading @LineIndex %i from %s (Invalid format)", Index, filename);
     }
        fclose(Handler);
    printf("[Objects] Loaded %d objects from: %s", Objects_loaded, filename);
    return true;
}
But it dont work for me.
I've printed the poses from that function and it loads only : "0.00000" for everthing(Object Model,FloatX and so..).
Reply


Messages In This Thread
LoadObjectsFromFile Needed ! Get IN ! - by sKgaL - 10.04.2013, 11:21
Re: LoadObjectsFromFile Needed ! Get IN ! - by Pottus - 10.04.2013, 11:31
Re: LoadObjectsFromFile Needed ! Get IN ! - by sKgaL - 11.04.2013, 12:13
Re: LoadObjectsFromFile Needed ! Get IN ! - by Pottus - 11.04.2013, 12:19

Forum Jump:


Users browsing this thread: 1 Guest(s)