It' not loading The objects from the file :(
#4

Try this:
pawn Код:
stock LoadObjectsFromFile(const filename[])
{
    new File:file = fopen(filename, io_read);
    if (!file) return 0;
    TotalObjects = 0;
    new line[100], modelid, Float:Pos[6];
    while (fread(file, line))
    {
        // Use "," as delimiter and read one integer and 6 floats, and store the values in the following variables
        sscanf(line, "p<,>iffffff", modelid, Pos[0], Pos[1], Pos[2], Pos[3], Pos[4], Pos[5]);

        ActivityObject[TotalObjects] = CreateDynamicObject(modelid, Pos[0], Pos[1], Pos[2], Pos[3], Pos[4], Pos[5], ActivityInfo[ActivityNumber][a_VirtualWorld], ActivityInfo[ActivityNumber][a_Interior]);
        TotalObjects++;
    }
    fclose(file);
    return printf("Objects Loaded: %d", TotalObjects);
}
It's much shorter and better looking as well.

You'll need to have sscanf plugin:
https://sampforum.blast.hk/showthread.php?tid=120356
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)