Auf Mysql bassieren

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
  • Hallo,
    da ich noch nicht soviel erfahrung mit Mysql habe und gerne auf Mysql langsam umsteigen würde würde ich gerne wissen wie ich z,B. die Fraktionsfahrzeuge Laden/Speichern kann durch Mysql


    public DestroyAndCreateFactionCar(fc)
    {
    if(FactionCars[fc][fVehid] >= 400 && FactionCars[fc][fVehid] <= 611)
    {
    new bool:unwanted[CAR_AMOUNT];
    for(new player=0; player<MAX_PLAYERS; player++)
    {
    if(IsPlayerInAnyVehicle(player)) { unwanted[GetPlayerVehicleID(player)]=true; }
    }
    if(!unwanted[FactionCars[fc][fCarid]]) DestroyVehicle(FactionCars[fc][fCarid]);
    if(!unwanted[FactionCars[fc][fVehid]]) CreateVehicle(FactionCars[fc][fVehid],FactionCars[fc][fPos][0],FactionCars[fc][fPos][1],FactionCars[fc][fPos][2],FactionCars[fc][fPos][3],FactionCars[fc][fCol][0],FactionCars[fc][fCol][1],-255);
    //FactionCars[fc][fCarid] = CreateVehicle(FactionCars[fc][fVehid],FactionCars[fc][fPos][0],FactionCars[fc][fPos][1],FactionCars[fc][fPos][2],FactionCars[fc][fPos][3],FactionCars[fc][fCol][0],FactionCars[fc][fCol][1],-255);
    #if defined FACTION_CARS_TUNEABLE
    LockFactionCarDoors();
    // LockFactionCarDoors();
    if(IsAllowedFactionToTune(FactionCars[fc][fFaction][0]))
    {
    if(FactionCars[fc][fTuning][0] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][0]); }
    if(FactionCars[fc][fTuning][1] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][1]); }
    if(FactionCars[fc][fTuning][2] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][2]); }
    if(FactionCars[fc][fTuning][3] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][3]); }
    if(FactionCars[fc][fTuning][4] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][4]); }
    if(FactionCars[fc][fTuning][5] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][5]); }
    if(FactionCars[fc][fTuning][6] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][6]); }
    if(FactionCars[fc][fTuning][7] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][7]); }
    if(FactionCars[fc][fTuning][8] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][8]); }
    if(FactionCars[fc][fTuning][9] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][9]); }
    if(FactionCars[fc][fTuning][10] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][10]); }
    if(FactionCars[fc][fTuning][11] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][11]); }
    if(FactionCars[fc][fTuning][12] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][12]); }
    if(FactionCars[fc][fTuning][13] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][13]); }
    }
    #endif
    }return true;
    }
    public LoadFactionCars(){
    if(!fexist(FACTION_CAR_FILE)){
    new File:tfFile=fopen(FACTION_CAR_FILE,io_write);
    fclose(tfFile);
    }
    new File:fFile=fopen(FACTION_CAR_FILE,io_read),Content[1024],fc;
    while(fread(fFile,Content) && fc<sizeof(FactionCars)){
    StripNewLine(Content);
    sscanf(Content,"dffffdddddddddddddddddddddd",
    FactionCars[fc][fVehid],
    FactionCars[fc][fPos][0],
    FactionCars[fc][fPos][1],
    FactionCars[fc][fPos][2],
    FactionCars[fc][fPos][3],
    FactionCars[fc][fCol][0],
    FactionCars[fc][fCol][1],
    FactionCars[fc][fFaction][0],
    FactionCars[fc][fFaction][1],
    FactionCars[fc][fFaction][2],
    FactionCars[fc][fFaction][3],
    FactionCars[fc][fFaction][4],
    FactionCars[fc][fTuning][0],
    FactionCars[fc][fTuning][1],
    FactionCars[fc][fTuning][2],
    FactionCars[fc][fTuning][3],
    FactionCars[fc][fTuning][4],
    FactionCars[fc][fTuning][5],
    FactionCars[fc][fTuning][6],
    FactionCars[fc][fTuning][7],
    FactionCars[fc][fTuning][8],
    FactionCars[fc][fTuning][9],
    FactionCars[fc][fTuning][10],
    FactionCars[fc][fTuning][11],
    FactionCars[fc][fTuning][12],
    FactionCars[fc][fTuning][13],
    FactionCars[fc][fPrice]);
    if(FactionCars[fc][fVehid] >= 400 && FactionCars[fc][fVehid] <= 611){
    FactionCars[fc][fCarid] = CreateVehicle(FactionCars[fc][fVehid],FactionCars[fc][fPos][0],FactionCars[fc][fPos][1],FactionCars[fc][fPos][2],FactionCars[fc][fPos][3],FactionCars[fc][fCol][0],FactionCars[fc][fCol][1],-255);
    fLockCar(FactionCars[fc][fCarid]);
    FactionCars[fc][fLock] = true;
    // LockFactionCarDoors();
    if(IsAllowedFactionToTune(FactionCars[fc][fFaction][0])){
    if(FactionCars[fc][fTuning][0] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][0]); }
    if(FactionCars[fc][fTuning][1] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][1]); }
    if(FactionCars[fc][fTuning][2] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][2]); }
    if(FactionCars[fc][fTuning][3] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][3]); }
    if(FactionCars[fc][fTuning][4] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][4]); }
    if(FactionCars[fc][fTuning][5] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][5]); }
    if(FactionCars[fc][fTuning][6] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][6]); }
    if(FactionCars[fc][fTuning][7] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][7]); }
    if(FactionCars[fc][fTuning][8] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][8]); }
    if(FactionCars[fc][fTuning][9] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][9]); }
    if(FactionCars[fc][fTuning][10] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][10]); }
    if(FactionCars[fc][fTuning][11] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][11]); }
    if(FactionCars[fc][fTuning][12] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][12]); }
    if(FactionCars[fc][fTuning][13] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][13]); }
    }
    fc++;
    }
    }fclose(fFile);
    return printf("'%d' Fraktionsfahrzeuge wurden geladen & erstellt.",fc);
    }
    public SaveFactionCars(bool:destroy){
    if(fexist(FACTION_CAR_FILE)) fremove(FACTION_CAR_FILE);
    new File:fFile=fopen(FACTION_CAR_FILE,io_append),Content[1024];
    for(new fc;fc<sizeof(FactionCars);fc++){
    if(FactionCars[fc][fVehid] >= 400 && FactionCars[fc][fVehid] <= 611){
    format(Content,sizeof(Content),"%d %.3f %.3f %.3f %.3f %03d %03d %02d %02d %02d %02d %02d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d\r\n",
    FactionCars[fc][fVehid],
    FactionCars[fc][fPos][0],
    FactionCars[fc][fPos][1],
    FactionCars[fc][fPos][2],
    FactionCars[fc][fPos][3],
    FactionCars[fc][fCol][0],
    FactionCars[fc][fCol][1],
    FactionCars[fc][fFaction][0],
    FactionCars[fc][fFaction][1],
    FactionCars[fc][fFaction][2],
    FactionCars[fc][fFaction][3],
    FactionCars[fc][fFaction][4],
    FactionCars[fc][fTuning][0],
    FactionCars[fc][fTuning][1],
    FactionCars[fc][fTuning][2],
    FactionCars[fc][fTuning][3],
    FactionCars[fc][fTuning][4],
    FactionCars[fc][fTuning][5],
    FactionCars[fc][fTuning][6],
    FactionCars[fc][fTuning][7],
    FactionCars[fc][fTuning][8],
    FactionCars[fc][fTuning][9],
    FactionCars[fc][fTuning][10],
    FactionCars[fc][fTuning][11],
    FactionCars[fc][fTuning][12],
    FactionCars[fc][fTuning][13],
    FactionCars[fc][fPrice]);
    fwrite(fFile,Content);
    if(destroy == true){
    if(DestroyVehicle(FactionCars[fc][fCarid]))
    FactionCars[fc][fCarid] = -255;
    }
    }
    }fclose(fFile);
    return true;
    }

    German Projekt Reallife

    87.98.244.35:3434