Die Autos bleiben nicht getunt wieso?

Wichtiger Hinweis: Bitte ändert nicht manuell die Schriftfarbe auf schwarz sondern belasst es bei der Standardeinstellung. Somit tragt ihr dazu bei dass euer Text auch bei Verwendung unseren dunklen Forenstils noch lesbar ist!

Tipp: Ihr wollt längere Codeausschnitte oder Logfiles bereitstellen? Benutzt unseren eigenen PasteBin-Dienst Link
  • Hallo
    Nach dem Tunen von seinen eingenden Autos die man gekauft hat bleiben die nicht gespeichert wieso?
    Function OnPlayerCarLogin(playerid)
    {
    for(new x = 0; x < MaxVeh; x++)
    {
    if(!Dtc_PlayerHaveCar[playerid][x])
    {
    new string2[128];
    new playername2[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername2, sizeof(playername2));
    format(string2, sizeof(string2), "/Autos/%s%d.dtcar", playername2,x);
    new File: UserFile = fopen(string2, io_read);
    if (UserFile)
    {
    Dtc_PlayerHaveCar[playerid][x] = 1;
    new key[ 256 ] , val[ 256 ];
    new Data[ 256 ];
    while ( fread( UserFile , Data , sizeof( Data ) ) )
    {
    key = ini_GetKey( Data );
    if( strcmp( key , "CarId" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarId] = strval( val ); }
    if( strcmp( key , "CarModel" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarModel] = strval( val ); }
    if( strcmp( key , "CarPos_x" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarPos_x] = floatstr( val ); }
    if( strcmp( key , "CarPos_y" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarPos_y] = floatstr( val ); }
    if( strcmp( key , "CarPos_z" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarPos_z] = floatstr( val ); }
    if( strcmp( key , "CarRotate" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarRotate] = floatstr( val ); }
    if( strcmp( key , "CarNitro" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarNitro] = strval( val ); }
    if( strcmp( key , "CarHyd" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarHyd] = strval( val ); }
    if( strcmp( key , "CarWheel" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarWheel] = strval( val ); }
    if( strcmp( key , "CarAusp" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarAusp] = strval( val ); }
    if( strcmp( key , "CarSideL" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarSideL] = strval( val ); }
    if( strcmp( key , "CarSideR" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarSideR] = strval( val ); }
    if( strcmp( key , "CarFB" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarFB] = strval( val ); }
    if( strcmp( key , "CarRB" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarRB] = strval( val ); }
    if( strcmp( key , "CarSpoiler" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarSpoiler] = strval( val ); }
    if( strcmp( key , "CarRoof" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarRoof] = strval( val ); }
    if( strcmp( key , "CarHood" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarHood] = strval( val ); }
    if( strcmp( key , "CarVents" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarVents] = strval( val ); }
    if( strcmp( key , "CarLamps" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarLamps] = strval( val ); }
    if( strcmp( key , "CarPJ" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarPJ] = strval( val ); }
    if( strcmp( key , "CarC1" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarC1] = strval( val ); }
    if( strcmp( key , "CarC2" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarC2] = strval( val ); }
    if( strcmp( key , "Preis" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarPreis] = strval( val ); }
    if( strcmp( key , "Plate" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][Plate] = strval( val ); }
    }
    fclose(UserFile);
    PlayerCarSpawn(playerid,x);
    }
    }
    }
    }


    Function PlayerCarSpawn(playerid,Slot)
    {
    if(IsPlayerConnected(playerid))
    {
    if(Dtc_PlayerHaveCar[playerid][Slot])
    {
    PlayerCar[playerid][Slot][CarId] = CreateVehicle(PlayerCar[playerid][Slot][CarModel],PlayerCar[playerid][Slot][CarPos_x],PlayerCar[playerid][Slot][CarPos_y],PlayerCar[playerid][Slot][CarPos_z],PlayerCar[playerid][Slot][CarRotate],PlayerCar[playerid][Slot][CarC1],PlayerCar[playerid][Slot][CarC2], 60000);/*vehicle spawn*/
    ChangeVehicleColor(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarC1],PlayerCar[playerid][Slot][CarC2]);
    if(PlayerCar[playerid][Slot][CarPJ] >= 0) {ChangeVehiclePaintjob(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarPJ]);}
    if(PlayerCar[playerid][Slot][CarNitro] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarNitro]);}
    if(PlayerCar[playerid][Slot][CarHyd] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarHyd]);}
    if(PlayerCar[playerid][Slot][CarWheel] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarWheel]);}
    if(PlayerCar[playerid][Slot][CarAusp] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarAusp]);}
    if(PlayerCar[playerid][Slot][CarSideL] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarSideL]);}
    if(PlayerCar[playerid][Slot][CarSideR] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarSideR]);}
    if(PlayerCar[playerid][Slot][CarFB] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarFB]);}
    if(PlayerCar[playerid][Slot][CarRB] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarRB]);}
    if(PlayerCar[playerid][Slot][CarSpoiler] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarSpoiler]);}
    if(PlayerCar[playerid][Slot][CarRoof] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarRoof]);}
    if(PlayerCar[playerid][Slot][CarHood] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarHood]);}
    if(PlayerCar[playerid][Slot][CarVents] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarVents]);}
    if(PlayerCar[playerid][Slot][CarLamps] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarLamps]);}
    if(Dtc_LockOnSpawn)
    {
    Dtc_Carlock[PlayerCar[playerid][Slot][CarId]] = 1;
    Dtc_LockCar(PlayerCar[playerid][Slot][CarId]);
    }
    new strings[15];
    new name[MAX_PLAYER_NAME], str[128];
    GetPlayerName(playerid, name, sizeof name);
    format(str, sizeof str, "/Autos/%s%d.dtcar", name,Dtc_PlayerKey[playerid]);
    format(strings, sizeof(strings), "%s", dini_Get(str, "Plate"));
    SetVehicleNumberPlate(PlayerCar[playerid][Slot][CarId], strings);
    SetVehicleToRespawn(PlayerCar[playerid][Slot][CarId]);
    Gas[PlayerCar[playerid][Slot][CarId]] = GetGasMax(GetVehicleModel(PlayerCar[playerid][Slot][CarId]));
    for(new x = 0; x < MaxVeh; x++)
    {
    PlayerCar[playerid][x][Plate] = strings;
    }
    }
    }
    }
    Function 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;
    }
    Function OnPlayerCarUpdate(playerid)
    {
    if(IsPlayerConnected(playerid))
    {
    for(new x = 0; x < MaxVeh; x++)
    {
    if(Dtc_PlayerHaveCar[playerid][x])
    {
    DestroyVehicle(PlayerCar[playerid][x][CarId]);
    Dtc_Carlock[PlayerCar[playerid][x][CarId]] = 0;
    Dtc_LockCar(PlayerCar[playerid][x][CarId]);
    new string3[128];
    new playername3[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername3, sizeof(playername3));
    format(string3, sizeof(string3), "/Autos/%s%d.dtcar", playername3,x);
    new File: hFile = fopen(string3, io_write);
    if (hFile)
    {
    new var[32];
    format(var, 32, "CarId=%d\n",PlayerCar[playerid][x][CarId]);fwrite(hFile, var);
    format(var, 32, "CarModel=%d\n",PlayerCar[playerid][x][CarModel]);fwrite(hFile, var);
    format(var, 32, "CarPos_x=%.3f\n",PlayerCar[playerid][x][CarPos_x]);fwrite(hFile, var);
    format(var, 32, "CarPos_y=%.3f\n",PlayerCar[playerid][x][CarPos_y]);fwrite(hFile, var);
    format(var, 32, "CarPos_z=%.3f\n",PlayerCar[playerid][x][CarPos_z]);fwrite(hFile, var);
    format(var, 32, "CarRotate=%.3f\n",PlayerCar[playerid][x][CarRotate]);fwrite(hFile, var);
    format(var, 32, "CarNitro=%d\n",PlayerCar[playerid][x][CarNitro]);fwrite(hFile, var);
    format(var, 32, "CarHyd=%d\n",PlayerCar[playerid][x][CarHyd]);fwrite(hFile, var);
    format(var, 32, "CarWheel=%d\n",PlayerCar[playerid][x][CarWheel]);fwrite(hFile, var);
    format(var, 32, "CarAusp=%d\n",PlayerCar[playerid][x][CarAusp]);fwrite(hFile, var);
    format(var, 32, "CarSideL=%d\n",PlayerCar[playerid][x][CarSideL]);fwrite(hFile, var);
    format(var, 32, "CarSideR=%d\n",PlayerCar[playerid][x][CarSideR]);fwrite(hFile, var);
    format(var, 32, "CarFB=%d\n",PlayerCar[playerid][x][CarFB]);fwrite(hFile, var);
    format(var, 32, "CarRB=%d\n",PlayerCar[playerid][x][CarRB]);fwrite(hFile, var);
    format(var, 32, "CarSpoiler=%d\n",PlayerCar[playerid][x][CarSpoiler]);fwrite(hFile, var);
    format(var, 32, "CarRoof=%d\n",PlayerCar[playerid][x][CarRoof]);fwrite(hFile, var);
    format(var, 32, "CarHood=%d\n",PlayerCar[playerid][x][CarHood]);fwrite(hFile, var);
    format(var, 32, "CarVents=%d\n",PlayerCar[playerid][x][CarVents]);fwrite(hFile, var);
    format(var, 32, "CarLamps=%d\n",PlayerCar[playerid][x][CarLamps]);fwrite(hFile, var);
    format(var, 32, "CarPJ=%d\n",PlayerCar[playerid][x][CarPJ]);fwrite(hFile, var);
    format(var, 32, "CarC1=%d\n",PlayerCar[playerid][x][CarC1]);fwrite(hFile, var);
    format(var, 32, "CarC2=%d\n",PlayerCar[playerid][x][CarC2]);fwrite(hFile, var);
    format(var, 32, "Plate=%s\n",PlayerCar[playerid][x][Plate]);fwrite(hFile, var);
    fclose(hFile);
    }
    }
    }
    }
    }


    Function Dtc_LockCar(carid)
    {
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    SetVehicleParamsForPlayer(carid,i,0,1);
    }
    }
    }


    Function Dtc_UnLockCar(carid)
    {
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    SetVehicleParamsForPlayer(carid,i,0,0);
    }
    }
    }


    Function IsADtCar(car) //!CallRemoteFunction("IsADtCar","i",c)
    {
    for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
    {
    for(new x = 0; x < MaxVeh; x++)
    {
    if(IsPlayerConnected(playerid) && Dtc_PlayerHaveCar[playerid][x])
    {
    if (car == PlayerCar[playerid][x][CarId])
    {
    return 1;
    }
    }
    }
    }
    return 0;
    }
    Function IsASideR(componentid)
    {
    if(componentid == 1007)
    {
    SideL = 1017;
    return 1;
    }
    if(componentid == 1026)
    {
    SideL = 1027;
    return 1;
    }
    if(componentid == 1030)
    {
    SideL = 1031;
    return 1;
    }
    if(componentid == 1040)
    {
    SideL = 1036;
    return 1;
    }
    if(componentid == 1041)
    {
    SideL = 1039;
    return 1;
    }
    if(componentid == 1042)
    {
    SideL = 1099;
    return 1;
    }
    if(componentid == 1051)
    {
    SideL = 1047;
    return 1;
    }
    if(componentid == 1048)
    {
    SideL = 1052;
    return 1;
    }
    if(componentid == 1056)
    {
    SideL = 1062;
    return 1;
    }
    if(componentid == 1063)
    {
    SideL = 1057;
    return 1;
    }
    if(componentid == 1069)
    {
    SideL = 1071;
    return 1;
    }
    if(componentid == 1072)
    {
    SideL = 1070;
    return 1;
    }
    if(componentid == 1094)
    {
    SideL = 1090;
    return 1;
    }
    if(componentid == 1093)
    {
    SideL = 1095;
    return 1;
    }
    if(componentid == 1122)
    {
    SideL = 1101;
    return 1;
    }
    if(componentid == 1102)
    {
    SideL = 1133;
    return 1;
    }
    if(componentid == 1124)
    {
    SideL = 1106;
    return 1;
    }
    if(componentid == 1107)
    {
    SideL = 1108;
    return 1;
    }
    if(componentid == 1118)
    {
    SideL = 1120;
    return 1;
    }
    if(componentid == 1137)
    {
    SideL = 1134;
    return 1;
    }
    return 0;
    }


    Function IsASideL(componentid)
    {
    if(componentid == 1134)
    {
    SideR = 1137;
    return 1;
    }
    if(componentid == 1119)
    {
    SideR = 1121;
    return 1;
    }
    if(componentid == 1120)
    {
    SideR = 1118;
    return 1;
    }
    if(componentid == 1108)
    {
    SideR = 1107;
    return 1;
    }
    if(componentid == 1017)
    {
    SideR = 1007;
    return 1;
    }
    if(componentid == 1027)
    {
    SideR = 1026;
    return 1;
    }
    if(componentid == 1031)
    {
    SideR = 1030;
    return 1;
    }
    if(componentid == 1036)
    {
    SideR = 1040;
    return 1;
    }
    if(componentid == 1039)
    {
    SideR = 1041;
    return 1;
    }
    if(componentid == 1099)
    {
    SideR = 1042;
    return 1;
    }
    if(componentid == 1047)
    {
    SideR = 1051;
    return 1;
    }
    if(componentid == 1052)
    {
    SideR = 1048;
    return 1;
    }
    if(componentid == 1062)
    {
    SideR = 1056;
    return 1;
    }
    if(componentid == 1057)
    {
    SideR = 1063;
    return 1;
    }
    if(componentid == 1071)
    {
    SideR = 1069;
    return 1;
    }
    if(componentid == 1070)
    {
    SideR = 1072;
    return 1;
    }
    if(componentid == 1090)
    {
    SideR = 1094;
    return 1;
    }
    if(componentid == 1095)
    {
    SideR = 1093;
    return 1;
    }
    if(componentid == 1095)
    {
    SideR = 1093;
    return 1;
    }
    if(componentid == 1101)
    {
    SideR = 1122;
    return 1;
    }
    if(componentid == 1133)
    {
    SideR = 1102;
    return 1;
    }
    if(componentid == 1106)
    {
    SideR = 1124;
    return 1;
    }
    return 0;
    }


    Function IsAFB(componentid)
    {
    if(componentid >= 1152 && componentid <= 1153 || componentid >= 1165 && componentid <= 1166)
    {
    return 1;
    }
    if(componentid == 1155 || componentid == 1157 || componentid == 1160 || componentid == 1176 || componentid == 1179 || componentid == 1185)
    {
    return 1;
    }
    if(componentid >= 1169 && componentid <= 1174 || componentid >= 1181 && componentid <= 1182)
    {
    return 1;
    }
    if(componentid >= 1188 && componentid <= 1191)
    {
    return 1;
    }
    return 0;
    }


    Function IsARB(componentid)
    {
    if(componentid >= 1140 && componentid <= 1141 || componentid >= 1148 && componentid <= 1151)
    {
    return 1;
    }
    if(componentid == 1154 || componentid == 1156 || componentid == 1159 || componentid == 1161 || componentid == 1175 || componentid == 1180)
    {
    return 1;
    }
    if(componentid >= 1167 && componentid <= 1168 || componentid >= 1177 && componentid <= 1178)
    {
    return 1;
    }
    if(componentid >= 1183 && componentid <= 1184 || componentid >= 1186 && componentid <= 1187)
    {
    return 1;
    }
    if(componentid >= 1192 && componentid <= 1193)
    {
    return 1;
    }
    return 0;
    }


    Function IsASpoiler(componentid)
    {
    if(componentid >= 1000 && componentid <= 1003 || componentid >= 1014 && componentid <= 1016)
    {
    return 1;
    }
    if(componentid == 1023 || componentid == 1058 || componentid == 1158)
    {
    return 1;
    }
    if(componentid >= 1049 && componentid <= 1050 || componentid >= 1138 && componentid <= 1139)
    {
    return 1;
    }
    if(componentid >= 1146 && componentid <= 1147 || componentid >= 1162 && componentid <= 1164)
    {
    return 1;
    }
    return 0;
    }


    Function IsARoof(componentid)
    {
    if(componentid >= 1032 && componentid <= 1033 || componentid >= 1053 && componentid <= 1055)
    {
    return 1;
    }
    if(componentid == 1035 || componentid == 1038 || componentid == 1061 || componentid == 1088 || componentid == 1091)
    {
    return 1;
    }
    if(componentid == 1103 || componentid == 1128)
    {
    return 1;
    }
    if(componentid >= 1067 && componentid <= 1068 || componentid >= 1130 && componentid <= 1131)
    {
    return 1;
    }
    return 0;
    }Ich habe da nix gefunden