Anyone have any better Vehicle Saving method?
#1

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?
Reply
#2

Do you have to use mySQL?
Reply
#3

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?
Reply
#4

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)