07.04.2013, 16:51
Hey there!
Does anyone have any idea at all as to why my vehicles positions aren't saving? Basically they save to where they were spawned so if the server crashes or restarts the vehicles no matter how far driven away they always spawn where they were originally spawned. Not where they were left.
All help is greatly appreciated.
Cheers.
Does anyone have any idea at all as to why my vehicles positions aren't saving? Basically they save to where they were spawned so if the server crashes or restarts the vehicles no matter how far driven away they always spawn where they were originally spawned. Not where they were left.
pawn Code:
public OnGameModeInit()
{
LoadVehicles();
pawn Code:
public OnGameModeExit()
{
SaveVehicles(0);
pawn Code:
stock SaveVehicles(pos)
{
foreach(Vehicles, i)
{
SaveVehicle(i,pos);
}
}
pawn Code:
stock SaveVehicle(i,pos)
{
new id = GetCar(i,1);
if(pos)
{
GetVehiclePos(i, Vehicle[id][vPositionX], Vehicle[id][vPositionY], Vehicle[id][vPositionZ]);
GetVehicleZAngle(i, Vehicle[id][vAngleZ]);
}
new model = GetVehicleModel(i);
format(query, sizeof(query), "UPDATE `Vehicles` SET `VehicleID` = '%d', `ModelID` = '%d', `PositionX` = '%f', `PositionY` = '%f', `PositionZ` = '%f', `AngleZ` = '%f', `Color1` = '%d', `Color2` = '%d' WHERE `ID` = '%d'",i,model,Vehicle[id][vPositionX],Vehicle[id][vPositionY],Vehicle[id][vPositionZ],Vehicle[id][vAngleZ],Vehicle[id][vColor1],Vehicle[id][vColor2], id);
mysql_query(query);
format(query,sizeof(query), "UPDATE `Vehicles` SET `Faction` = '%d', `SubFaction` = '%d', `Plate` = '%s' WHERE `ID` = '%d'",Vehicle[id][vFaction],Vehicle[id][vSubFaction],Vehicle[id][vPlate],id);
mysql_query(query);
return 1;
}
All help is greatly appreciated.
Cheers.


