SA-MP Forums Archive
Server can't start with stock - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Server can't start with stock (/showthread.php?tid=283116)



fwrite, fopen - Siedler - 13.09.2011

EDIT:
Another problem..

my public saves now



someone knows the reason?
look at line break :>

Quote:

SaveFrakCars()
{
new write;
new File: data;
new string[100];
for(new i; i < 800; i++)
{
if(CarInfo[i][cFraktion] > 0)
{
format(string, sizeof(string), "%d,%f,%f,%f,%f,%d,%d,%d,%s\n",
CarInfo[i][cModel],
CarInfo[i][cX],
CarInfo[i][cY],
CarInfo[i][cZ],
CarInfo[i][cA],
CarInfo[i][cC1],
CarInfo[i][cC2],
CarInfo[i][cFraktion],
CarInfo[i][cName]);
if(write == 0) {
data = fopen("fahrzeuge.cfg", io_write);
write = 1;
}
else {
data = fopen("fahrzeuge.cfg", io_append);
}
fwrite(data, string);
fclose(data);
}
}
}




Re: Server can't start with stock - Tigerkiller - 13.09.2011

change stock to public and check the code for errors


AW: Server can't start with stock - Siedler - 13.09.2011

same error


Re: Server can't start with stock - [MWR]Blood - 13.09.2011

If you are saving the cars, then it's more logical that you call it OnGameModeExit.
BTW I recommend you to indent your code!


AW: Server can't start with stock - Siedler - 14.09.2011

Another problem..

my public saves now



someone knows the reason?
look at line break :>

Quote:

SaveFrakCars()
{
new write;
new File: data;
new string[100];
for(new i; i < 800; i++)
{
if(CarInfo[i][cFraktion] > 0)
{
format(string, sizeof(string), "%d,%f,%f,%f,%f,%d,%d,%d,%s\n",
CarInfo[i][cModel],
CarInfo[i][cX],
CarInfo[i][cY],
CarInfo[i][cZ],
CarInfo[i][cA],
CarInfo[i][cC1],
CarInfo[i][cC2],
CarInfo[i][cFraktion],
CarInfo[i][cName]);
if(write == 0) {
data = fopen("fahrzeuge.cfg", io_write);
write = 1;
}
else {
data = fopen("fahrzeuge.cfg", io_append);
}
fwrite(data, string);
fclose(data);
}
}
}




Re: AW: Server can't start with stock - Kaperstone - 14.09.2011

Quote:
Originally Posted by Siedler
Посмотреть сообщение
Another problem..

my public saves now

someone knows the reason?
look at line break :>
you forgot the "public" :
pawn Код:
public SaveFrakCars()
{
    new write;
    new File: data;
    new string[100];
    for(new i; i < 800; i++) {
        if(CarInfo[i][cFraktion] > 0) {
            format(string, sizeof(string), "%d,%f,%f,%f,%f,%d,%d,%d,%s\n",
                CarInfo[i][cModel],
                CarInfo[i][cX],
                CarInfo[i][cY],
                CarInfo[i][cZ],
                CarInfo[i][cA],
                CarInfo[i][cC1],
                CarInfo[i][cC2],
                CarInfo[i][cFraktion],
                CarInfo[i][cName]);
            if(write == 0) {
                data = fopen("fahrzeuge.cfg", io_write);
                write = 1;
            }
            else {
                data = fopen("fahrzeuge.cfg", io_append);
            }
            fwrite(data, string);
            fclose(data);
        }
    }
}



AW: Server can't start with stock - Siedler - 14.09.2011

yes, but that is not my question :S
i mean the line breaks..
it is problematic to load from it.


Re: Server can't start with stock - Kaperstone - 14.09.2011

oh..
well its the oldest version -.-
i suggest you to use y_ini , best file reading and saving system