Haus-Car speichern lassen

  • Haus-Car speichern lassen

    Hi,

    ich wollt heut mal wieder nen bissl scripten,
    und hab da mein Script angeschaut, und mein "Fail-HausCarSystem".

    Nun, wie kann ich das richtig speichern lassen:

    [pwn]#define MAX_ANZAHL_AN_HAUS 100

    enum hausinformationen
    {
    hPreis,
    hInBesitz,
    hBesitzerName[24],
    hKasse,
    Float:hX,
    Float:hY,
    Float:hZ,
    Pickup,
    hCar,
    Float:hCarX,
    Float:hCarY,
    Float:hCarZ,
    Float:hCarA,
    hOpen,
    hInt,
    Float:hIntX,
    Float:hIntY,
    Float:hIntZ,
    hCarF1,
    hCarF2,
    Text3D:Label
    }
    new HausInfo[MAX_ANZAHL_AN_HAUS][hausinformationen];[/pwn]

    Dann hab ich unter OnGameModeInit:

    [pwn] for(new h = 0; h < MAX_ANZAHL_AN_HAUS; h++)
    {
    LoadHaus(h);
    if(HausInfo[h][hCar] == 0)
    {
    HausNoobCar = AddStaticVehicleEx(400, HausInfo[h][hCarX], HausInfo[h][hCarY], HausInfo[h][hCarZ], HausInfo[h][hCarA], 0,0, -1);
    HausInfo[h][hCar] = 400;
    }

    if(HausInfo[h][hCar] >= 401)
    {
    AddStaticVehicleEx(HausInfo[h][hCar], HausInfo[h][hCarX], HausInfo[h][hCarY], HausInfo[h][hCarZ], HausInfo[h][hCarA], HausInfo[h][hCarF1], HausInfo[h][hCarF2], -1);
    }
    }[/pwn]


    Dann hier das mit dem HC-System:

    [pwn]ocmd:hauscar(playerid,params[])
    {
    new Name[24];
    for(new h = 1; h < MAX_ANZAHL_AN_HAUS; h++)// b = 1 lassen wir wollen kein Biz miz ID 0 :D
    {
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    GetPlayerName(i, Name, 24);
    if(!strcmp(HausInfo[h][hBesitzerName],Name, false))
    {
    ShowPlayerDialog(i, DIALOG_HC, DIALOG_STYLE_LIST, "Hauscar's", "4-Räder\n2-Räder\nOffroad Fahrzeuge\nSportwagen\nSpezial", "Fortfahren", "Abbrechen");
    }
    }
    }
    return 1;
    }[/pwn]

    Die DIaloge:

    [pwn] case DIALOG_HC:
    {
    if(response)
    {
    if(listitem == 0)
    {
    ShowPlayerDialog(playerid, DIALOG_HC1, DIALOG_STYLE_LIST, "4-Räder", "Sentinel - 25.000$\nMoonbeam - 20.000$\nStallion - 30.000$\nAdmiral - 50.000$\nBurrito - 30.000$\nGreenwood - 25.000$\nSlamvan 10.000$\nClover - 15.000$", "Auswählen", "Abbrechen");
    }

    if(listitem == 1)
    {
    ShowPlayerDialog(playerid, DIALOG_HC2, DIALOG_STYLE_LIST, "2-Räder", "Faggio - 7.000$\nFreeway - 12.000$\nSanchez - 10.000$\nBMX - 5.000$\nMountain Bike - 6.000$\nNRG-500 - 24.000$", "Auswählen", "Abbrechen");
    }

    if(listitem == 2)
    {
    ShowPlayerDialog(playerid, DIALOG_HC3, DIALOG_STYLE_LIST, "Offroad-Fahrzeuge", "Patriot - 30.000$\nSandking - 100.000$\nSadler - 25.000$\nYosemite - 30.000$\nSavanna - 20.000$", "Auswählen", "Abbrechen");
    }

    if(listitem == 3)
    {
    ShowPlayerDialog(playerid, DIALOG_HC4, DIALOG_STYLE_LIST, "Sportwagen", "Infernus - 200.000$\nBuffalo - 150.000$\nCheetah - 250.000$\nBanshee - 300.000$\nTurismo - 100.000$\nComet - 250.000$\nHotring Racer - 2.500.000$\nSuper GT - 150.000$\nSultan - 100.000$", "Auswählen", "Abbrechen");
    }

    if(listitem == 4)
    {
    ShowPlayerDialog(playerid, DIALOG_HC5, DIALOG_STYLE_LIST, "Spezial Wägen", "Trashmaster - 1.250.000$\nEiswagen - 2.000.000$\nTruck Yankee - 1.500.000$\nBoxville - 600.000$\nJourney - 2.000.000$\nMonster Truck - 5.000.000$", "Auswählen", "Abbrechen");
    }
    }
    }

    case DIALOG_HC1:
    {
    if(response)
    {
    for(new h = 0; h < MAX_ANZAHL_AN_HAUS; h++)
    {
    if(listitem == 0 && GetPlayerMoney(playerid) >= 25000)
    {
    DestroyVehicle(HausNoobCar);
    HausInfo[h][hCar] = 405;
    }

    if(listitem == 1 && GetPlayerMoney(playerid) >= 20000)
    {
    DestroyVehicle(HausNoobCar);
    HausInfo[h][hCar] = 418;
    }

    if(listitem == 2 && GetPlayerMoney(playerid) >= 30000)
    {
    DestroyVehicle(HausNoobCar);
    HausInfo[h][hCar] = 439;
    }

    if(listitem == 3 && GetPlayerMoney(playerid) >= 50000)
    {
    DestroyVehicle(HausNoobCar);
    HausInfo[h][hCar] = 445;
    }
    if(listitem == 4 && GetPlayerMoney(playerid) >= 30000)
    {
    DestroyVehicle(HausNoobCar);
    HausInfo[h][hCar] = 482;
    }
    }
    }
    }[/pwn]

    meine beiden stocks:


    [pwn]stock SaveHaus(h)
    {
    new path[64];
    format(path, sizeof(path),"/Haus/%d.ini", h);//Nummer statt Namen
    if(!dini_Exists(path)) return 0;
    dini_IntSet(path, "Preis", HausInfo[h][hPreis]);
    dini_IntSet(path, "InBesitz", HausInfo[h][hInBesitz]);
    dini_Set(path, "Besitzer", HausInfo[h][hBesitzerName]);
    dini_IntSet(path, "Kasse", HausInfo[h][hKasse]);
    dini_FloatSet(path, "X", HausInfo[h][hX]);
    dini_FloatSet(path, "Y", HausInfo[h][hY]);
    dini_FloatSet(path, "Z", HausInfo[h][hZ]);
    dini_IntSet(path, "Car", HausInfo[h][hCar]);
    dini_FloatSet(path, "CarX", HausInfo[h][hCarX]);
    dini_FloatSet(path, "CarY", HausInfo[h][hCarY]);
    dini_FloatSet(path, "CarZ", HausInfo[h][hCarZ]);
    dini_FloatSet(path, "CarA", HausInfo[h][hCarA]);
    dini_IntSet(path, "Open", HausInfo[h][hOpen]);
    dini_IntSet(path, "Int", HausInfo[h][hInt]);
    dini_FloatSet(path, "IntX", HausInfo[h][hIntX]);
    dini_FloatSet(path, "IntY", HausInfo[h][hIntY]);
    dini_FloatSet(path, "IntZ", HausInfo[h][hIntZ]);
    dini_IntSet(path, "CarF1", HausInfo[h][hCarF1]);
    dini_IntSet(path, "CarF2", HausInfo[h][hCarF2]);
    return 1;
    }

    stock LoadHaus(h)
    {
    new path[64];
    format(path, sizeof(path),"/Haus/%d.ini", h);//Nummer statt Namen
    if(!dini_Exists(path)) return 0;
    HausInfo[h][hPreis] = dini_Int(path, "Preis");
    HausInfo[h][hInBesitz] = dini_Int(path, "InBesitz");
    format(HausInfo[h][hBesitzerName],24,dini_Get(path, "Besitzer"));
    HausInfo[h][hKasse] = dini_Int(path, "Kasse");
    HausInfo[h][hX] = dini_Float(path, "X");
    HausInfo[h][hY] = dini_Float(path, "Y");
    HausInfo[h][hZ] = dini_Float(path, "Z");
    HausInfo[h][hCar] = dini_Int(path, "Car");
    HausInfo[h][hCarX] = dini_Float(path, "CarX");
    HausInfo[h][hCarY] = dini_Float(path, "CarY");
    HausInfo[h][hCarZ] = dini_Float(path, "CarZ");
    HausInfo[h][hCarA] = dini_Float(path, "CarA");
    HausInfo[h][hOpen] = dini_Int(path, "Open");
    HausInfo[h][hInt] = dini_Int(path, "Int");
    HausInfo[h][hIntX] = dini_Float(path, "IntX");
    HausInfo[h][hIntY] = dini_Float(path, "IntY");
    HausInfo[h][hIntZ] = dini_Float(path, "IntZ");
    HausInfo[h][hCarF1] = dini_Int(path, "CarF1");
    HausInfo[h][hCarF2] = dini_Int(path, "CarF2");
    return 1;
    }[/pwn]

    Aber das mit den Autos klappt halt nicht.

    Lg

    @Pro's wie z.B.:
    @Vincent Petritz:

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von playerid ()