public OnGameModeExit()
{
for(new ServerVehicles; ServerVehicles < MAX_VEHICLES; ServerVehicles++)
{
new Float:PosnX;
new Float:PosY;
new Float:PosZ;
new Float:aAngle;
new aModel;
aModel = GetVehicleModel(GetPlayerVehicleID(ServerVehicles));
GetVehiclePos(ServerVehicles, PositsioonX, PositsioonY, PositsioonZ);
GetVehicleZAngle(GetPlayerVehicleID(ServerVehicles), aAngle);
format(Query, sizeof(Query), "UPDATE `cars` SET `PosX` = '%f', `PosY` = '%f', `PosZ` = '%f', `AutoAngle` = '%f' WHERE `CarID` = '%d'",
PosX,
PosY,
PosnZ,
aAngle,
aAngle,
aModel);
mysql_query(Query);
}
mysql_close();
return 1;
}
stock savecars()
{
for(new id; id < cars; id++)
{
new Float:pposX, Float:pposY, Float:pposZ,Float:AutoAngle;
GetVehiclePos(id, pposX, pposY, pposZ);
GetVehicleZAngle(id, AutoAngle);
format(Query, sizeof(Query), "UPDATE `cars` SET `PosX` = '%f', `PosY` = '%f', `PosZ` = '%f', `AutoAngle` = '%f' WHERE `carid` = '%d'",
pposX,
pposY,
pposZ,
AutoAngle,
id);
mysql_query(Query);
}
}
|
3. Don't write in noob SQL language (e.g. puting '' for every possible values, etc).
|
|
What do you mean "putting " for every possible value"? Do you mean adding `'s around each variable place holder? (%s, %d, %f)
|
|
' is not " and not `. ' is to be put around string values. I find it stupid when people ask basic questions about SQL and they have hundreas of ` and ' symbols in their query. I call that noob SQL language.
|
|
It's a strange way of using MySQL, and it's probably not going to work, there's simply far too many queries you'll need to execute in order to save all of that information. The server would probably crash before it gets anywhere near updating all of those rows.
You should re-think your way of saving all of the vehicles, possibly by a file system, because this is madness ![]() |
|
Nothing wrong with that, i had a house system with about 100 houses in a loop, and in every loop it had about 3 to 5 querys.
|
|
In need of attention. |