Autohaus system funktioniert nicht so wie es soll

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
  • hey leute mein autohaus system funktioniert nicht so ganz wie es soll, wenn man es ingame erstellt und autos hinzufügt kann man es nicht kaufen, wenn man kaufen drückt passiert nichts... obwohl man dann das auto gespawnt bekommt und ihm zugewiesen wird


    hier mal der dialog :



    if(dialogid == DIALOG_CDC_BUY)
    {
    if(response)
    {
    new PlayerCDC = 0, Float:SpawnPos[4];
    for(new c=0;c < sizeof(CarDealerCarInfo);c++)
    {
    if(GetPlayerVehicleID(playerid) == CarDealerCarInfo[c][cdcCar] && CarDealerCarInfo[c][cdcSpawned] == 1)
    {
    PlayerCDC = c;
    break;
    }
    }
    for(new i=0;i < sizeof(CarDealerInfo);i++)
    {
    if(CarDealerCarInfo[PlayerCDC][cdcCarDealerID] == CarDealerInfo[i][cdID])
    {
    new rand = random(2);
    if(rand == 0)
    {
    SpawnPos[0] = CarDealerInfo[i][cdPark1][0];
    SpawnPos[1] = CarDealerInfo[i][cdPark1][1];
    SpawnPos[2] = CarDealerInfo[i][cdPark1][2];
    SpawnPos[3] = CarDealerInfo[i][cdPark1][3];
    }
    else if(rand == 0)
    {
    SpawnPos[0] = CarDealerInfo[i][cdPark2][0];
    SpawnPos[1] = CarDealerInfo[i][cdPark2][1];
    SpawnPos[2] = CarDealerInfo[i][cdPark2][2];
    SpawnPos[3] = CarDealerInfo[i][cdPark2][3];
    }
    else
    {
    SpawnPos[0] = CarDealerInfo[i][cdPark3][0];
    SpawnPos[1] = CarDealerInfo[i][cdPark3][1];
    SpawnPos[2] = CarDealerInfo[i][cdPark3][2];
    SpawnPos[3] = CarDealerInfo[i][cdPark3][3];
    }
    break;
    }
    }
    new Anzahl = 0, UserName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, UserName, MAX_PLAYER_NAME);
    for(new i=0;i < sizeof(PlayerCarInfo);i++)
    {
    if(PlayerCarInfo[i][cID] != 0)
    {
    if(strcmp(PlayerCarInfo[i][cBesitzer],UserName,true)==0)
    Anzahl++;
    }
    }
    if(Anzahl >= MAX_PLAYER_CARS)
    {
    RemovePlayerFromVehicle(playerid);
    return SendClientMessage(playerid, COLOR_GREY, "Sie haben schon das Maximum an Fahrzeugen pro Spieler.");
    }
    if(SpawnPos[0] == 0 && SpawnPos[1] == 0 && SpawnPos[2] == 0) return 1;
    if(PlayerCDC == 0) return 1;
    if(GetPlayerMoney(playerid) >= CarDealerCarInfo[PlayerCDC][cdcPreis])
    {
    if(PlayerInfo[playerid][pLevel] >= CarDealerCarInfo[PlayerCDC][cdcLevel])
    {
    RemovePlayerFromVehicle(playerid);
    new color[2];
    color[0] = random(20); color[1] = random(20);
    for(new i=0;i < sizeof(PlayerCarInfo);i++)
    {
    if(PlayerCarInfo[i][cID] == 0)
    {
    GetPlayerName(playerid, UserName, MAX_PLAYER_NAME);
    format(PlayerCarInfo[i][cBesitzer], MAX_PLAYER_NAME+10, "%s", UserName);
    PlayerCarInfo[i][cAbgeschleppt][0] = 0;
    PlayerCarInfo[i][cAbgeschleppt][1] = 0;
    PlayerCarInfo[i][cAbgeschleppt][2] = 0;
    PlayerCarInfo[i][cAbgeschleppt][3] = 0;
    PlayerCarInfo[i][cPos][0] = SpawnPos[0];
    PlayerCarInfo[i][cPos][1] = SpawnPos[1];
    PlayerCarInfo[i][cPos][2] = SpawnPos[2];
    PlayerCarInfo[i][cPos][3] = SpawnPos[3];
    PlayerCarInfo[i][cPreis] = CarDealerCarInfo[PlayerCDC][cdcPreis];
    PlayerCarInfo[i][cModel] = CarDealerCarInfo[PlayerCDC][cdcModel];
    PlayerCarInfo[i][cColor][0] = color[0];
    PlayerCarInfo[i][cColor][1] = color[1];
    PlayerCarInfo[i][cHealth] = 1000;
    PlayerCarInfo[i][cDmg][0] = 0;
    PlayerCarInfo[i][cDmg][1] = 0;
    PlayerCarInfo[i][cDmg][2] = 0;
    PlayerCarInfo[i][cDmg][3] = 0;
    PlayerCarInfo[i][cLocked] = 0;
    PlayerCarInfo[i][cComponent][0] = 0;
    PlayerCarInfo[i][cComponent][1] = 0;
    PlayerCarInfo[i][cComponent][2] = 0;
    PlayerCarInfo[i][cComponent][3] = 0;
    PlayerCarInfo[i][cComponent][4] = 0;
    PlayerCarInfo[i][cComponent][5] = 0;
    PlayerCarInfo[i][cComponent][6] = 0;
    PlayerCarInfo[i][cComponent][7] = 0;
    PlayerCarInfo[i][cComponent][8] = 0;
    PlayerCarInfo[i][cComponent][9] = 0;
    PlayerCarInfo[i][cComponent][10] = 0;
    PlayerCarInfo[i][cComponent][11] = 0;
    PlayerCarInfo[i][cComponent][12] = 0;
    PlayerCarInfo[i][cComponent][13] = 0;
    PlayerCarInfo[i][cPaintJob] = 0;
    format(PlayerCarInfo[i][cKennzeichen], 30, "%s", UserName);
    new Cache:result = mysql_query(MySQL, "SELECT `id` FROM `usercar` WHERE 1 ORDER BY `id` DESC LIMIT 1");
    PlayerCarInfo[i][cID] = cache_get_row_int(1,1);
    PlayerCarInfo[i][cID]++;
    cache_delete(result);
    new ORM:ormid = PlayerCarInfo[i][ORM_ID] = orm_create("usercar");
    orm_addvar_int(ormid, PlayerCarInfo[i][cID], "id");
    orm_addvar_string(ormid, PlayerCarInfo[i][cBesitzer], 129, "Besitzer");
    orm_addvar_float(ormid, PlayerCarInfo[i][cAbgeschleppt][0], "AbgeschlepptX");
    orm_addvar_float(ormid, PlayerCarInfo[i][cAbgeschleppt][1], "AbgeschlepptY");
    orm_addvar_float(ormid, PlayerCarInfo[i][cAbgeschleppt][2], "AbgeschlepptZ");
    orm_addvar_float(ormid, PlayerCarInfo[i][cAbgeschleppt][3], "AbgeschlepptR");
    orm_addvar_float(ormid, PlayerCarInfo[i][cPos][0], "PosX");
    orm_addvar_float(ormid, PlayerCarInfo[i][cPos][1], "PosY");
    orm_addvar_float(ormid, PlayerCarInfo[i][cPos][2], "PosZ");
    orm_addvar_float(ormid, PlayerCarInfo[i][cPos][3], "PosR");
    orm_addvar_int(ormid, PlayerCarInfo[i][cPreis], "Preis");
    orm_addvar_int(ormid, PlayerCarInfo[i][cModel], "Model");
    orm_addvar_int(ormid, PlayerCarInfo[i][cColor][0], "Color1");
    orm_addvar_int(ormid, PlayerCarInfo[i][cColor][1], "Color2");
    orm_addvar_float(ormid, PlayerCarInfo[i][cHealth], "Health");
    orm_addvar_int(ormid, PlayerCarInfo[i][cDmg][0], "DmgPangels");
    orm_addvar_int(ormid, PlayerCarInfo[i][cDmg][1], "DmgDoors");
    orm_addvar_int(ormid, PlayerCarInfo[i][cDmg][2], "DmgLights");
    orm_addvar_int(ormid, PlayerCarInfo[i][cDmg][3], "DmgTires");
    orm_addvar_int(ormid, PlayerCarInfo[i][cLocked], "Locked");
    orm_addvar_int(ormid, PlayerCarInfo[i][cComponent][0], "Component00");
    orm_addvar_int(ormid, PlayerCarInfo[i][cComponent][1], "Component01");
    orm_addvar_int(ormid, PlayerCarInfo[i][cComponent][2], "Component02");
    orm_addvar_int(ormid, PlayerCarInfo[i][cComponent][3], "Component03");
    orm_addvar_int(ormid, PlayerCarInfo[i][cComponent][4], "Component04");
    orm_addvar_int(ormid, PlayerCarInfo[i][cComponent][5], "Component05");
    orm_addvar_int(ormid, PlayerCarInfo[i][cComponent][6], "Component06");
    orm_addvar_int(ormid, PlayerCarInfo[i][cComponent][7], "Component07");
    orm_addvar_int(ormid, PlayerCarInfo[i][cComponent][8], "Component08");
    orm_addvar_int(ormid, PlayerCarInfo[i][cComponent][9], "Component09");
    orm_addvar_int(ormid, PlayerCarInfo[i][cComponent][10], "Component10");
    orm_addvar_int(ormid, PlayerCarInfo[i][cComponent][11], "Component11");
    orm_addvar_int(ormid, PlayerCarInfo[i][cComponent][12], "Component12");
    orm_addvar_int(ormid, PlayerCarInfo[i][cComponent][13], "Component13");
    orm_addvar_int(ormid, PlayerCarInfo[i][cPaintJob], "PaintJob");
    orm_addvar_string(ormid, PlayerCarInfo[i][cKennzeichen], 129, "Kennzeichen");
    orm_setkey(ormid, "id");
    orm_insert(ormid);
    if(PlayerCarInfo[i][cID] != 0)
    {
    PlayerCarInfo[i][cVehicle] = CreateVehicle(PlayerCarInfo[i][cModel], 0, 0, 0, 0, PlayerCarInfo[i][cColor][0], PlayerCarInfo[i][cColor][1], -1);
    UpdateVehicleDamageStatus(PlayerCarInfo[i][cVehicle], PlayerCarInfo[i][cDmg][0], PlayerCarInfo[i][cDmg][1], PlayerCarInfo[i][cDmg][2], PlayerCarInfo[i][cDmg][3]);
    if(PlayerCarInfo[i][cComponent][0] != 0)
    AddVehicleComponent(PlayerCarInfo[i][cVehicle], PlayerCarInfo[i][cComponent][0]);
    if(PlayerCarInfo[i][cComponent][1] != 0)
    AddVehicleComponent(PlayerCarInfo[i][cVehicle], PlayerCarInfo[i][cComponent][1]);
    if(PlayerCarInfo[i][cComponent][2] != 0)
    AddVehicleComponent(PlayerCarInfo[i][cVehicle], PlayerCarInfo[i][cComponent][2]);
    if(PlayerCarInfo[i][cComponent][3] != 0)
    AddVehicleComponent(PlayerCarInfo[i][cVehicle], PlayerCarInfo[i][cComponent][3]);
    if(PlayerCarInfo[i][cComponent][4] != 0)
    AddVehicleComponent(PlayerCarInfo[i][cVehicle], PlayerCarInfo[i][cComponent][4]);
    if(PlayerCarInfo[i][cComponent][5] != 0)
    AddVehicleComponent(PlayerCarInfo[i][cVehicle], PlayerCarInfo[i][cComponent][5]);
    if(PlayerCarInfo[i][cComponent][6] != 0)
    AddVehicleComponent(PlayerCarInfo[i][cVehicle], PlayerCarInfo[i][cComponent][6]);
    if(PlayerCarInfo[i][cComponent][7] != 0)
    AddVehicleComponent(PlayerCarInfo[i][cVehicle], PlayerCarInfo[i][cComponent][7]);
    if(PlayerCarInfo[i][cComponent][8] != 0)
    AddVehicleComponent(PlayerCarInfo[i][cVehicle], PlayerCarInfo[i][cComponent][8]);
    if(PlayerCarInfo[i][cComponent][9] != 0)
    AddVehicleComponent(PlayerCarInfo[i][cVehicle], PlayerCarInfo[i][cComponent][9]);
    if(PlayerCarInfo[i][cComponent][10] != 0)
    AddVehicleComponent(PlayerCarInfo[i][cVehicle], PlayerCarInfo[i][cComponent][10]);
    if(PlayerCarInfo[i][cComponent][11] != 0)
    AddVehicleComponent(PlayerCarInfo[i][cVehicle], PlayerCarInfo[i][cComponent][11]);
    if(PlayerCarInfo[i][cComponent][12] != 0)
    AddVehicleComponent(PlayerCarInfo[i][cVehicle], PlayerCarInfo[i][cComponent][12]);
    if(PlayerCarInfo[i][cComponent][13] != 0)
    AddVehicleComponent(PlayerCarInfo[i][cVehicle], PlayerCarInfo[i][cComponent][13]);
    if(PlayerCarInfo[i][cPaintJob] != 0)
    ChangeVehiclePaintjob(PlayerCarInfo[i][cVehicle], PlayerCarInfo[i][cPaintJob]-1); // !!!! Paintjob ist immer +1, sonst fehler in DB!!!
    SetVehicleNumberPlate(PlayerCarInfo[i][cVehicle], PlayerCarInfo[i][cKennzeichen]);
    SetVehicleParamsEx(PlayerCarInfo[i][cVehicle], 0, 0, 0, 1, 0, 0, 0);
    PlayerCarInfo[i][cLocked] = 1;
    if(PlayerCarInfo[i][cAbgeschleppt][0] != 0 && PlayerCarInfo[i][cAbgeschleppt][1] != 0 && PlayerCarInfo[i][cAbgeschleppt][2] != 0 && PlayerCarInfo[i][cAbgeschleppt][3] != 0)
    {
    SetVehiclePos(PlayerCarInfo[i][cVehicle], PlayerCarInfo[i][cAbgeschleppt][0], PlayerCarInfo[i][cAbgeschleppt][1], PlayerCarInfo[i][cAbgeschleppt][2]);
    SetVehicleZAngle(PlayerCarInfo[i][cVehicle], PlayerCarInfo[i][cAbgeschleppt][3]);
    }
    else
    {
    SetVehiclePos(PlayerCarInfo[i][cVehicle], PlayerCarInfo[i][cPos][0], PlayerCarInfo[i][cPos][1], PlayerCarInfo[i][cPos][2]);
    SetVehicleZAngle(PlayerCarInfo[i][cVehicle], PlayerCarInfo[i][cPos][3]);
    }
    ShowPlayerDialog(playerid, 999999, DIALOG_STYLE_MSGBOX, "Fahrzeug gekauft", "Herzlichen Glückwunsch!\n\nSie haben erfolgreich ein Fahrzeug erworben.\n\nHilfe bekommen Sie unter /carhelp.", "Okay", "");
    PutPlayerInVehicle(playerid, PlayerCarInfo[i][cVehicle], 0);
    PlayerPlaySound(playerid,1054,0.0,0.0,0.0);
    GivePlayerMoney(playerid, -CarDealerCarInfo[PlayerCDC][cdcPreis]);
    break;
    }
    }
    }
    }
    else
    {
    SendClientMessage(playerid, COLOR_GREY, "Sie haben nicht genügend Level, um sich dieses Fahrzeug zu kaufen.");
    RemovePlayerFromVehicle(playerid);
    }
    }
    else
    {
    SendClientMessage(playerid, COLOR_GREY, "Sie haben nicht genügend Geld für dieses Fahrzeug.");
    RemovePlayerFromVehicle(playerid);
    }
    }
    else
    RemovePlayerFromVehicle(playerid);
    RemovePlayerFromVehicle(playerid);
    }

    3 Mal editiert, zuletzt von seegras () aus folgendem Grund: Richtigen PAWN-BBCode verwendet ;)

  • Was meinst du damit?Passiert doch etwas, wenn ja, was passiert alles und was passiert nicht?

    also man bleibt einfach im auto drinne , es kommt kein weiteres dialog mehr und man bleibt im auto sitzen, man sollte ja eigdl ein dialog bekommen wo drin steht du hast dies gekauft. und dann sollt man in dem fahrzeug gespawnt werden
    wenn du willst könnt ich dir die ip per pn zusenden, damit du mal selbst schauen kannst

  • Was wird dir so im Server Log ausgegeben?
    if(dialogid == DIALOG_CDC_BUY)
    {
    if(response)
    {
    printf("Dialog aufgerufen.");
    new PlayerCDC = 0, Float:SpawnPos[4];
    for(new c=0;c < sizeof(CarDealerCarInfo);c++)
    {
    if(GetPlayerVehicleID(playerid) == CarDealerCarInfo[c][cdcCar] && CarDealerCarInfo[c][cdcSpawned] == 1)
    {
    PlayerCDC = c;
    break;
    }
    }
    for(new i=0;i < sizeof(CarDealerInfo);i++)
    {
    if(CarDealerCarInfo[PlayerCDC][cdcCarDealerID] == CarDealerInfo[i][cdID])
    {
    new rand = random(2);
    if(rand == 0)
    {
    SpawnPos[0] = CarDealerInfo[i][cdPark1][0];
    SpawnPos[1] = CarDealerInfo[i][cdPark1][1];
    SpawnPos[2] = CarDealerInfo[i][cdPark1][2];
    SpawnPos[3] = CarDealerInfo[i][cdPark1][3];
    }
    else if(rand == 0)
    {
    SpawnPos[0] = CarDealerInfo[i][cdPark2][0];
    SpawnPos[1] = CarDealerInfo[i][cdPark2][1];
    SpawnPos[2] = CarDealerInfo[i][cdPark2][2];
    SpawnPos[3] = CarDealerInfo[i][cdPark2][3];
    }
    else
    {
    SpawnPos[0] = CarDealerInfo[i][cdPark3][0];
    SpawnPos[1] = CarDealerInfo[i][cdPark3][1];
    SpawnPos[2] = CarDealerInfo[i][cdPark3][2];
    SpawnPos[3] = CarDealerInfo[i][cdPark3][3];
    }
    break;
    }
    }
    printf("Nach SpawnPos");
    new Anzahl = 0, UserName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, UserName, MAX_PLAYER_NAME);
    for(new i=0;i < sizeof(PlayerCarInfo);i++)
    {
    if(PlayerCarInfo[i][cID] != 0)
    {
    if(strcmp(PlayerCarInfo[i][cBesitzer],UserName,true)==0)
    Anzahl++;
    }
    }
    printf("Anzahl: %d MAX_PLAYER_CARS: %d", Anzahl, MAX_PLAYER_CARS);
    if(Anzahl >= MAX_PLAYER_CARS)
    {
    RemovePlayerFromVehicle(playerid);
    return SendClientMessage(playerid, COLOR_GREY, "Sie haben schon das Maximum an Fahrzeugen pro Spieler.");
    }
    printf("Ok");
    if(SpawnPos[0] == 0 && SpawnPos[1] == 0 && SpawnPos[2] == 0) return 1;
    printf("Ok2");
    if(PlayerCDC == 0) return 1;
    printf("Vor Geld");
    if(GetPlayerMoney(playerid) >= CarDealerCarInfo[PlayerCDC][cdcPreis])
    {
    printf("Vor Level");
    if(PlayerInfo[playerid][pLevel] >= CarDealerCarInfo[PlayerCDC][cdcLevel])
    {
    printf("RemovePlayerFromVehicle");
    RemovePlayerFromVehicle(playerid);
    new color[2];
    color[0] = random(20); color[1] = random(20);
    for(new i=0;i < sizeof(PlayerCarInfo);i++)
    {
    printf("i: %d -> %d", i, PlayerCarInfo[i][cID]);
    if(PlayerCarInfo[i][cID] == 0)
    {
    printf("0");
    GetPlayerName(playerid, UserName, MAX_PLAYER_NAME);
    format(PlayerCarInfo[i][cBesitzer], MAX_PLAYER_NAME+10, "%s", UserName);
    PlayerCarInfo[i][cAbgeschleppt][0] = 0;
    PlayerCarInfo[i][cAbgeschleppt][1] = 0;
    PlayerCarInfo[i][cAbgeschleppt][2] = 0;
    PlayerCarInfo[i][cAbgeschleppt][3] = 0;
    PlayerCarInfo[i][cPos][0] = SpawnPos[0];
    PlayerCarInfo[i][cPos][1] = SpawnPos[1];
    PlayerCarInfo[i][cPos][2] = SpawnPos[2];
    PlayerCarInfo[i][cPos][3] = SpawnPos[3];
    PlayerCarInfo[i][cPreis] = CarDealerCarInfo[PlayerCDC][cdcPreis];
    PlayerCarInfo[i][cModel] = CarDealerCarInfo[PlayerCDC][cdcModel];
    PlayerCarInfo[i][cColor][0] = color[0];
    PlayerCarInfo[i][cColor][1] = color[1];
    PlayerCarInfo[i][cHealth] = 1000;
    PlayerCarInfo[i][cDmg][0] = 0;
    PlayerCarInfo[i][cDmg][1] = 0;
    PlayerCarInfo[i][cDmg][2] = 0;
    PlayerCarInfo[i][cDmg][3] = 0;
    PlayerCarInfo[i][cLocked] = 0;
    PlayerCarInfo[i][cComponent][0] = 0;
    PlayerCarInfo[i][cComponent][1] = 0;
    PlayerCarInfo[i][cComponent][2] = 0;
    PlayerCarInfo[i][cComponent][3] = 0;
    PlayerCarInfo[i][cComponent][4] = 0;
    PlayerCarInfo[i][cComponent][5] = 0;
    PlayerCarInfo[i][cComponent][6] = 0;
    PlayerCarInfo[i][cComponent][7] = 0;
    PlayerCarInfo[i][cComponent][8] = 0;
    PlayerCarInfo[i][cComponent][9] = 0;
    PlayerCarInfo[i][cComponent][10] = 0;
    PlayerCarInfo[i][cComponent][11] = 0;
    PlayerCarInfo[i][cComponent][12] = 0;
    PlayerCarInfo[i][cComponent][13] = 0;
    PlayerCarInfo[i][cPaintJob] = 0;
    format(PlayerCarInfo[i][cKennzeichen], 30, "%s", UserName);
    new Cache:result = mysql_query(MySQL, "SELECT `id` FROM `usercar` WHERE 1 ORDER BY `id` DESC LIMIT 1");
    PlayerCarInfo[i][cID] = cache_get_row_int(1,1);
    PlayerCarInfo[i][cID]++;
    cache_delete(result);
    new ORM:ormid = PlayerCarInfo[i][ORM_ID] = orm_create("usercar");
    orm_addvar_int(ormid, PlayerCarInfo[i][cID], "id");
    orm_addvar_string(ormid, PlayerCarInfo[i][cBesitzer], 129, "Besitzer");
    orm_addvar_float(ormid, PlayerCarInfo[i][cAbgeschleppt][0], "AbgeschlepptX");
    orm_addvar_float(ormid, PlayerCarInfo[i][cAbgeschleppt][1], "AbgeschlepptY");
    orm_addvar_float(ormid, PlayerCarInfo[i][cAbgeschleppt][2], "AbgeschlepptZ");
    orm_addvar_float(ormid, PlayerCarInfo[i][cAbgeschleppt][3], "AbgeschlepptR");
    orm_addvar_float(ormid, PlayerCarInfo[i][cPos][0], "PosX");
    orm_addvar_float(ormid, PlayerCarInfo[i][cPos][1], "PosY");
    orm_addvar_float(ormid, PlayerCarInfo[i][cPos][2], "PosZ");
    orm_addvar_float(ormid, PlayerCarInfo[i][cPos][3], "PosR");
    orm_addvar_int(ormid, PlayerCarInfo[i][cPreis], "Preis");
    orm_addvar_int(ormid, PlayerCarInfo[i][cModel], "Model");
    orm_addvar_int(ormid, PlayerCarInfo[i][cColor][0], "Color1");
    orm_addvar_int(ormid, PlayerCarInfo[i][cColor][1], "Color2");
    orm_addvar_float(ormid, PlayerCarInfo[i][cHealth], "Health");
    orm_addvar_int(ormid, PlayerCarInfo[i][cDmg][0], "DmgPangels");
    orm_addvar_int(ormid, PlayerCarInfo[i][cDmg][1], "DmgDoors");
    orm_addvar_int(ormid, PlayerCarInfo[i][cDmg][2], "DmgLights");
    orm_addvar_int(ormid, PlayerCarInfo[i][cDmg][3], "DmgTires");
    orm_addvar_int(ormid, PlayerCarInfo[i][cLocked], "Locked");
    orm_addvar_int(ormid, PlayerCarInfo[i][cComponent][0], "Component00");
    orm_addvar_int(ormid, PlayerCarInfo[i][cComponent][1], "Component01");
    orm_addvar_int(ormid, PlayerCarInfo[i][cComponent][2], "Component02");
    orm_addvar_int(ormid, PlayerCarInfo[i][cComponent][3], "Component03");
    orm_addvar_int(ormid, PlayerCarInfo[i][cComponent][4], "Component04");
    orm_addvar_int(ormid, PlayerCarInfo[i][cComponent][5], "Component05");
    orm_addvar_int(ormid, PlayerCarInfo[i][cComponent][6], "Component06");
    orm_addvar_int(ormid, PlayerCarInfo[i][cComponent][7], "Component07");
    orm_addvar_int(ormid, PlayerCarInfo[i][cComponent][8], "Component08");
    orm_addvar_int(ormid, PlayerCarInfo[i][cComponent][9], "Component09");
    orm_addvar_int(ormid, PlayerCarInfo[i][cComponent][10], "Component10");
    orm_addvar_int(ormid, PlayerCarInfo[i][cComponent][11], "Component11");
    orm_addvar_int(ormid, PlayerCarInfo[i][cComponent][12], "Component12");
    orm_addvar_int(ormid, PlayerCarInfo[i][cComponent][13], "Component13");
    orm_addvar_int(ormid, PlayerCarInfo[i][cPaintJob], "PaintJob");
    orm_addvar_string(ormid, PlayerCarInfo[i][cKennzeichen], 129, "Kennzeichen");
    orm_setkey(ormid, "id");
    orm_insert(ormid);
    printf("cID: %d", PlayerCarInfo[i][cID]);
    if(PlayerCarInfo[i][cID] != 0)
    {
    printf("CreateVehicle");
    PlayerCarInfo[i][cVehicle] = CreateVehicle(PlayerCarInfo[i][cModel], 0, 0, 0, 0, PlayerCarInfo[i][cColor][0], PlayerCarInfo[i][cColor][1], -1);
    UpdateVehicleDamageStatus(PlayerCarInfo[i][cVehicle], PlayerCarInfo[i][cDmg][0], PlayerCarInfo[i][cDmg][1], PlayerCarInfo[i][cDmg][2], PlayerCarInfo[i][cDmg][3]);
    if(PlayerCarInfo[i][cComponent][0] != 0)
    AddVehicleComponent(PlayerCarInfo[i][cVehicle], PlayerCarInfo[i][cComponent][0]);
    if(PlayerCarInfo[i][cComponent][1] != 0)
    AddVehicleComponent(PlayerCarInfo[i][cVehicle], PlayerCarInfo[i][cComponent][1]);
    if(PlayerCarInfo[i][cComponent][2] != 0)
    AddVehicleComponent(PlayerCarInfo[i][cVehicle], PlayerCarInfo[i][cComponent][2]);
    if(PlayerCarInfo[i][cComponent][3] != 0)
    AddVehicleComponent(PlayerCarInfo[i][cVehicle], PlayerCarInfo[i][cComponent][3]);
    if(PlayerCarInfo[i][cComponent][4] != 0)
    AddVehicleComponent(PlayerCarInfo[i][cVehicle], PlayerCarInfo[i][cComponent][4]);
    if(PlayerCarInfo[i][cComponent][5] != 0)
    AddVehicleComponent(PlayerCarInfo[i][cVehicle], PlayerCarInfo[i][cComponent][5]);
    if(PlayerCarInfo[i][cComponent][6] != 0)
    AddVehicleComponent(PlayerCarInfo[i][cVehicle], PlayerCarInfo[i][cComponent][6]);
    if(PlayerCarInfo[i][cComponent][7] != 0)
    AddVehicleComponent(PlayerCarInfo[i][cVehicle], PlayerCarInfo[i][cComponent][7]);
    if(PlayerCarInfo[i][cComponent][8] != 0)
    AddVehicleComponent(PlayerCarInfo[i][cVehicle], PlayerCarInfo[i][cComponent][8]);
    if(PlayerCarInfo[i][cComponent][9] != 0)
    AddVehicleComponent(PlayerCarInfo[i][cVehicle], PlayerCarInfo[i][cComponent][9]);
    if(PlayerCarInfo[i][cComponent][10] != 0)
    AddVehicleComponent(PlayerCarInfo[i][cVehicle], PlayerCarInfo[i][cComponent][10]);
    if(PlayerCarInfo[i][cComponent][11] != 0)
    AddVehicleComponent(PlayerCarInfo[i][cVehicle], PlayerCarInfo[i][cComponent][11]);
    if(PlayerCarInfo[i][cComponent][12] != 0)
    AddVehicleComponent(PlayerCarInfo[i][cVehicle], PlayerCarInfo[i][cComponent][12]);
    if(PlayerCarInfo[i][cComponent][13] != 0)
    AddVehicleComponent(PlayerCarInfo[i][cVehicle], PlayerCarInfo[i][cComponent][13]);
    if(PlayerCarInfo[i][cPaintJob] != 0)
    ChangeVehiclePaintjob(PlayerCarInfo[i][cVehicle], PlayerCarInfo[i][cPaintJob]-1); // !!!! Paintjob ist immer +1, sonst fehler in DB!!!
    SetVehicleNumberPlate(PlayerCarInfo[i][cVehicle], PlayerCarInfo[i][cKennzeichen]);
    SetVehicleParamsEx(PlayerCarInfo[i][cVehicle], 0, 0, 0, 1, 0, 0, 0);
    PlayerCarInfo[i][cLocked] = 1;
    printf("Nach Components");
    if(PlayerCarInfo[i][cAbgeschleppt][0] != 0 && PlayerCarInfo[i][cAbgeschleppt][1] != 0 && PlayerCarInfo[i][cAbgeschleppt][2] != 0 && PlayerCarInfo[i][cAbgeschleppt][3] != 0)
    {
    SetVehiclePos(PlayerCarInfo[i][cVehicle], PlayerCarInfo[i][cAbgeschleppt][0], PlayerCarInfo[i][cAbgeschleppt][1], PlayerCarInfo[i][cAbgeschleppt][2]);
    SetVehicleZAngle(PlayerCarInfo[i][cVehicle], PlayerCarInfo[i][cAbgeschleppt][3]);
    }
    else
    {
    SetVehiclePos(PlayerCarInfo[i][cVehicle], PlayerCarInfo[i][cPos][0], PlayerCarInfo[i][cPos][1], PlayerCarInfo[i][cPos][2]);
    SetVehicleZAngle(PlayerCarInfo[i][cVehicle], PlayerCarInfo[i][cPos][3]);
    }
    printf("Zeige Dialog.");
    ShowPlayerDialog(playerid, 999999, DIALOG_STYLE_MSGBOX, "Fahrzeug gekauft", "Herzlichen Glückwunsch!\n\nSie haben erfolgreich ein Fahrzeug erworben.\n\nHilfe bekommen Sie unter /carhelp.", "Okay", "");
    PutPlayerInVehicle(playerid, PlayerCarInfo[i][cVehicle], 0);
    PlayerPlaySound(playerid,1054,0.0,0.0,0.0);
    GivePlayerMoney(playerid, -CarDealerCarInfo[PlayerCDC][cdcPreis]);
    printf("break;");
    break;
    }
    }
    }
    }
    else
    {
    printf("Level nicht genug");
    SendClientMessage(playerid, COLOR_GREY, "Sie haben nicht genügend Level, um sich dieses Fahrzeug zu kaufen.");
    RemovePlayerFromVehicle(playerid);
    }
    }
    else
    {
    printf("Kein Geld");
    SendClientMessage(playerid, COLOR_GREY, "Sie haben nicht genügend Geld für dieses Fahrzeug.");
    RemovePlayerFromVehicle(playerid);
    }
    }
    else
    {
    RemovePlayerFromVehicle(playerid);
    }
    }