Fahrzeuge laden/speichern 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
  • Guten Tag,


    ich habe ein Problem das meine Fahrzeuge nicht laden und richtig speichern, soviel zu meiner Diagnose.
    Wir waren eben zu zweit auf unserem Server, jeder spawnte für die jeweilige Fraktion Fahrzeuge. (SAPD + FBI)
    Nachdem die Fahrzeuge gespawnt sind werden sie in einer .ini in den jeweiligen Scriptfiles, Fraktionsunterordnern gespeichert.
    Wenn der Server neu startet sind anstatt 5 Fahrzeuge nun 10 bei mir mit den SAPD Farben. - Die SAPD Fahrzeuge in der SAPD Garage waren weg.


    Hier mal der Code vom speichern und laden.
    public OnGameModeExit()
    {
    //Fraktionsfahreuge SAPD
    for(new i=0;i<MAX_FRAKTCARS;i++)
    {
    new Fraktauto[200];
    format(Fraktauto,sizeof(Fraktauto),"/Fraktionsdaten/SAPD/%d.ini",i);
    if(dini_Exists(Fraktauto))
    {
    dini_IntSet(Fraktauto,"modelid",Fraktautos[i][1][modelid]);
    dini_FloatSet(Fraktauto,"FPosX",Fraktautos[i][1][fposx]);
    dini_FloatSet(Fraktauto,"FPosY",Fraktautos[i][1][fposy]);
    dini_FloatSet(Fraktauto,"FPosZ",Fraktautos[i][1][fposz]);
    dini_FloatSet(Fraktauto,"FPosA",Fraktautos[i][1][fposa]);
    dini_IntSet(Fraktauto,"Spoiler",GetVehicleComponentInSlot(SAPDcar[i],0));
    dini_IntSet(Fraktauto,"Hood",GetVehicleComponentInSlot(SAPDcar[i],1));
    dini_IntSet(Fraktauto,"Roof",GetVehicleComponentInSlot(SAPDcar[i],2));
    dini_IntSet(Fraktauto,"Sideskirt",GetVehicleComponentInSlot(SAPDcar[i],3));
    dini_IntSet(Fraktauto,"Lamps",GetVehicleComponentInSlot(SAPDcar[i],4));
    dini_IntSet(Fraktauto,"Nitro",GetVehicleComponentInSlot(SAPDcar[i],5));
    dini_IntSet(Fraktauto,"Exhaust",GetVehicleComponentInSlot(SAPDcar[i],6));
    dini_IntSet(Fraktauto,"Wheels",GetVehicleComponentInSlot(SAPDcar[i],7));
    dini_IntSet(Fraktauto,"Stereo",GetVehicleComponentInSlot(SAPDcar[i],8));
    dini_IntSet(Fraktauto,"Hydraulics",GetVehicleComponentInSlot(SAPDcar[i],9));
    dini_IntSet(Fraktauto,"FrontBumper",GetVehicleComponentInSlot(SAPDcar[i],10));
    dini_IntSet(Fraktauto,"RearBumper",GetVehicleComponentInSlot(SAPDcar[i],11));
    dini_IntSet(Fraktauto,"VentRight",GetVehicleComponentInSlot(SAPDcar[i],12));
    dini_IntSet(Fraktauto,"VentLeft",GetVehicleComponentInSlot(SAPDcar[i],13));
    print("Fraktionsfahrzeuge SAPD gespeichert");
    }
    format(Fraktauto,sizeof(Fraktauto),"/Fraktionsdaten/FBI/%d.ini",i);
    if(dini_Exists(Fraktauto))
    {
    dini_IntSet(Fraktauto,"modelid",Fraktautos[i][1][modelid]);
    dini_FloatSet(Fraktauto,"FPosX",Fraktautos[i][1][fposx]);
    dini_FloatSet(Fraktauto,"FPosY",Fraktautos[i][1][fposy]);
    dini_FloatSet(Fraktauto,"FPosZ",Fraktautos[i][1][fposz]);
    dini_FloatSet(Fraktauto,"FPosA",Fraktautos[i][1][fposa]);
    dini_IntSet(Fraktauto,"Spoiler",GetVehicleComponentInSlot(FBIcar[i],0));
    dini_IntSet(Fraktauto,"Hood",GetVehicleComponentInSlot(FBIcar[i],1));
    dini_IntSet(Fraktauto,"Roof",GetVehicleComponentInSlot(FBIcar[i],2));
    dini_IntSet(Fraktauto,"Sideskirt",GetVehicleComponentInSlot(FBIcar[i],3));
    dini_IntSet(Fraktauto,"Lamps",GetVehicleComponentInSlot(FBIcar[i],4));
    dini_IntSet(Fraktauto,"Nitro",GetVehicleComponentInSlot(FBIcar[i],5));
    dini_IntSet(Fraktauto,"Exhaust",GetVehicleComponentInSlot(FBIcar[i],6));
    dini_IntSet(Fraktauto,"Wheels",GetVehicleComponentInSlot(FBIcar[i],7));
    dini_IntSet(Fraktauto,"Stereo",GetVehicleComponentInSlot(FBIcar[i],8));
    dini_IntSet(Fraktauto,"Hydraulics",GetVehicleComponentInSlot(FBIcar[i],9));
    dini_IntSet(Fraktauto,"FrontBumper",GetVehicleComponentInSlot(FBIcar[i],10));
    dini_IntSet(Fraktauto,"RearBumper",GetVehicleComponentInSlot(FBIcar[i],11));
    dini_IntSet(Fraktauto,"VentRight",GetVehicleComponentInSlot(FBIcar[i],12));
    dini_IntSet(Fraktauto,"VentLeft",GetVehicleComponentInSlot(FBIcar[i],13));
    print("Fraktionsfahrzeuge FBI gespeichert");
    }// und so weiter


    OnGameModeInIt
    for(new i=0;i<MAX_FRAKTCARS;i++)
    {
    new Fraktauto[200];
    format(Fraktauto,sizeof(Fraktauto),"/Fraktionsdaten/SAPD/%d.ini",i);
    if(dini_Exists(Fraktauto))
    {
    Fraktautos[i][1][modelid] = dini_Int(Fraktauto,"modelid");
    Fraktautos[i][1][fposx] = dini_Float(Fraktauto,"FPosX");
    Fraktautos[i][1][fposy] = dini_Float(Fraktauto,"FPosY");
    Fraktautos[i][1][fposz] = dini_Float(Fraktauto,"FPosZ");
    Fraktautos[i][1][fposa] = dini_Float(Fraktauto,"FPosA");
    Fraktautos[i][1][Spoiler] = dini_Int(Fraktauto,"Spoiler");
    Fraktautos[i][1][Hood] = dini_Int(Fraktauto,"Hood");
    Fraktautos[i][1][Roof] = dini_Int(Fraktauto,"Roof");
    Fraktautos[i][1][Sideskirt] = dini_Int(Fraktauto,"Sideskirt");
    Fraktautos[i][1][Lamps] = dini_Int(Fraktauto,"Lamps");
    Fraktautos[i][1][Nitro] = dini_Int(Fraktauto,"Nitro");
    Fraktautos[i][1][Exhaust] = dini_Int(Fraktauto,"Exhaust");
    Fraktautos[i][1][Wheels] = dini_Int(Fraktauto,"Wheels");
    Fraktautos[i][1][Stereo] = dini_Int(Fraktauto,"Stereo");
    Fraktautos[i][1][Hydraulics] = dini_Int(Fraktauto,"Hydraulics");
    Fraktautos[i][1][FrontBumper] = dini_Int(Fraktauto,"FrontBumper");
    Fraktautos[i][1][RearBumper] = dini_Int(Fraktauto,"RearBumper");
    Fraktautos[i][1][VentRight] = dini_Int(Fraktauto,"VentRight");
    Fraktautos[i][1][VentLeft] = dini_Int(Fraktauto,"VentLeft");
    SAPDcar[i] = AddStaticVehicleEx(Fraktautos[i][1][modelid],Fraktautos[i][1][fposx],Fraktautos[i][1][fposy],Fraktautos[i][1][fposz],Fraktautos[i][1][fposa],125,1,-1);
    SetVehicleNumberPlate(SAPDcar[i],"SAPD");
    print("Fraktionsfahrzeuge SAPD geladen");
    }
    format(Fraktauto,sizeof(Fraktauto),"/Fraktionsdaten/FBI/%d.ini",i);
    if(dini_Exists(Fraktauto))
    {
    Fraktautos[i][2][modelid] = dini_Int(Fraktauto,"modelid");
    Fraktautos[i][2][fposx] = dini_Float(Fraktauto,"FPosX");
    Fraktautos[i][2][fposy] = dini_Float(Fraktauto,"FPosY");
    Fraktautos[i][2][fposz] = dini_Float(Fraktauto,"FPosZ");
    Fraktautos[i][2][fposa] = dini_Float(Fraktauto,"FPosA");
    Fraktautos[i][2][Spoiler] = dini_Int(Fraktauto,"Spoiler");
    Fraktautos[i][2][Hood] = dini_Int(Fraktauto,"Hood");
    Fraktautos[i][2][Roof] = dini_Int(Fraktauto,"Roof");
    Fraktautos[i][2][Sideskirt] = dini_Int(Fraktauto,"Sideskirt");
    Fraktautos[i][2][Lamps] = dini_Int(Fraktauto,"Lamps");
    Fraktautos[i][2][Nitro] = dini_Int(Fraktauto,"Nitro");
    Fraktautos[i][2][Exhaust] = dini_Int(Fraktauto,"Exhaust");
    Fraktautos[i][2][Wheels] = dini_Int(Fraktauto,"Wheels");
    Fraktautos[i][2][Stereo] = dini_Int(Fraktauto,"Stereo");
    Fraktautos[i][2][Hydraulics] = dini_Int(Fraktauto,"Hydraulics");
    Fraktautos[i][2][FrontBumper] = dini_Int(Fraktauto,"FrontBumper");
    Fraktautos[i][2][RearBumper] = dini_Int(Fraktauto,"RearBumper");
    Fraktautos[i][2][VentRight] = dini_Int(Fraktauto,"VentRight");
    Fraktautos[i][2][VentLeft] = dini_Int(Fraktauto,"VentLeft");
    FBIcar[i] = AddStaticVehicleEx(Fraktautos[i][2][modelid],Fraktautos[i][2][fposx],Fraktautos[i][2][fposy],Fraktautos[i][2][fposz],Fraktautos[i][2][fposa],0,0,-1);
    SetVehicleNumberPlate(FBIcar[i],"FBI");
    print("Fraktionsfahrzeuge FBI geladen");
    }// und so weitere


    Würde mich über jede bedenkliche Hilfe freuen.

    2 Mal editiert, zuletzt von Pawn0 ()

  • Ein enum für alle.
    enum Fraktcars
    {
    modelid,
    Float:fposx,
    Float:fposy,
    Float:fposz,
    Float:fposa,
    Spoiler,
    Hood,
    Roof,
    Sideskirt,
    Lamps,
    Nitro,
    Exhaust,
    Wheels,
    Stereo,
    Hydraulics,
    FrontBumper,
    RearBumper,
    VentRight,
    VentLeft
    }


    und zu 2, ja richtig.

  • Ich habe für jede Fraktion ein neuen Wert der Autos zugewiesen
    new SAPDcar[MAX_FRAKTCARS];
    new FBIcar[MAX_FRAKTCARS];
    new Armycar[MAX_FRAKTCARS];
    new Mediccar[MAX_FRAKTCARS];
    new Newscar[MAX_FRAKTCARS];
    new Abschleppcar[MAX_FRAKTCARS];
    new Vagoscar[MAX_FRAKTCARS];
    new Grovecar[MAX_FRAKTCARS];
    new Yakuzacar[MAX_FRAKTCARS];
    new Ballascar[MAX_FRAKTCARS];
    new Hitmancar[MAX_FRAKTCARS];
    new GMBHcar[MAX_FRAKTCARS];


    und hier das new zum enum
    new Fraktautos[MAX_FRAKTCARS][13][Fraktcars];

  • Versuch mal das hier:


    format(Fraktauto,sizeof(Fraktauto),"/Fraktionsdaten/FBI/%d.ini",i);
    if(dini_Exists(Fraktauto))
    {
    dini_IntSet(Fraktauto,"modelid",Fraktautos[i][2][modelid]);
    dini_FloatSet(Fraktauto,"FPosX",Fraktautos[i][2][fposx]);
    dini_FloatSet(Fraktauto,"FPosY",Fraktautos[i][2][fposy]);
    dini_FloatSet(Fraktauto,"FPosZ",Fraktautos[i][2][fposz]);
    dini_FloatSet(Fraktauto,"FPosA",Fraktautos[i][2][fposa]);
    dini_IntSet(Fraktauto,"Spoiler",GetVehicleComponentInSlot(FBIcar[i],0));
    dini_IntSet(Fraktauto,"Hood",GetVehicleComponentInSlot(FBIcar[i],1));
    dini_IntSet(Fraktauto,"Roof",GetVehicleComponentInSlot(FBIcar[i],2));
    dini_IntSet(Fraktauto,"Sideskirt",GetVehicleComponentInSlot(FBIcar[i],3));
    dini_IntSet(Fraktauto,"Lamps",GetVehicleComponentInSlot(FBIcar[i],4));
    dini_IntSet(Fraktauto,"Nitro",GetVehicleComponentInSlot(FBIcar[i],5));
    dini_IntSet(Fraktauto,"Exhaust",GetVehicleComponentInSlot(FBIcar[i],6));
    dini_IntSet(Fraktauto,"Wheels",GetVehicleComponentInSlot(FBIcar[i],7));
    dini_IntSet(Fraktauto,"Stereo",GetVehicleComponentInSlot(FBIcar[i],8));
    dini_IntSet(Fraktauto,"Hydraulics",GetVehicleComponentInSlot(FBIcar[i],9));
    dini_IntSet(Fraktauto,"FrontBumper",GetVehicleComponentInSlot(FBIcar[i],10));
    dini_IntSet(Fraktauto,"RearBumper",GetVehicleComponentInSlot(FBIcar[i],11));
    dini_IntSet(Fraktauto,"VentRight",GetVehicleComponentInSlot(FBIcar[i],12));
    dini_IntSet(Fraktauto,"VentLeft",GetVehicleComponentInSlot(FBIcar[i],13));
    print("Fraktionsfahrzeuge FBI gespeichert");
    }// und so weiter


  • Dürfte ich fragen was geändert wurde?

  • format(Fraktauto,sizeof(Fraktauto),"/Fraktionsdaten/FBI/%d.ini",i);
    if(dini_Exists(Fraktauto))
    {
    dini_IntSet(Fraktauto,"modelid",Fraktautos[i][2][modelid]); // Vorher stand hier Fraktautos[i][1][modelid]
    dini_FloatSet(Fraktauto,"FPosX",Fraktautos[i][2][fposx]); // Vorher stand hier Fraktautos[i][1][fposx]
    dini_FloatSet(Fraktauto,"FPosY",Fraktautos[i][2][fposy]); // Vorher stand hier Fraktautos[i][1][fposy]
    dini_FloatSet(Fraktauto,"FPosZ",Fraktautos[i][2][fposz]); // Vorher stand hier Fraktautos[i][1][fposz]
    dini_FloatSet(Fraktauto,"FPosA",Fraktautos[i][2][fposa]); // Vorher stand hier Fraktautos[i][2][fposa]
    dini_IntSet(Fraktauto,"Spoiler",GetVehicleComponentInSlot(FBIcar[i],0));
    dini_IntSet(Fraktauto,"Hood",GetVehicleComponentInSlot(FBIcar[i],1));
    dini_IntSet(Fraktauto,"Roof",GetVehicleComponentInSlot(FBIcar[i],2));
    dini_IntSet(Fraktauto,"Sideskirt",GetVehicleComponentInSlot(FBIcar[i],3));
    dini_IntSet(Fraktauto,"Lamps",GetVehicleComponentInSlot(FBIcar[i],4));
    dini_IntSet(Fraktauto,"Nitro",GetVehicleComponentInSlot(FBIcar[i],5));
    dini_IntSet(Fraktauto,"Exhaust",GetVehicleComponentInSlot(FBIcar[i],6));
    dini_IntSet(Fraktauto,"Wheels",GetVehicleComponentInSlot(FBIcar[i],7));
    dini_IntSet(Fraktauto,"Stereo",GetVehicleComponentInSlot(FBIcar[i],8));
    dini_IntSet(Fraktauto,"Hydraulics",GetVehicleComponentInSlot(FBIcar[i],9));
    dini_IntSet(Fraktauto,"FrontBumper",GetVehicleComponentInSlot(FBIcar[i],10));
    dini_IntSet(Fraktauto,"RearBumper",GetVehicleComponentInSlot(FBIcar[i],11));
    dini_IntSet(Fraktauto,"VentRight",GetVehicleComponentInSlot(FBIcar[i],12));
    dini_IntSet(Fraktauto,"VentLeft",GetVehicleComponentInSlot(FBIcar[i],13));
    print("Fraktionsfahrzeuge FBI gespeichert");
    }// und so weiter


  • Bringt nichts, SAPD Fahrzeuge speichern, FBI ebenso, laden tut nur SAPD.


    //Edit:
    Speicherung glaube auch fehlerhaft. ini eines Fahrzeuges (FBI)
    modelid=0
    FPosX=0.000000
    FPosY=0.000000
    FPosZ=0.000000
    FPosA=0.000000
    Spoiler=0
    Hood=0
    Roof=0
    Sideskirt=0
    Lamps=0
    Nitro=0
    Exhaust=0
    Wheels=0
    Stereo=0
    Hydraulics=0
    FrontBumper=0
    RearBumper=0
    VentRight=0
    VentLeft=0

  • do.de - Domain-Offensive - Domains für alle und zu super Preisen
  • Ja habe ich


    Speicherung glaube auch fehlerhaft. ini eines Fahrzeuges (FBI)
    modelid=0
    FPosX=0.000000
    FPosY=0.000000
    FPosZ=0.000000
    FPosA=0.000000
    Spoiler=0
    Hood=0
    Roof=0
    Sideskirt=0
    Lamps=0
    Nitro=0
    Exhaust=0
    Wheels=0
    Stereo=0
    Hydraulics=0
    FrontBumper=0
    RearBumper=0
    VentRight=0
    VentLeft=0