string overwrites the last one in file
#6

I haven't experienced too much with file writing, but I reckon this is how it would go
pawn Код:
stock SaveObjects()
{
    // You would make new variables that will hold the object info
    new
            modelid,
            Float:x,
            Float:y,
            Float:z,
            Float:rotX,
            Float:rotY,
            Float:rotZ,
            coordstring[128]
    ;
    for(new i=0;i<11;i++) // Make a loop through 11 objects.
    {
        GetObjectRot(i, rotX, rotY, rotZ);
        GetObjectPos(i, x, y, z);
        new File:objects = fopen("objects.txt",io_append);
        format(coordstring,sizeof(coordstring),"%d,%f,%f,%f,%f,%f,%f\r\n",i,x,y,z,rotX,rotY,rotZ);
        fwrite(objects, coordstring);
        fclose(objects);
    }
    return 1;
}
So I'm guessing you would add SaveObjects(); in your edit object command?
This is just an example.
Reply


Messages In This Thread
string overwrites the last one in file - by HondaCBR - 10.04.2012, 23:41
Re: string overwrites the last one in file - by ReneG - 10.04.2012, 23:50
Re: string overwrites the last one in file - by HondaCBR - 11.04.2012, 00:08
Re: string overwrites the last one in file - by ReneG - 11.04.2012, 00:22
Re: string overwrites the last one in file - by HondaCBR - 11.04.2012, 00:33
Re: string overwrites the last one in file - by ReneG - 11.04.2012, 00:52
Re: string overwrites the last one in file - by HondaCBR - 11.04.2012, 01:31

Forum Jump:


Users browsing this thread: 3 Guest(s)