Anyone have any better Vehicle Saving method? - 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: Anyone have any better Vehicle Saving method? (
/showthread.php?tid=314973)
Anyone have any better Vehicle Saving method? - T0pAz - 01.02.2012
Currently, I am having this Vehicle Saving Method.
pawn Код:
stock SaveVehicles()
{
for(new i; i < MAX_VEHICLES; i++)
{
new Float:p[5], c1, c2;
GetVehiclePos(i, p[0], p[1], p[2]);
GetVehicleZAngle(i, p[3]);
GetVehicleColor(i, c1, c2);
format(largestr, sizeof(largestr), "INSERT INTO `vehicles` (`id`,`model`,`x`,`y`,`z`,`angle`,`color1`,`color2`) VALUES (%d,%d,%f,%f,%f,%f,%d,%d)",
GetVehicleFreeID(), GetVehicleModel(i), p[0], p[1], p[2], p[3], c1, c2);
mysql_query(largestr);
}
return 1;
}
But the problem is, it's taking decade to save the vehicles. Is there anyway I can make a faster Vehicle Saving method?
Re: Anyone have any better Vehicle Saving method? -
MP2 - 01.02.2012
Do you
have to use mySQL?
Re: Anyone have any better Vehicle Saving method? - T0pAz - 01.02.2012
Quote:
Originally Posted by MP2
Do you have to use mySQL?
|
I am thinking of using the normal file function like I did on GF but what do you prefer?
Re: Anyone have any better Vehicle Saving method? - T0pAz - 01.02.2012
Quote:
Originally Posted by ******
Use the one that's faster. If you're just dumping a load of data one time then files may well be the way to go but you won't know until you try. The other question is, if you are saving ALL the vehicles is this just done at game mode exit, and if so why do you care about speed - that takes 12 seconds regardless of how long your code takes.
|
Well it takes 30 secs on Dedicated Server and it's not good when server restarts. I guess File Functions are my best bet.