Hallo ich bins wider euer Lästiger alberto ^^. Also habe ein frage und zwar habe hier timer der Tankstellen und Materialen speichern soll. Aber wnen ich die klammer weg nemme auf server mache dann crasht der server wider.
Hier:
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;
}
Warum Crasht dann der server?
Danke für eure hilfe