Beiträge von [DT]Nightstr3am

    Zeig mal wie du dein Auto speicherst, denn das was du da hast ist eig unsinn


    Hier ist der enum und die CarInfo ... :



    enum Ainfo //Autoinfo
    {
    besitzer[35],
    carmid,
    Float:HP,
    tank,
    km,
    wiederverkauf,
    carslot,
    Float:posx,
    Float:posy,
    Float:posz,
    Float:posa,
    Float:oparkx,
    Float:oparky,
    Float:oparkz,
    Float:oparka,
    Abgeschlossen,
    Farbe1,
    Farbe2,
    Paintjob,
    Spoiler,
    Hood,
    Roof,
    Sideskirt,
    Lamps,
    Nitro,
    Exhaust,
    Wheels,
    Stereo,
    Hydraulics,
    FrontBumper,
    RearBumper,
    VentRight,
    VentLeft,
    neon,
    neon1,
    neon2
    }
    new CarInfo[MAX_VEHICLES][Ainfo];


    Und hier der stock Car-Save :

    stock CarSave(playerid,vehicleid)
    {
    new Float:vhp,Float:vX,Float:vY,Float:vZ,Float:vA;
    GetVehicleHealth(vehicleid,vhp);
    GetVehiclePos(vehicleid,vX,vY,vZ);
    GetVehicleZAngle(vehicleid,vA);
    new string[999],mysql[178];
    format(mysql, sizeof(mysql), "hp='%f',",vhp);
    strcat(string, mysql);
    format(mysql, sizeof(mysql), "abgeschlossen='%d',",CarInfo[vehicleid][Abgeschlossen]);
    strcat(string, mysql);
    format(mysql, sizeof(mysql), "tank='%d',",CarInfo[vehicleid][tank]);
    strcat(string, mysql);
    format(mysql, sizeof(mysql), "km='%d',",CarInfo[vehicleid][km]);
    strcat(string, mysql).
    format(mysql, sizeof(mysql), "farbe1='%d',",CarInfo[vehicleid][Farbe1]);
    strcat(string, mysql);
    format(mysql, sizeof(mysql), "farbe2='%d',",CarInfo[vehicleid][Farbe2]);
    strcat(string, mysql);
    format(mysql, sizeof(mysql), "paintjob='%d',",CarInfo[vehicleid][Paintjob]);
    strcat(string, mysql);
    format(mysql, sizeof(mysql), "spoiler='%d',",GetVehicleComponentInSlot(vehicleid,0));
    strcat(string, mysql);
    format(mysql, sizeof(mysql), "hood='%d',",GetVehicleComponentInSlot(vehicleid,1));
    strcat(string, mysql);
    format(mysql, sizeof(mysql), "roof='%d',",GetVehicleComponentInSlot(vehicleid,2));
    strcat(string, mysql);
    format(mysql, sizeof(mysql), "sideskirt='%d',",GetVehicleComponentInSlot(vehicleid,3));
    strcat(string, mysql);
    format(mysql, sizeof(mysql), "lamps='%d',",GetVehicleComponentInSlot(vehicleid,4));
    strcat(string, mysql);
    format(mysql, sizeof(mysql), "nitro='%d',",GetVehicleComponentInSlot(vehicleid,5));
    strcat(string, mysql);
    format(mysql, sizeof(mysql), "exhaust='%d',",GetVehicleComponentInSlot(vehicleid,6));
    strcat(string, mysql);
    format(mysql, sizeof(mysql), "wheels='%d',",GetVehicleComponentInSlot(vehicleid,7));
    strcat(string, mysql);
    format(mysql, sizeof(mysql), "stereo='%d',",GetVehicleComponentInSlot(vehicleid,8));
    strcat(string, mysql);
    format(mysql, sizeof(mysql), "hydraulics='%d',",GetVehicleComponentInSlot(vehicleid,9));
    strcat(string, mysql);
    format(mysql, sizeof(mysql), "frontbumper='%d',",GetVehicleComponentInSlot(vehicleid,10));
    strcat(string, mysql);
    format(mysql, sizeof(mysql), "rearbumper='%d',",GetVehicleComponentInSlot(vehicleid,11));
    strcat(string, mysql);
    format(mysql, sizeof(mysql), "ventright='%d',",GetVehicleComponentInSlot(vehicleid,12));
    strcat(string, mysql);
    format(mysql, sizeof(mysql), "ventleft='%d',",GetVehicleComponentInSlot(vehicleid,13));
    strcat(string, mysql);
    format(mysql, sizeof(mysql), "oparkx='%f',",CarInfo[vehicleid][oparkx]);
    strcat(string, mysql);
    format(mysql, sizeof(mysql), "oparky='%f',",CarInfo[vehicleid][oparky]);
    strcat(string, mysql);
    format(mysql, sizeof(mysql), "oparkz='%f',",CarInfo[vehicleid][oparkz]);
    strcat(string, mysql);
    format(mysql, sizeof(mysql), "oparka='%f',",CarInfo[vehicleid][oparka]);
    strcat(string, mysql);
    format(mysql, sizeof(mysql), "neon='%d'",CarInfo[vehicleid][neon]);
    strcat(string, mysql);


    new query[999];
    format(query, 999, "UPDATE `autos` SET %s WHERE `besitzer` = '%s_%d'",string,SpielerName(playerid),CarInfo[vehicleid][carslot]);
    mysql_query(query);
    strmid(CarInfo[vehicleid][besitzer], "Staat", 0, strlen("Staat"), 255);
    format(string, sizeof(string), "CarSave: %s_%d",SpielerName(playerid),CarInfo[vehicleid][carslot]);
    print(string);
    CarInfo[vehicleid][Abgeschlossen] = 0;
    CarInfo[vehicleid][oparkx] = 0;
    CarInfo[vehicleid][oparky] = 0;
    CarInfo[vehicleid][oparkz] = 0;
    CarInfo[vehicleid][oparka] = 0;
    CarInfo[vehicleid][neon] = 0;
    CarInfo[vehicleid][Spoiler] = 0;
    CarInfo[vehicleid][Hood] = 0;
    CarInfo[vehicleid][Roof] = 0;
    CarInfo[vehicleid][Sideskirt] = 0;
    CarInfo[vehicleid][Lamps] = 0;
    CarInfo[vehicleid][Nitro] = 0;
    CarInfo[vehicleid][Exhaust] = 0;
    CarInfo[vehicleid][Wheels] = 0;
    CarInfo[vehicleid][Stereo] = 0;
    CarInfo[vehicleid][Hydraulics] = 0;
    CarInfo[vehicleid][FrontBumper] = 0;
    CarInfo[vehicleid][RearBumper] = 0;
    CarInfo[vehicleid][VentRight] = 0;
    CarInfo[vehicleid][VentLeft] = 0;
    ckm[vehicleid] = 0;
    DelNeonFromVeh(vehicleid);
    DestroyVehicle(vehicleid);
    return 1;
    }


    //edit
    push !...

    das "i" ist ja vehicle id und ich kann ja schlecht Abgragen wenn er Disconnectet ob er in einem Fahrzeug sitzt also bei GetPlayerVehicleID müsste er im Car sein beim Ausloggen......


    //edit brauch immer noch Hilfe .

    In der Tabelle von deinen Spieler Autos
    da gibt es das feld carmid nicht



    ouu Fail xD danke :D


    //edit


    Jetzt nur noch ein Problem es werden alle Cars im Spiel gelöscht sobald einer disconnectet ...
    Das habe ich unter OnPlayerDisconnect :



    for (new i=0; i< MAX_VEHICLES; i++)
    {
    if(strcmp(SpielerName(playerid),CarInfo[i][besitzer],true) == 0)
    {
    CarSave(playerid,i);
    //Speichern
    }
    }

    mom muss debug Modus anstellen.... xD


    //edit
    so das ist rausgekommen.... :


    Guten ABend Community,


    Ich habe 2 Probleme beim Autohaus System,


    //edit PRoblem 1 Gelöst gelöscht !


    Und das 2 Problem ist wenn sich ein Spieler ausloggt dann werden alle Autos inGame gelöscht , was eigentlich nur bei den Privat-Cars passieren sollte :



    for (new i=0; i< MAX_VEHICLES; i++)
    {
    if(strcmp(SpielerName(playerid),CarInfo[i][besitzer],true) == 0)
    {
    CarSave(playerid,i);
    //Speichern
    }
    }


    Ich hoffe ihr könnt mir bissl weiterhelfen