[SAVING BUG] How to do it?
#1

There' s a simple bug on my vehicle system ( I think the last u_u ). And I bet it's on OnFilterScriptInit. Look;

Код:
 

public OnFilterScriptExit()
{
    new Float:x,Float:y,Float:z,Float:a;
    new str[64],Model;
    new count = 0;
    new File:CarFile = fopen(ARQUIVO_CARROS,io_write);
    for(new i=1; i < MAX_VEHICLES; i++)
    {
        if((Model=GetVehicleModel(i)))
        {
			count++;
			{
              GetVehiclePos(i,x,y,z);
              GetVehicleZAngle(i,a);
              format(str,64,"%d,%f,%f,%f,%f,%d,%d ;\r\n",Model,x,y,z,a,-1,-1);
              fwrite(CarFile,str);
            }
            else if(count == 0) return false;
        }
        
    }
    fclose(CarFile);
    return 1;
}
That saves and reload the cars normally, on same x,y,z and model. But when I destroy all cars of server, and I reload on close the FS (server console or /rcon reloadfs savecar), it deletes all cars saved before. And I'd like to know how to avoid it x=
Reply
#2

Only Bump after 48 hours...

But its doing what you tell it to. If you destroy all the cars, obviously there are no cars to save so it deletes all of the cars in your file. Its not an error. But you could try unloading the FS, destroying the cars, then reloading it. It wouldn't save anything since nothing changed.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)