Mein Timer Läst fuktion nicht saven und crash server

Wichtiger Hinweis: Bitte ändert nicht manuell die Schriftfarbe auf schwarz sondern belasst es bei der Standardeinstellung. Somit tragt ihr dazu bei dass euer Text auch bei Verwendung unseren dunklen Forenstils noch lesbar ist!

Tipp: Ihr wollt längere Codeausschnitte oder Logfiles bereitstellen? Benutzt unseren eigenen PasteBin-Dienst Link
  • Guten arbend liebe user, ich habe ein Selfmad Script und habe ein Savefunktion für Tankstellen und Produkte.


    Nun wenn ich timer wider rein mache crash er den server und savt die daten nicht und ich weiß einfahc nicht wiso.



    Code:


    SetTimer("Save", 600000, true); // Saved Tankstellen und Produkte


    public Save()
    {
    SaveTankstellen();
    SaveProducts();
    }



    public SaveTankstellen()
    {
    for(new i = 0; i < MAX_TANKEN; i++)
    {
    new string[64];
    new buffer[32];
    format(string, sizeof(string), "/tanken/%d.tankstelle", i);
    if(!fexist(string)) continue;
    format(buffer, sizeof(buffer), "%d", TankStellen[i][liter]);
    new File:tfile = fopen(string, io_write);
    fwrite(tfile, buffer);
    fclose(tfile);
    }
    return 1;
    }


    public SaveProducts()
    {
    new string[64];
    new buffer[32];
    {
    format(string, sizeof(string), "/produkt/wang.product");
    format(buffer, sizeof(buffer), "%d", Produkte[proWANG]);
    new File:cFile = fopen(string, io_write);
    fwrite(cFile, buffer);
    fclose(cFile);
    }
    {
    format(string, sizeof(string), "/produkt/otto.product");
    format(buffer, sizeof(buffer), "%d", Produkte[proOTTO]);
    new File:cFile = fopen(string, io_write);
    fwrite(cFile, buffer);
    fclose(cFile);
    }
    {
    format(string, sizeof(string), "/produkt/boot.product");
    format(buffer, sizeof(buffer), "%d", Produkte[proBOOT]);
    new File:cFile = fopen(string, io_write);
    fwrite(cFile, buffer);
    fclose(cFile);
    }
    {
    format(string, sizeof(string), "/produkt/heli.product");
    format(buffer, sizeof(buffer), "%d", Produkte[proHELI]);
    new File:cFile = fopen(string, io_write);
    fwrite(cFile, buffer);
    fclose(cFile);
    }
    {
    format(string, sizeof(string), "/produkt/moped.product");
    format(buffer, sizeof(buffer), "%d", Produkte[proMOPED]);
    new File:cFile = fopen(string, io_write);
    fwrite(cFile, buffer);
    fclose(cFile);
    }
    {
    format(string, sizeof(string), "/produkt/grotti.product");
    format(buffer, sizeof(buffer), "%d", Produkte[proGROTTI]);
    new File:cFile = fopen(string, io_write);
    fwrite(cFile, buffer);
    fclose(cFile);
    }
    {
    format(string, sizeof(string), "/produkt/shody.product");
    format(buffer, sizeof(buffer), "%d", Produkte[proShody]);
    new File:cFile = fopen(string, io_write);
    fwrite(cFile, buffer);
    fclose(cFile);
    }
    return 1;
    }


    public LoadProducts()
    {
    new string[64];
    new buffer[32];
    format(string, sizeof(string), "/produkt/wang.product");
    if(fexist(string))
    {
    new File:cFile = fopen(string, io_read);
    fread(cFile, buffer, sizeof(buffer), false);
    Produkte[proWANG] = strval(buffer);
    fclose(cFile);
    }
    format(string, sizeof(string), "/produkt/otto.product");
    if(fexist(string))
    {
    new File:cFile = fopen(string, io_read);
    fread(cFile, buffer, sizeof(buffer), false);
    Produkte[proOTTO] = strval(buffer);
    fclose(cFile);
    }
    format(string, sizeof(string), "/produkt/heli.product");
    if(fexist(string))
    {
    new File:cFile = fopen(string, io_read);
    fread(cFile, buffer, sizeof(buffer), false);
    Produkte[proHELI] = strval(buffer);
    fclose(cFile);
    }
    format(string, sizeof(string), "/produkt/boot.product");
    if(fexist(string))
    {
    new File:cFile = fopen(string, io_read);
    fread(cFile, buffer, sizeof(buffer), false);
    Produkte[proBOOT] = strval(buffer);
    fclose(cFile);
    }
    format(string, sizeof(string), "/produkt/moped.product");
    if(fexist(string))
    {
    new File:cFile = fopen(string, io_read);
    fread(cFile, buffer, sizeof(buffer), false);
    Produkte[proMOPED] = strval(buffer);
    fclose(cFile);
    }
    format(string, sizeof(string), "/produkt/grotti.product");
    if(fexist(string))
    {
    new File:cFile = fopen(string, io_read);
    fread(cFile, buffer, sizeof(buffer), false);
    Produkte[proGROTTI] = strval(buffer);
    fclose(cFile);
    }
    format(string, sizeof(string), "/produkt/shody.product");
    if(fexist(string))
    {
    new File:cFile = fopen(string, io_read);
    fread(cFile, buffer, sizeof(buffer), false);
    Produkte[proShody] = strval(buffer);
    fclose(cFile);
    }
    return 1;
    }


    public LoadTankstellen()
    {
    for(new i = 0; i < MAX_TANKEN; i++)
    {
    new string[64];
    new buffer[32];
    format(string, sizeof(string), "/tanken/%d.tankstelle", i);
    if(!fexist(string)) continue;
    new File:tfile = fopen(string, io_read);
    fread(tfile, buffer, sizeof(buffer), false);
    TankStellen[i][liter] = strval(buffer);
    //strmid(TankStellen[i][liter] , buffer , 0 , strlen( buffer ) , sizeof( i ) );
    fclose(tfile);
    }
    return 1;
    }


    Nur wiso?