Hab mir ein dynamisches Autohaus System gescriptet, Problem ist wenn man ein Autohaus-Vehikel betritt returnt es die falsche Daten, zb anstatt die Modell ID vom Infernus die von den anderem Vehikel, auch 0 bei den Vehikeln.
Hier paar Systeme, wo ich nicht weiß wo ein Fehler ist:
new DealerShipCarInfo[MAX_VEHICLES][dccEnum];
new vehicleid;
for(new i = 0; i < rows; i ++)
{
DealerShipCarInfo[vehicleid][dcCarExists] = 1;
cache_get_value_name_int(i, "id", DealerShipCarInfo[vehicleid][dcInsertID]);
cache_get_value_name_int(i, "dealershipid", DealerShipCarInfo[vehicleid][dcCarOwner]);
cache_get_value_name_int(i, "model", DealerShipCarInfo[vehicleid][dcModel]);
cache_get_value_name_int(i, "price", DealerShipCarInfo[vehicleid][dcModelPrice]);
cache_get_value_name_float(i, "pos_x", DealerShipCarInfo[vehicleid][dcModelPosX]);
cache_get_value_name_float(i, "pos_y", DealerShipCarInfo[vehicleid][dcModelPosY]);
cache_get_value_name_float(i, "pos_z", DealerShipCarInfo[vehicleid][dcModelPosZ]);
cache_get_value_name_float(i, "pos_a", DealerShipCarInfo[vehicleid][dcModelPosA]);
vehicleid = CreateVehicle(DealerShipCarInfo[vehicleid][dcModel], DealerShipCarInfo[vehicleid][dcModelPosX], DealerShipCarInfo[vehicleid][dcModelPosY], DealerShipCarInfo[vehicleid][dcModelPosZ], DealerShipCarInfo[vehicleid][dcModelPosA], 0, 0, -1);
dcVehicle{vehicleid} = true;
}
forward OnDealerShipVehCreated(dealershipid, model, price, Float:x, Float:y, Float:z, Float:angle);
public OnDealerShipVehCreated(dealershipid, model, price, Float:x, Float:y, Float:z, Float:angle)
{
new vehicleid;
vehicleid = CreateVehicle(model, x, y, z, angle, 0, 0, -1);
dcVehicle{vehicleid} = true;
DealerShipCarInfo[vehicleid][dcInsertID] = cache_insert_id();
DealerShipCarInfo[vehicleid][dcCarOwner] = dealershipid;
DealerShipCarInfo[vehicleid][dcModel] = model;
DealerShipCarInfo[vehicleid][dcModelPrice] = price;
DealerShipCarInfo[vehicleid][dcModelPosX] = x;
DealerShipCarInfo[vehicleid][dcModelPosY] = y;
DealerShipCarInfo[vehicleid][dcModelPosZ] = z;
DealerShipCarInfo[vehicleid][dcModelPosA] = angle;
return 1;
}