SA-MP Forums Archive
Server crashes after public SaveDynamicCars is applied via any cmd ... - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Server crashes after public SaveDynamicCars is applied via any cmd ... (/showthread.php?tid=79680)



Server crashes after public SaveDynamicCars is applied via any cmd ... - Castle - 30.05.2009

Server crashes after public SaveDynamicCars is applied via any cmd that works with it...
here is the pastebin: http://pastebin.com/f2e81f03
here is the DynamicFactions variable:
pawn Код:
#define MAX_DYN_CARS 700
enum Cars
{
    CarModel,
    Float:CarX,
    Float:CarY,
    Float:CarZ,
    Float:CarAngle,
    CarColor1,
    CarColor2,
    FactionCar,
    CarType,
};
new DynamicCars[MAX_DYN_CARS][Cars];
public OnGameModeInit()
{
    new File:cars = fopen("Cars/carspawns.cfg",io_read);
    new tmpstr[200];
    for(new i; i <MAX_DYN_CARS;i++)
    {
    fread(cars,tmpstr,sizeof(tmpstr));
    if(!tmpstr[0])return 1;
    else i++;
    }
}
What is the problem that Causes the Crash?


Re: Server crashes after public SaveDynamicCars is applied via any cmd ... - MenaceX^ - 30.05.2009

What gamemode do you use?


Re: Server crashes after public SaveDynamicCars is applied via any cmd ... - Weirdosport - 30.05.2009

I don't know about your main error, but putting i++ at the end of the loop means you'll skip every other car, as it will i++ again afterwards.

And anyway as soon as you come across a line without a car it will return 1...


Re: Server crashes after public SaveDynamicCars is applied via any cmd ... - Castle - 30.05.2009

Running Carlito's RP
And Thanks Wierdo you kinda gave teh solution here... !!!


Re: Server crashes after public SaveDynamicCars is applied via any cmd ... - Castle - 30.05.2009

Ok, Now it saves but saves the cars Like so:
I do /addcar
it saves 167 Cars out of 169 when Server started + the new car = 168 I loose 1 car


Re: Server crashes after public SaveDynamicCars is applied via any cmd ... - Castle - 30.05.2009

Any1?