Hallo liebe Community,
ich habe es hinbekommen das die Tuningteile von Fahrzeug gespeichert werden. Aber sie werden nicht dem Auto hinzugefügt.
Mein Code:
getFreeCarID()
{
for(new i=0; i<sizeof(cInfo); i++)
{
if(cInfo[i][id_x]==0)return i;
}
return 0;
}
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();
cInfo[id][model]=cache_get_field_content_int(i,"model",dbhandle);
cInfo[id][besitzer]=cache_get_field_content_int(i,"besitzer",dbhandle);
cInfo[id][c_x]=cache_get_field_content_float(i,"x",dbhandle);
cInfo[id][c_y]=cache_get_field_content_float(i,"y",dbhandle);
cInfo[id][c_z]=cache_get_field_content_float(i,"z",dbhandle);
cInfo[id][c_r]=cache_get_field_content_float(i,"r",dbhandle);
cInfo[id][vcolor1]=cache_get_field_content_int(i,"color1",dbhandle);
cInfo[id][vcolor2]=cache_get_field_content_int(i,"color2",dbhandle);
cInfo[id][tuning1]=cache_get_field_content_int(i,"tuning1",dbhandle);
cInfo[id][tuning2]=cache_get_field_content_int(i,"tuning2",dbhandle);
cInfo[id][tuning3]=cache_get_field_content_int(i,"tuning3",dbhandle);
cInfo[id][tuning4]=cache_get_field_content_int(i,"tuning4",dbhandle);
cInfo[id][tuning5]=cache_get_field_content_int(i,"tuning5",dbhandle);
cInfo[id][tuning6]=cache_get_field_content_int(i,"tuning6",dbhandle);
cInfo[id][tuning7]=cache_get_field_content_int(i,"tuning7",dbhandle);
cInfo[id][tuning8]=cache_get_field_content_int(i,"tuning8",dbhandle);
cInfo[id][tuning9]=cache_get_field_content_int(i,"tuning9",dbhandle);
cInfo[id][tuning10]=cache_get_field_content_int(i,"tuning10",dbhandle);
cInfo[id][tuning11]=cache_get_field_content_int(i,"tuning11",dbhandle);
cInfo[id][tuning12]=cache_get_field_content_int(i,"tuning12",dbhandle);
cInfo[id][tuning13]=cache_get_field_content_int(i,"tuning13",dbhandle);
cInfo[id][tuning14]=cache_get_field_content_int(i,"tuning14",dbhandle);
cInfo[id][db_id]=cache_get_field_content_int(i,"id",dbhandle);
cInfo[id][id_x]=CreateVehicle(cInfo[id][model],cInfo[id][c_x],cInfo[id][c_y],cInfo[id][c_z],cInfo[id][c_r],cInfo[id][vcolor1],cInfo[id][vcolor2],-1);
AddVehicleComponent(cInfo[id][id_x], cInfo[id][tuning1]);
AddVehicleComponent(cInfo[id][id_x], cInfo[id][tuning2]);
AddVehicleComponent(cInfo[id][id_x], cInfo[id][tuning3]);
AddVehicleComponent(cInfo[id][id_x], cInfo[id][tuning4]);
AddVehicleComponent(cInfo[id][id_x], cInfo[id][tuning5]);
AddVehicleComponent(cInfo[id][id_x], cInfo[id][tuning6]);
AddVehicleComponent(cInfo[id][id_x], cInfo[id][tuning7]);
AddVehicleComponent(cInfo[id][id_x], cInfo[id][tuning8]);
AddVehicleComponent(cInfo[id][id_x], cInfo[id][tuning9]);
AddVehicleComponent(cInfo[id][id_x], cInfo[id][tuning10]);
AddVehicleComponent(cInfo[id][id_x], cInfo[id][tuning11]);
AddVehicleComponent(cInfo[id][id_x], cInfo[id][tuning12]);
AddVehicleComponent(cInfo[id][id_x], cInfo[id][tuning13]);
AddVehicleComponent(cInfo[id][id_x], cInfo[id][tuning14]);
}
return 1;
}
Ist im Script natürlich richtig eingerückt.
Mit freundlichen Grüßen,
DexterA1