Ich bin nun soweit, dass die Speicherung und das Laden der Gangcars über MySQL ohne Probleme funktioniert, darunter fällt auch das Tuning. Einziger Haken ist, dass die Tuningteile, aus irgendeinem Grund nicht am Fahrzeug angebracht werden. HIer dazu mein Code vom Laden der Gangcars und dem Teil, wo die Komponenten angebracht werden sollten.
public LoadGangAutos()
{
new string[128];
mysql_free_result();
for(new i = 0; i < sizeof(GangAutoInfo); i++)
{
format(string, sizeof(string),"SELECT * FROM `gangautos` WHERE `SlotID` = '%d'", i);
mysql_query(string);
mysql_store_result();
if(mysql_num_rows() != 0)
{
new val[ 512 ];
mysql_fetch_field("CarID", val); GangAutoInfo[i][cID] = strval( val );
mysql_fetch_field("OwnerID", val); GangAutoInfo[i][cOwner] = strval( val );
mysql_fetch_field("TypID", val); GangAutoInfo[i][cTyp] = strval( val );
mysql_fetch_field("PosX", val); GangAutoInfo[i][cPosX] = floatstr( val );
mysql_fetch_field("PosY", val); GangAutoInfo[i][cPosY] = floatstr( val );
mysql_fetch_field("PosZ", val); GangAutoInfo[i][cPosZ] = floatstr( val );
mysql_fetch_field("Rotation", val); GangAutoInfo[i][cRot] = floatstr( val );
mysql_fetch_field("Farbe1", val); GangAutoInfo[i][cColor1] = strval( val );
mysql_fetch_field("Farbe2", val); GangAutoInfo[i][cColor2] = strval( val );
mysql_fetch_field("Status", val); GangAutoInfo[i][cStatus] = strval( val );
mysql_fetch_field("Tank", val); GangAutoInfo[i][cTank] = strval( val );
mysql_fetch_field("ReSpawnTime", val); GangAutoInfo[i][cReSpawnTime] = strval( val );
mysql_fetch_field("Tuning0", val); GangAutoInfo[i][cTuning][0] = strval ( val );
mysql_fetch_field("Tuning1", val); GangAutoInfo[i][cTuning][1] = strval ( val );
mysql_fetch_field("Tuning2", val); GangAutoInfo[i][cTuning][2] = strval ( val );
mysql_fetch_field("Tuning3", val); GangAutoInfo[i][cTuning][3] = strval ( val );
mysql_fetch_field("Tuning4", val); GangAutoInfo[i][cTuning][4] = strval ( val );
mysql_fetch_field("Tuning5", val); GangAutoInfo[i][cTuning][5] = strval ( val );
mysql_fetch_field("Tuning6", val); GangAutoInfo[i][cTuning][6] = strval ( val );
mysql_fetch_field("Tuning7", val); GangAutoInfo[i][cTuning][7] = strval ( val );
mysql_fetch_field("Tuning8", val); GangAutoInfo[i][cTuning][8] = strval ( val );
mysql_fetch_field("Tuning9", val); GangAutoInfo[i][cTuning][9] = strval ( val );
mysql_fetch_field("Tuning10", val); GangAutoInfo[i][cTuning][10] = strval ( val );
mysql_fetch_field("Tuning11", val); GangAutoInfo[i][cTuning][11] = strval ( val );
mysql_fetch_field("Tuning12", val); GangAutoInfo[i][cTuning][12] = strval ( val );
mysql_fetch_field("Tuning13", val); GangAutoInfo[i][cTuning][13] = strval ( val );
}
else
{
GangAutoInfo[i][cID] = -1;
GangAutoInfo[i][cOwner] = -1;
GangAutoInfo[i][cTyp] = -1;
GangAutoInfo[i][cPosX] = 0;
GangAutoInfo[i][cPosY] = 0;
GangAutoInfo[i][cPosZ] = 0;
GangAutoInfo[i][cRot] = 0;
GangAutoInfo[i][cColor1] = -1;
GangAutoInfo[i][cColor2] = -1;
GangAutoInfo[i][cStatus] = -1;
GangAutoInfo[i][cTank] = 50;
GangAutoInfo[i][cReSpawnTime] = 1800;
GangAutoInfo[i][cStandTime] = 0;
GangAutoInfo[i][cTuning][0] = 0;
GangAutoInfo[i][cTuning][1] = 0;
GangAutoInfo[i][cTuning][2] = 0;
GangAutoInfo[i][cTuning][3] = 0;
GangAutoInfo[i][cTuning][4] = 0;
GangAutoInfo[i][cTuning][5] = 0;
GangAutoInfo[i][cTuning][6] = 0;
GangAutoInfo[i][cTuning][7] = 0;
GangAutoInfo[i][cTuning][8] = 0;
GangAutoInfo[i][cTuning][9] = 0;
GangAutoInfo[i][cTuning][10] = 0;
GangAutoInfo[i][cTuning][11] = 0;
GangAutoInfo[i][cTuning][12] = 0;
GangAutoInfo[i][cTuning][13] = 0;
}
mysql_free_result();
}
return 1;
}
forward GangCarTune();
public GangCarTune()
{
for(new h = 0; h < sizeof(GangAutoInfo); h++)
{
if(GangAutoInfo[h][cTuning][0] != 0) { AddVehicleComponent(GangAutoInfo[h][cID],GangAutoInfo[h][cTuning][0]); }
if(GangAutoInfo[h][cTuning][1] != 0) { AddVehicleComponent(GangAutoInfo[h][cID],GangAutoInfo[h][cTuning][1]); }
if(GangAutoInfo[h][cTuning][2] != 0) { AddVehicleComponent(GangAutoInfo[h][cID],GangAutoInfo[h][cTuning][2]); }
if(GangAutoInfo[h][cTuning][3] != 0) { AddVehicleComponent(GangAutoInfo[h][cID],GangAutoInfo[h][cTuning][3]); }
if(GangAutoInfo[h][cTuning][4] != 0) { AddVehicleComponent(GangAutoInfo[h][cID],GangAutoInfo[h][cTuning][4]); }
if(GangAutoInfo[h][cTuning][5] != 0) { AddVehicleComponent(GangAutoInfo[h][cID],GangAutoInfo[h][cTuning][5]); }
if(GangAutoInfo[h][cTuning][6] != 0) { AddVehicleComponent(GangAutoInfo[h][cID],GangAutoInfo[h][cTuning][6]); }
if(GangAutoInfo[h][cTuning][7] != 0) { AddVehicleComponent(GangAutoInfo[h][cID],GangAutoInfo[h][cTuning][7]); }
if(GangAutoInfo[h][cTuning][8] != 0) { AddVehicleComponent(GangAutoInfo[h][cID],GangAutoInfo[h][cTuning][8]); }
if(GangAutoInfo[h][cTuning][9] != 0) { AddVehicleComponent(GangAutoInfo[h][cID],GangAutoInfo[h][cTuning][9]); }
if(GangAutoInfo[h][cTuning][10] != 0) { AddVehicleComponent(GangAutoInfo[h][cID],GangAutoInfo[h][cTuning][10]); }
if(GangAutoInfo[h][cTuning][11] != 0) { AddVehicleComponent(GangAutoInfo[h][cID],GangAutoInfo[h][cTuning][11]); }
if(GangAutoInfo[h][cTuning][12] != 0) { AddVehicleComponent(GangAutoInfo[h][cID],GangAutoInfo[h][cTuning][12]); }
if(GangAutoInfo[h][cTuning][13] != 0) { AddVehicleComponent(GangAutoInfo[h][cID],GangAutoInfo[h][cTuning][13]); }
printf("Gangcar Tune ausgeführt.");
}
return 1;
}
public CreateGangAutos()
{
for(new h = 0; h < sizeof(GangAutoInfo); h++){
if(GangAutoInfo[h][cTyp] != -1){
if(GangAutoInfo[h][cStatus] == 0){
GangAutoInfo[h][cID] = CreateVehicle(GangAutoInfo[h][cTyp],GangAutoInfo[h][cPosX],GangAutoInfo[h][cPosY],GangAutoInfo[h][cPosZ],GangAutoInfo[h][cRot],GangAutoInfo[h][cColor1],GangAutoInfo[h][cColor2],GangAutoInfo[h][cReSpawnTime]);
Gas[GangAutoInfo[h][cID]] = GangAutoInfo[h][cTank];
SetTimer("GangCarTune", 3000, false);
new string[255];
format(string, sizeof(string), "{FFFF00}GLS-{21DD00}%d", GangAutoInfo[h][cID]);
SetVehicleNumberPlate(GangAutoInfo[h][cID],string);
}
}
}
return 1;
}
Bitte um Hilfe, da ich langsam verzweifel
Edit: @Jeffry:
Gruß
Crowley