SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 08/03/2013, 10:45 PM   #1
DreyPT
Big Clucker
 
Join Date: Jun 2011
Location: Amares - Braga - Portugal
Posts: 178
Reputation: 2
Default Bug SaveDynamicCars

Hello, my gamemode when this callback is called it increases the CPU!

pawn Code:
public
    SaveDynamicCars ( )
{
    new
        File: file2 = fopen ( "Frag_Scriptfiles/Cars/carspawns.cfg" , io_write ) ,
        coordsstring [ 512 ] ,
        DynamicCarsIndex ,
        idx
    ;

    DynamicCarsIndex = sizeof ( DynamicCars ) ;

    while (idx < DynamicCarsIndex )
    {
        format(

            coordsstring, sizeof(coordsstring), "%d|%f|%f|%f|%f|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%f|%d|%d|%d|%d|%d|%d|%d|%d\n",
        DynamicCars[idx][CarModel],
        DynamicCars[idx][CarX],
        DynamicCars[idx][CarY],
        DynamicCars[idx][CarZ],
        DynamicCars[idx][CarAngle],
        DynamicCars[idx][CarColor1],
        DynamicCars[idx][CarColor2],
        DynamicCars[idx][FactionCar],
        DynamicCars[idx][CarType],
        DynamicCars[idx][CarPrice],
        DynamicCars[idx][CarOwned],
        DynamicCars[idx][cTrunkGun1],
        DynamicCars[idx][cTrunkAmmo1],
        DynamicCars[idx][cTrunkGun2],
        DynamicCars[idx][cTrunkAmmo2],
        DynamicCars[idx][cTrunkGun3],
        DynamicCars[idx][cTrunkAmmo3],
        DynamicCars[idx][cTrunkGun4],
        DynamicCars[idx][cTrunkAmmo4],
        DynamicCars[idx][cTrunkGun5],
        DynamicCars[idx][cTrunkAmmo5],
        DynamicCars[idx][cTrunkGun6],
        DynamicCars[idx][cTrunkAmmo6],
        DynamicCars[idx][Gasolina],
        DynamicCars[idx][Gasoleo],
        DynamicCars[idx][mod1],
        DynamicCars[idx][mod2],
        DynamicCars[idx][mod3],
        DynamicCars[idx][mod4],
        DynamicCars[idx][mod5],
        DynamicCars[idx][mod6],
        DynamicCars[idx][mod7],
        DynamicCars[idx][mod8],
        DynamicCars[idx][mod9],
        DynamicCars[idx][mod10],
        DynamicCars[idx][mod11],
        DynamicCars[idx][mod12],
        DynamicCars[idx][mod13],
        DynamicCars[idx][mod14],
        DynamicCars[idx][mod15],
        DynamicCars[idx][mod16],
        DynamicCars[idx][mod17],
        DynamicCars[idx][paintjob],
        DynamicCars[idx][CarroStand],
        DynamicCars[idx][NeonRosa],
        DynamicCars[idx][NeonAzul],
        DynamicCars[idx][NeonBranco],
        DynamicCars[idx][NeonAmarelo],
        DynamicCars[idx][NeonVermelho],
        DynamicCars[idx][NeonVerde],
        DynamicCars[idx][NeonLigado],
        DynamicCars[idx][Bateria],
        DynamicCars[idx][Lataria],
        DynamicCars[idx][Kilometros],
        DynamicCars[idx][Metros],
        DynamicCars[idx][Travado],
        DynamicCars[idx][Policia],
        DynamicCars[idx][Taxi],
        DynamicCars[idx][Deposito],
        DynamicCars[idx][Multas],
        DynamicCars[idx][Multado]
        ) ;

        fwrite(file2, coordsstring);
        idx++;
    }

    fclose(file2);

    return 1;
}
DreyPT is offline   Reply With Quote
Old 08/03/2013, 10:53 PM   #2
DreyPT
Big Clucker
 
Join Date: Jun 2011
Location: Amares - Braga - Portugal
Posts: 178
Reputation: 2
Default Re: Bug SaveDynamicCars

Someone ?
DreyPT is offline   Reply With Quote
Old 08/03/2013, 11:32 PM   #3
Sebz
Big Clucker
 
Sebz's Avatar
 
Join Date: Dec 2012
Location: 127.0.0.1
Posts: 89
Reputation: 36
Default Re: Bug SaveDynamicCars

Well. Spawning cars does boost the CPU up. That is supposed to happen. You could try and spawn them at a slower frequency to even out your CPU usage. That's what I do on my server at least, I had the same problem as you are having now when I first started.
Sebz is offline   Reply With Quote
Old 09/03/2013, 08:58 AM   #4
DreyPT
Big Clucker
 
Join Date: Jun 2011
Location: Amares - Braga - Portugal
Posts: 178
Reputation: 2
Default Re: Bug SaveDynamicCars

And how do I do that?
DreyPT is offline   Reply With Quote
Old 09/03/2013, 10:11 AM   #5
DreyPT
Big Clucker
 
Join Date: Jun 2011
Location: Amares - Braga - Portugal
Posts: 178
Reputation: 2
Default Re: Bug SaveDynamicCars

??
DreyPT is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Ajuda] SaveDynamicCars a consumir muita CPU. DreyPT Português/Portuguese 1 09/03/2013 12:12 PM
Problem with SaveDynamicCars CJoao Scripting Help 6 31/08/2012 05:21 PM
Server crashes after public SaveDynamicCars is applied via any cmd ... Castle Help Archive 5 30/05/2009 03:20 PM
SaveDynamicCars bug... Castle Help Archive 5 25/05/2009 11:06 PM


All times are GMT. The time now is 05:00 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.