Autohaussystem Speichert nicht richtig

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,


    Ich habe ein großes Problem mit mein Autohaussystem und zwar wird in den Scriptfiles im ordner Cars einmal die Cars gespeichert und einmal eine Datei namens Player. In der Datei Player wird gespeichert wieviel Autos eine Person hat das sieht dann so aus :


    xXxRoberxXx: Owner =0


    Problem nur nach dem Autokauf speichert der alles super ..


    xXxRoberxXx: Owner =1


    Aber wenn ich das Auto dann verkaufe erscheinen aufeinmal die Daten die in der anderen Datei waren in der Datei Player :



    xXxRoberxXx: Owner =0
    pyy2=-1144.6226
    pzz2=24.6126
    paa2=350.7449
    automodel=506
    c1=6
    c2=6
    Key=xXxRoberxXx
    Rented=0
    ABC=UC
    NSID=977
    BuyPrice=91000
    Lock=1
    Nitro=0
    Hyd=0
    Wheel=0
    Auspuff=0
    SeiteL=0
    SeiteR=0
    FB=0
    RB=0
    Spoiler=0
    Roof=0
    Hood=0
    Vent=0
    Lamp=0
    xXxRoberxXx: Rent =0


    Autokaufen :


    if(dialogid == BuyDiag)
    {
    if(response)
    {
    new price, co1, co2, mmautomodel, str[50];
    for(new i = 0; i<sizeof Buhnenautos; i++)
    {
    if(GetPlayerVehicleID(playerid) == Buhnenautos[i][v_id])
    {
    price = Buhnenautos[i][CarPreis];
    co1 = Buhnenautos[i][Color1];
    co2 = Buhnenautos[i][Color2];
    mmautomodel = Buhnenautos[i][mautomodel];
    }
    }
    new dform[128], i = CreateNumber(), Float:rrx, Float:rry, Float:rrz, Float:rra;
    format(dform,sizeof dform,"/Cars/%d.ini",i);
    for(new k = 0; k<sizeof CarRanges; k++)
    {
    if(IsPlayerInRangeOfPoint(playerid, 50.0, CarRanges[k][0],CarRanges[k][1],CarRanges[k][2]))
    {
    rrx = CarSpawns[k][0];
    rry = CarSpawns[k][1];
    rrz = CarSpawns[k][2];
    rra = CarSpawns[k][3];
    }
    }
    if(!fexist(dform))
    {
    if(GetPlayerMoney(playerid) > price)
    {
    if(Spieleer[playerid][Own] < MaxCarsOwn)
    {
    GivePlayerMoney(playerid, -price);
    SendClientMessage(playerid, COLOR_YELLOW, "Glückwunsch zu deinem neuen Fahrzeug!");
    // PlayerCar[i][NS] = Create3DTextLabel("", COLOR_NS, 0.0, 0.0, 0.0, 50.0, 0, 0);
    PlayerCar[i][pxx2] = rrx;
    PlayerCar[i][pyy2] = rry;
    PlayerCar[i][pzz2] = rrz;
    PlayerCar[i][paa2] = rra;
    PlayerCar[i][c1] = co1;
    PlayerCar[i][c2] = co2;
    PlayerCar[i][automodel] = mmautomodel;
    PlayerCar[i][NSID] = i;
    PlayerCar[i][BuyPrice] = price;
    PlayerCar[i][Lock] = 1;
    format(PlayerCar[i][Key], MAX_PLAYER_NAME, "%s", pn(playerid));
    PlayerCar[i][viddd] = CreateVehicle(PlayerCar[i][automodel], PlayerCar[i][pxx2], PlayerCar[i][pyy2], PlayerCar[i][pzz2], PlayerCar[i][paa2], PlayerCar[i][c1], PlayerCar[i][c2], -1);
    format(PlayerCar[i][ABC], 11, "%s", CreateABC());
    format(str, sizeof str, "%s-%s-0%d", NSPraefix, PlayerCar[i][ABC], PlayerCar[i][NSID]);
    // Update3DTextLabelText(PlayerCar[i][NS], COLOR_NS, str);
    // Attach3DTextLabelToVehicle(PlayerCar[i][NS], PlayerCar[i][viddd], 0.0, 0.0, NSHoehe);
    SetVehicleNumberPlate(PlayerCar[i][viddd], str);
    TogglePlayerControllable(playerid, 1);
    RemovePlayerFromVehicle(playerid);
    new File:f; f=fopen(dform,io_write); if(f) { fclose(f); }
    Spieleer[playerid][Own] += 1;//TEST
    if(INI_Open("/Cars/Players.ini"))
    {
    new str9[68];
    format(str9, sizeof str9, "%s: Owner ", pn(playerid));
    INI_WriteInt(str9, Spieleer[playerid][Own]);
    print("SpieleerOWN gespeichert!");
    INI_Save();
    INI_Close();
    }

    }
    else
    {
    new string[50];
    format(string, sizeof string, "Du hast schon %d Fahrzeuge!", MaxCarsOwn);
    SendClientMessage(playerid, COLOR_GREY, string);
    RemovePlayerFromVehicle(playerid);
    TogglePlayerControllable(playerid, 1);
    }
    }
    else
    {
    SendClientMessage(playerid, COLOR_GREY, "Du hast nicht genug Geld!");
    RemovePlayerFromVehicle(playerid);
    TogglePlayerControllable(playerid, 1);
    }
    }
    }
    if(!response)
    {
    RemovePlayerFromVehicle(playerid);
    TogglePlayerControllable(playerid, 1);
    }
    }


    Autoverkaufen:


    if (strcmp("/Autoverkaufen", cmdtext, true) == 0)
    {
    if(IsPlayerInAnyVehicle(playerid))
    {
    for(new i = 0; i<MAX_VEHICLES; i++)
    {
    if(PlayerCar[i][viddd] == GetPlayerVehicleID(playerid))
    {
    if(!strcmp(PlayerCar[i][Key], pn(playerid), false))
    {
    new sform[128];
    format(sform,sizeof sform,"/Cars/%d.ini",PlayerCar[i][NSID]);
    if(fexist(sform))
    {
    print("File existiert");
    GivePlayerMoney(playerid, PlayerCar[i][BuyPrice]/2);
    new pm = GetVehicleModel(PlayerCar[i][viddd]);
    pm -= 400;
    format(str, sizeof str, "Du hast deinen %s für %d verkauft!", PlayerVehicle[pm], PlayerCar[i][BuyPrice]/2);
    SendClientMessage(playerid, COLOR_RED, str);
    DestroyVehicle(PlayerCar[i][viddd]);
    PlayerCar[i][BuyPrice] = 0;
    PlayerCar[i][pxx2] = 0;
    PlayerCar[i][pyy2] = 0;
    PlayerCar[i][pzz2] = 0;
    PlayerCar[i][paa2] = 0;
    format(PlayerCar[i][Key], MAX_PLAYER_NAME, "");
    PlayerCar[i][automodel] = 0;
    PlayerCar[i][c1] = 0;
    PlayerCar[i][c2] = 0;
    Spieleer[playerid][Own] --;
    format(PlayerCar[i][ABC], 11, "");
    if(INI_Open("/Cars/Players.ini"))
    {
    new str9[68];
    format(str9, sizeof str9, "%s: Owner ", pn(playerid));
    INI_WriteInt(str9, Spieleer[playerid][Own]);
    print("SpieleerOWN gespeichert!");
    INI_Save();
    INI_Close();
    }
    if(INI_Open(sform))
    {
    INI_Remove(sform);
    INI_Save();
    INI_Close();
    }
    return 1;
    }
    else
    {
    return 1;
    }
    }
    else
    {
    return SendClientMessage(playerid, COLOR_GREY, "Dieses Fahrzeug gehört dir nicht!");
    }
    }
    }
    }
    return 1;
    }


    Ich hoffe ihr könnt mir helfen :(

  • Ja


    Ich weiß jetzt auch wo ran es liegt , nur nicht genau wie ich es beheben soll ..


    Es liegt hier dran :


    public SaveCar(i)
    {
    new sform[128];
    format(sform, sizeof sform, "/Cars/%d.ini", i);
    if(fexist(sform))
    {
    if(INI_Open(sform))
    {
    INI_WriteFloat("pxx2", PlayerCar[i][pxx2]);
    INI_WriteFloat("pyy2", PlayerCar[i][pyy2]);
    INI_WriteFloat("pzz2", PlayerCar[i][pzz2]);
    INI_WriteFloat("paa2", PlayerCar[i][paa2]);
    INI_WriteInt("automodel", PlayerCar[i][automodel]);
    INI_WriteInt("c1", PlayerCar[i][c1]);
    INI_WriteInt("c2", PlayerCar[i][c2]);
    INI_WriteString("Key", PlayerCar[i][Key]);
    INI_WriteString("Key2", PlayerCar[i][Key2]);
    INI_WriteInt("Rented", PlayerCar[i][Rented]);
    INI_WriteString("ABC", PlayerCar[i][ABC]);
    INI_WriteInt("NSID", PlayerCar[i][NSID]);
    INI_WriteInt("BuyPrice", PlayerCar[i][BuyPrice]);
    INI_WriteInt("Lock", PlayerCar[i][Lock]);
    INI_WriteInt("Nitro", PlayerCar[i][Nitro]);
    INI_WriteInt("Hyd", PlayerCar[i][Hyd]);
    INI_WriteInt("Wheel", PlayerCar[i][Wheel]);
    INI_WriteInt("Auspuff", PlayerCar[i][Auspuff]);
    INI_WriteInt("SeiteL", PlayerCar[i][SeiteL]);
    INI_WriteInt("SeiteR", PlayerCar[i][SeiteR]);
    INI_WriteInt("FB", PlayerCar[i][FB]);
    INI_WriteInt("RB", PlayerCar[i][RB]);
    INI_WriteInt("Spoiler", PlayerCar[i][Spoiler]);
    INI_WriteInt("Roof", PlayerCar[i][Roof]);
    INI_WriteInt("Hood", PlayerCar[i][Hood]);
    INI_WriteInt("Vent", PlayerCar[i][Vent]);
    INI_WriteInt("Lamp", PlayerCar[i][Lamp]);
    INI_Save();
    INI_Close();
    }
    }
    return 1;
    }