02.01.2013, 13:42
Quote:
The easiest way to go around that problem would be to not store the vehicles in their own database - but store the vehicles in the user accounts database, rendering the actual server-sided vehicleid somewhat useless and easily avoidable. I'm going to go ahead and guess that this is really isn't what you wanted in the first place, but it is an alternative that should work with no major problems.
|
Quote:
Well instead of saving the vehicle ID, save the vehicle model, position, color, tuning etc. whatever you are looking to save, and save that to the table instead. Then once you relaunch your gamemode/filterscript, just create the vehicles that exist, with the model, colors etc. that are saved in the table.
|
pawn Code:
stock LoadVehicle(houseid)
{
new query[800],result[32];
format(query,sizeof(query),"SELECT * FROM vehicles WHERE VehicleID = '%i'",houseid);
mysql_query(query);
mysql_store_result();
if(mysql_num_rows() != 0) {
while(mysql_fetch_row_format(query,"|")) {
mysql_fetch_field_row(result, "VehicleID"); VehicleInfo[houseid][vVehID] = strval(result);
mysql_fetch_field_row(result, "VehicleOwner"); VehicleInfo[houseid][vVehOwner] = result;
mysql_fetch_field_row(result, "VehicleColor1"); VehicleInfo[houseid][vVehCol1] = strval(result);
mysql_fetch_field_row(result, "VehicleColor2"); VehicleInfo[houseid][vVehCol2] = strval(result);
mysql_fetch_field_row(result, "VehicleParkX"); VehicleInfo[houseid][vVehParkX] = floatstr(result);
mysql_fetch_field_row(result, "VehicleParkY"); VehicleInfo[houseid][vVehParkY] = floatstr(result);
mysql_fetch_field_row(result, "VehicleParkZ"); VehicleInfo[houseid][vVehParkZ] = floatstr(result);
mysql_fetch_field_row(result, "VehicleParkA"); VehicleInfo[houseid][vVehParkA] = floatstr(result);
mysql_fetch_field_row(result, "VehicleLockStatus"); VehicleInfo[houseid][vVehLockStatus] = strval(result);
mysql_fetch_field_row(result, "VehicleModelID"); VehicleInfo[houseid][vVehModelID] = strval(result);
//mysql_fetch_field_row(result, "VehicleSAMPID"); VehicleInfo[houseid][vVehSAMPlID] = strval(result);
}
CreateVehicle(VehicleInfo[houseid][vVehModelID],VehicleInfo[houseid][vVehParkX],VehicleInfo[houseid][vVehParkY],VehicleInfo[houseid][vVehParkZ],VehicleInfo[houseid][vVehParkA],VehicleInfo[houseid][vVehCol1],VehicleInfo[houseid][vVehCol2],99999999999999);
vcount++;
}
mysql_free_result();
return 1;
}
pawn Code:
public OnVehicleSpawn(vehicleid)
{
SetVehiclePos(vehicleid,VehicleInfo[vehicleid][vVehParkX],VehicleInfo[vehicleid][vVehParkY],VehicleInfo[vehicleid][vVehParkZ]);
SetVehicleZAngle(vehicleid,VehicleInfo[vehicleid][vVehParkA]);
return 1;
}
pawn Code:
public OnVehicleSpawn(vehicleid)
{
new vid = VehicleInfo[vehicleid][vVehID];
SetVehiclePos(vid,VehicleInfo[vid][vVehParkX],VehicleInfo[vid][vVehParkY],VehicleInfo[vid][vVehParkZ]);
SetVehicleZAngle(vid,VehicleInfo[vid][vVehParkA]);
return 1;
}
Any input?