Das hatte ich nicht gemeint mit new Float:CarHealth[MAX_VEHICLES];
Bei deinem Enum AutoInfo bzw. dort wo auch "Besitzer" und "model" etc. steht,
fügst du noch ein:
Float:carhealth
Dann fügst du unter deine include folgendes ein:
native IsValidVehicle(vehicleid);
public OnPlayerCarsLoad(playerid)
{
new num_fields,num_rows;
cache_get_data(num_rows,num_fields,dbhandle);
if(!num_rows)return 1;
for(new i=0; i<num_rows; i++)
{
new id=getFreeCarID();
AutoInfo[id] [Besitzer]=cache_get_field_content_int(i,"Besitzer",dbhandle);
AutoInfo[id][model]=cache_get_field_content_int(i,"model",dbhandle);
AutoInfo[id][c_x]=cache_get_field_content_float(i,"c_x",dbhandle);
AutoInfo[id][c_y]=cache_get_field_content_float(i,"c_y",dbhandle);
AutoInfo[id][c_z]=cache_get_field_content_float(i,"c_z",dbhandle);
AutoInfo[id][c_r]=cache_get_field_content_float(i,"c_r",dbhandle);
AutoInfo[id] [db_id]=cache_get_field_content_int(i,"id",dbhandle);
AutoInfo[id][Fahrzeugid]=CreateVehicle(AutoInfo[id][model],AutoInfo[id][c_x],AutoInfo[id][c_y],AutoInfo[id][c_z],AutoInfo[id][c_r],-1,-1,-1);
}
return 1;
}
Zu:
public OnPlayerCarsLoad(playerid)
{
new num_fields,num_rows;
cache_get_data(num_rows,num_fields,dbhandle);
if(!num_rows)return 1;
for(new i=0; i<num_rows; i++)
{
new id=getFreeCarID();
AutoInfo[id] [Besitzer]=cache_get_field_content_int(i,"Besitzer",dbhandle);
AutoInfo[id][model]=cache_get_field_content_int(i,"model",dbhandle);
AutoInfo[id][c_x]=cache_get_field_content_float(i,"c_x",dbhandle);
AutoInfo[id][c_y]=cache_get_field_content_float(i,"c_y",dbhandle);
AutoInfo[id][c_z]=cache_get_field_content_float(i,"c_z",dbhandle);
AutoInfo[id][c_r]=cache_get_field_content_float(i,"c_r",dbhandle);
AutoInfo[id] [db_id]=cache_get_field_content_int(i,"id",dbhandle);
AutoInfo[id][carhealth] = cache_get_field_content_float(i,"Schaden",dbhandle);
AutoInfo[id][Fahrzeugid]= CreateVehicle(AutoInfo[id][model],AutoInfo[id][c_x],AutoInfo[id][c_y],AutoInfo[id][c_z],AutoInfo[id][c_r],-1,-1,-1);
SetVehicleHeal(id);
}
return 1;
}
So nun noch den Schaden ab und an speichern (laut deiner Vorlage):
public Autoschadenspeichern()
{
new query[125];
for(new veh = 0; veh < MAX_VEHICLES;veh++)
{
if(!IsValidVehicle(veh))
{
GetVehicleHealth(AutoInfo[veh][Fahrzeugid],AutoInfo[veh][carhealth]);
format(query,sizeof(query,sizeof(query),"UPDATE Autos SET Schaden = '%f' WHERE Besitzer = '%s'", AutoInfo[veh][carhealth],AutoInfo[veh] [Besitzer]);
mysql_function_query(dbhandle,query,false,"","");
}
}
return 1;
}
ganz unten hin (am besten am Ende des Scriptes)
stock SetVehicleHeal(id) return SetVehicleHealth(AutoInfo[id][Fahrzeugid],AutoInfo[id][carhealth]);
MfG