Guten Tag.
Wen ich bei einem Fraltions car 1 Tuning teil drauf mache verschwindet es sofort
Function OnVehicleMod(playerid,vehicleid,componentid)
{
FRAC_OnVehicleMod(playerid, vehicleid, componentid);
for(new x = 0; x < MaxVeh; x++)
{
if (vehicleid == PlayerCar[playerid][x][CarId] && Dtc_PlayerHaveCar[playerid][x])
{
if((componentid >= 1008) && (componentid <= 1010)) {PlayerCar[playerid][x][CarNitro] = componentid;}
if((componentid >= 1142) && (componentid <= 1145)) {PlayerCar[playerid][x][CarVents] = componentid;}
if((componentid == 1013) || (componentid == 1024)) {PlayerCar[playerid][x][CarLamps] = componentid;}
if((componentid >= 1004) && (componentid <= 1005)||(componentid >= 1011) && (componentid <= 1012)) {PlayerCar[playerid][x][CarHood] = componentid;}
if(componentid == 1087) {PlayerCar[playerid][x][CarHyd] = componentid;}
if(componentid == 1086) {PlayerCar[playerid][x][CarHyd] = componentid;}
if(IsAWheel(componentid)) {PlayerCar[playerid][x][CarWheel] = componentid;}
if(IsAExhaust(componentid)) {PlayerCar[playerid][x][CarAusp] = componentid;}
if(IsASideL(componentid)) {PlayerCar[playerid][x][CarSideL] = componentid; PlayerCar[playerid][x][CarSideR] = SideR;}
if(IsASideR(componentid)) {PlayerCar[playerid][x][CarSideR] = componentid; PlayerCar[playerid][x][CarSideL] = SideL;}
if(IsAFB(componentid)) {PlayerCar[playerid][x][CarFB] = componentid;}
if(IsARB(componentid)) {PlayerCar[playerid][x][CarRB] = componentid;}
if(IsASpoiler(componentid)) {PlayerCar[playerid][x][CarSpoiler] = componentid;}
if(IsARoof(componentid)) {PlayerCar[playerid][x][CarRoof] = componentid;}
}
}
return 1;
}
}
public LoadFactionCars(){
if(!fexist(FACTION_CAR_FILE)){
new File:tfFile=fopen(FACTION_CAR_FILE,io_write);
fclose(tfFile);
}
new File:fFile=fopen(FACTION_CAR_FILE,io_read),Content[1024],fc;
while(fread(fFile,Content) && fc<sizeof(FactionCars)){
sscanf(Content,"dffffdddddddddddddddddddddd",
FactionCars[fc][fVehid],
FactionCars[fc][fPos][0],
FactionCars[fc][fPos][1],
FactionCars[fc][fPos][2],
FactionCars[fc][fPos][3],
FactionCars[fc][fCol][0],
FactionCars[fc][fCol][1],
FactionCars[fc][fFaction][0],
FactionCars[fc][fFaction][1],
FactionCars[fc][fFaction][2],
FactionCars[fc][fFaction][3],
FactionCars[fc][fFaction][4],
FactionCars[fc][fTuning][0],
FactionCars[fc][fTuning][1],
FactionCars[fc][fTuning][2],
FactionCars[fc][fTuning][3],
FactionCars[fc][fTuning][4],
FactionCars[fc][fTuning][5],
FactionCars[fc][fTuning][6],
FactionCars[fc][fTuning][7],
FactionCars[fc][fTuning][8],
FactionCars[fc][fTuning][9],
FactionCars[fc][fTuning][10],
FactionCars[fc][fTuning][11],
FactionCars[fc][fTuning][12],
FactionCars[fc][fTuning][13],
FactionCars[fc][fPrice]);
if(FactionCars[fc][fVehid] >= 400 && FactionCars[fc][fVehid] <= 611){
FactionCars[fc][fCarid] = CreateVehicle(FactionCars[fc][fVehid],FactionCars[fc][fPos][0],FactionCars[fc][fPos][1],FactionCars[fc][fPos][2],FactionCars[fc][fPos][3],FactionCars[fc][fCol][0],FactionCars[fc][fCol][1],-255);
switch(FactionCars[fc][fFaction][0])
{
case 1: SetVehicleNumberPlate(FactionCars[fc][fCarid], "SAPD");
case 2: SetVehicleNumberPlate(FactionCars[fc][fCarid], "FBI");
case 3: SetVehicleNumberPlate(FactionCars[fc][fCarid], "ARMY");
case 4: SetVehicleNumberPlate(FactionCars[fc][fCarid], "ARZT");
case 5: SetVehicleNumberPlate(FactionCars[fc][fCarid], "LCN");
case 6: SetVehicleNumberPlate(FactionCars[fc][fCarid], "YAKUZA");
case 7: SetVehicleNumberPlate(FactionCars[fc][fCarid], "PRÄSIDENT");
case 8: SetVehicleNumberPlate(FactionCars[fc][fCarid], "HITMAN");
case 9: SetVehicleNumberPlate(FactionCars[fc][fCarid], "SAN NEWS");
case 10: SetVehicleNumberPlate(FactionCars[fc][fCarid], "TAXI");
case 11: SetVehicleNumberPlate(FactionCars[fc][fCarid], "FAHRLEHRER");
case 12: SetVehicleNumberPlate(FactionCars[fc][fCarid], "HACKER");
case 13: SetVehicleNumberPlate(FactionCars[fc][fCarid], "Crips");
case 14: SetVehicleNumberPlate(FactionCars[fc][fCarid], "GROVE");
case 15: SetVehicleNumberPlate(FactionCars[fc][fCarid], "LS BIKER");
case 16: SetVehicleNumberPlate(FactionCars[fc][fCarid], "LS VAGOS");
case 17: SetVehicleNumberPlate(FactionCars[fc][fCarid], "AZTECAS");
case 18: SetVehicleNumberPlate(FactionCars[fc][fCarid], "LOCOS");
case 19: SetVehicleNumberPlate(FactionCars[fc][fCarid], "TEXANER");
case 20: SetVehicleNumberPlate(FactionCars[fc][fCarid], "TERROR");
case 21: SetVehicleNumberPlate(FactionCars[fc][fCarid], "WHEELMEN");
case 22: SetVehicleNumberPlate(FactionCars[fc][fCarid], "SWAT");
case 23: SetVehicleNumberPlate(FactionCars[fc][fCarid], "RUSSEN");
case 24: SetVehicleNumberPlate(FactionCars[fc][fCarid], "O-AMT");
}
SetVehicleToRespawn(FactionCars[fc][fCarid]);
printf("Fahrzeug %d (Idx: %d) steht: %f / %f / %f", FactionCars[fc][fCarid], fc, FactionCars[fc][fPos][0],FactionCars[fc][fPos][1],FactionCars[fc][fPos][2]);
SetVehicleToRespawn(FactionCars[fc][fCarid]);
printf("%d gehört zu: %d", FactionCars[fc][fCarid], FactionCars[fc][fFaction][0]);
SetVehicleToRespawn(FactionCars[fc][fCarid]);
#if defined FACTION_CARS_LOCKABLE
fLockCar(FactionCars[fc][fCarid]);
FactionCars[fc][fLock] = true;
#endif
#if defined FACTION_CARS_TUNEABLE
if(IsAllowedFactionToTune(FactionCars[fc][fFaction][0])){
if(FactionCars[fc][fTuning][0] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][0]); }
if(FactionCars[fc][fTuning][1] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][1]); }
if(FactionCars[fc][fTuning][2] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][2]); }
if(FactionCars[fc][fTuning][3] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][3]); }
if(FactionCars[fc][fTuning][4] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][4]); }
if(FactionCars[fc][fTuning][5] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][5]); }
if(FactionCars[fc][fTuning][6] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][6]); }
if(FactionCars[fc][fTuning][7] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][7]); }
if(FactionCars[fc][fTuning][8] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][8]); }
if(FactionCars[fc][fTuning][9] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][9]); }
if(FactionCars[fc][fTuning][10] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][10]); }
if(FactionCars[fc][fTuning][11] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][11]); }
if(FactionCars[fc][fTuning][12] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][12]); }
if(FactionCars[fc][fTuning][13] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][13]); }
}
#endif
fc++;
}
}fclose(fFile);
return printf(" '%d' Fraktionsfahrzeuge wurden geladen & erstellt.",fc);
}public SaveFactionCars(bool:destroy)
{
printf("SaveFactionCars aufgerufen.");
if(fexist(FACTION_CAR_FILE)) fremove(FACTION_CAR_FILE);
new File:fFile=fopen(FACTION_CAR_FILE,io_append),Content[1024];
for(new fc;fc<sizeof(FactionCars);fc++)
{
printf("fc: %d | fVehid: %d", fc, FactionCars[fc][fVehid]);
if(FactionCars[fc][fVehid] >= 400 && FactionCars[fc][fVehid] <= 611)
{
for(new i=0; i<13; i++) FactionCars[fc][fTuning][i] = GetVehicleComponentInSlot(FactionCars[fc][fCarid], i);
format(Content,sizeof(Content),"%d %.3f %.3f %.3f %.3f %03d %03d %02d %02d %02d %02d %02d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d\r\n",
FactionCars[fc][fVehid],
FactionCars[fc][fPos][0],
FactionCars[fc][fPos][1],
FactionCars[fc][fPos][2],
FactionCars[fc][fPos][3],
FactionCars[fc][fCol][0],
FactionCars[fc][fCol][1],
FactionCars[fc][fFaction][0],
FactionCars[fc][fFaction][1],
FactionCars[fc][fFaction][2],
FactionCars[fc][fFaction][3],
FactionCars[fc][fFaction][4],
FactionCars[fc][fTuning][0],
FactionCars[fc][fTuning][1],
FactionCars[fc][fTuning][2],
FactionCars[fc][fTuning][3],
FactionCars[fc][fTuning][4],
FactionCars[fc][fTuning][5],
FactionCars[fc][fTuning][6],
FactionCars[fc][fTuning][7],
FactionCars[fc][fTuning][8],
FactionCars[fc][fTuning][9],
FactionCars[fc][fTuning][10],
FactionCars[fc][fTuning][11],
FactionCars[fc][fTuning][12],
FactionCars[fc][fTuning][13],
FactionCars[fc][fPrice]);
printf("Content: %s", Content);
fwrite(fFile,Content);
if(destroy == true)
{
if(DestroyVehicle(FactionCars[fc][fCarid]))
FactionCars[fc][fCarid] = -255;
}
}
}
printf("Ende.");
fclose(fFile);
return true;
}