Beiträge von EnzO_SalvatorE

    Meinst du das hier ?


    Oder das hier?

    Ich habe jetzt die Tabelle gelöscht und neu erstellen lassen daraufhin erneut 3 Autos gekauft doch immer noch das gleiche Problem das, dass erste Auto nicht gepspeichert wird

    http://250kb.de/u/160115/p/A4B34UBzajY8.png
    http://250kb.de/u/160115/p/u0o4lUf4ztqG.png


    So sieht alles grade aus


    public LoadGangAutos()
    {
    if(SaveServerMySQL == 0)
    {
    new arrCoords[14][64];
    new strFromFile2[256];
    new File: file = fopen("Configs/cars.cfg", io_read);
    if (file)
    {
    new idx;
    while (idx < sizeof(GangAutoInfo)){
    fread(file, strFromFile2);
    split(strFromFile2, arrCoords, '|');
    GangAutoInfo[idx][cID] = strval(arrCoords[0]);
    GangAutoInfo[idx][cOwner] = strval(arrCoords[1]);
    GangAutoInfo[idx][cTyp] = strval(arrCoords[2]);
    GangAutoInfo[idx][cPosX] = floatstr(arrCoords[3]);
    GangAutoInfo[idx][cPosY] = floatstr(arrCoords[4]);
    GangAutoInfo[idx][cPosZ] = floatstr(arrCoords[5]);
    GangAutoInfo[idx][cRot] = floatstr(arrCoords[6]);
    GangAutoInfo[idx][cColor1] = strval(arrCoords[7]);
    GangAutoInfo[idx][cColor2] = strval(arrCoords[8]);
    GangAutoInfo[idx][cStatus] = strval(arrCoords[9]);
    GangAutoInfo[idx][cTank] = strval(arrCoords[10]);
    GangAutoInfo[idx][cReSpawnTime] = strval(arrCoords[11]);
    GangAutoInfo[idx][cStandTime] = strval(arrCoords[12]);
    GangAutoInfo[idx][cMeter] = strval(arrCoords[13]);
    if(GangAutoInfo[idx][cStandTime] == 0)
    {
    GangAutoInfo[idx][cStandTime] = Time();
    }
    idx++;
    }
    fclose(file);
    }
    }
    else
    {
    new string[128];
    for(new i = 0; i < sizeof(GangAutoInfo); i++)
    {
    format(string, sizeof(string),"SELECT * FROM `gangautos` WHERE `SlotID` = '%d'", i);
    self_mysql_query(string);
    mysql_store_result(MySQLConnection);
    if(mysql_num_rows(MySQLConnection) != 0)
    {
    mysql_fetch_row_format(string);
    new val[ 256 ];
    self_mysql_get_field("CarID", val); GangAutoInfo[i][cID] = strval( val );
    self_mysql_get_field("OwnerID", val); GangAutoInfo[i][cOwner] = strval( val );
    self_mysql_get_field("TypID", val); GangAutoInfo[i][cTyp] = strval( val );
    self_mysql_get_field("PosX", val); GangAutoInfo[i][cPosX] = floatstr( val );
    self_mysql_get_field("PosY", val); GangAutoInfo[i][cPosY] = floatstr( val );
    self_mysql_get_field("PosZ", val); GangAutoInfo[i][cPosZ] = floatstr( val );
    self_mysql_get_field("Rotation", val); GangAutoInfo[i][cRot] = floatstr( val );
    self_mysql_get_field("Farbe1", val); GangAutoInfo[i][cColor1] = strval( val );
    self_mysql_get_field("Farbe2", val); GangAutoInfo[i][cColor2] = strval( val );
    self_mysql_get_field("Status", val); GangAutoInfo[i][cStatus] = strval( val );
    self_mysql_get_field("Tank", val); GangAutoInfo[i][cTank] = strval( val );
    self_mysql_get_field("ReSpawnTime", val); GangAutoInfo[i][cReSpawnTime] = strval( val );
    //self_mysql_get_field("StandTime", val); GangAutoInfo[i][cStandTime] = strval( val );
    }
    else
    {
    GangAutoInfo[i][cID] = -1;
    GangAutoInfo[i][cOwner] = -1;
    GangAutoInfo[i][cTyp] = -1;
    GangAutoInfo[i][cPosX] = 0;
    GangAutoInfo[i][cPosY] = 0;
    GangAutoInfo[i][cPosZ] = 0;
    GangAutoInfo[i][cRot] = 0;
    GangAutoInfo[i][cColor1] = -1;
    GangAutoInfo[i][cColor2] = -1;
    GangAutoInfo[i][cStatus] = -1;
    GangAutoInfo[i][cTank] = 50;
    GangAutoInfo[i][cReSpawnTime] = 1800;
    GangAutoInfo[i][cStandTime] = 0;
    }
    mysql_free_result(MySQLConnection);
    if(GangAutoInfo[i][cID] == 65535)
    {
    GangAutoInfo[i][cID] = -1;
    }
    }
    }
    return 1;
    }

    Also das läuft so ab ich kaufe zum Beispiel jetzt 3 Autos die spawnen auch ganz normal nur nachdem Serverrestart ist das erst gekaufte Fahrezeug weg und die 2 daraufhin gekauften Fahrzeuge sind da.
    Und das passiert immer wieder beim Kauf.


    public CreateGangAutos()
    {
    for(new h = 0; h < sizeof(GangAutoInfo); h++){
    if(GangAutoInfo[h][cTyp] != -1){
    if(GangAutoInfo[h][cStatus] == 0){
    GangAutoInfo[h][cID] = CreateVehicle(GangAutoInfo[h][cTyp],GangAutoInfo[h][cPosX],GangAutoInfo[h][cPosY],GangAutoInfo[h][cPosZ],GangAutoInfo[h][cRot],GangAutoInfo[h][cColor1],GangAutoInfo[h][cColor2],GangAutoInfo[h][cReSpawnTime]);
    Gas[GangAutoInfo[h][cID]] = GangAutoInfo[h][cTank];
    new string[50];
    format(string, sizeof(string), "{FFFF00}ir-{21DD00}%d", GangAutoInfo[h][cID]);
    SetVehicleNumberPlate(GangAutoInfo[h][cID],string);
    }}}
    return 1;
    }



    public CreateNewlyGangAutos(GCarID)
    {
    if(GangAutoInfo[GCarID][cTyp] != -1)
    {
    if(GangAutoInfo[GCarID][cID] == -1)
    {
    if(GangAutoInfo[GCarID][cStatus] == 0)
    {
    GangAutoInfo[GCarID][cID] = CreateVehicle(GangAutoInfo[GCarID][cTyp],GangAutoInfo[GCarID][cPosX],GangAutoInfo[GCarID][cPosY],GangAutoInfo[GCarID][cPosZ],GangAutoInfo[GCarID][cRot],GangAutoInfo[GCarID][cColor1],GangAutoInfo[GCarID][cColor2],GangAutoInfo[GCarID][cReSpawnTime]);
    Gas[GangAutoInfo[GCarID][cID]] = GangAutoInfo[GCarID][cTank];
    new string[50];
    format(string, sizeof(string), "{FFFF00}ir-{21DD00}%d", GangAutoInfo[GCarID][cID]);
    SetVehicleNumberPlate(GangAutoInfo[GCarID][cID],string);
    }
    }
    }return 1;
    }


    if(strcmp("/buygangcar", cmd, true) == 0)
    {
    if(PlayerInfo[playerid][pLeader] != -1 || PlayerInfo[playerid][pRank] == 12)
    {
    new Farbe,
    GangCars = 0;
    if(PlayerInfo[playerid][pTeam] == 4 || PlayerInfo[playerid][pTeam] == 14 || PlayerInfo[playerid][pTeam] == 7 || PlayerInfo[playerid][pTeam] == 16)
    {
    SendClientMessage(playerid, COLOR_ERRORTEXT, " Deine Fraktion ist nicht Berechtigt Gangautos zu Kaufen.");
    return 1;
    }
    if(IsPlayerInAnyVehicle(playerid) && GangAutoSpectating[playerid] != -1)
    {
    new GangAutoPreis = GangAutoKaufliste[GangAutoSpectating[playerid]][GAPreis];
    if(GangAutoPreis >= KassenInfo[PlayerInfo[playerid][pTeam]][tKasse])
    {
    SendClientMessage(playerid, COLOR_ERRORTEXT, " Es ist nicht mehr genug Geld in der Teamkasse !");
    return 1;
    }
    else
    {
    if(PlayerInfo[playerid][pTeam] == 1)
    {
    Farbe = 0;
    }
    if(PlayerInfo[playerid][pTeam] == 2)
    {
    Farbe = 154;
    }
    if(PlayerInfo[playerid][pTeam] == 3)
    {
    Farbe = 120;
    }
    if(PlayerInfo[playerid][pTeam] == 4)
    {
    Farbe = 3;
    }
    if(PlayerInfo[playerid][pTeam] == 5)
    {
    Farbe = 0;
    }
    if(PlayerInfo[playerid][pTeam] == 6)
    {
    Farbe = 8;
    }
    if(PlayerInfo[playerid][pTeam] == 7)
    {
    Farbe = -1;
    }
    if(PlayerInfo[playerid][pTeam] == 8)
    {
    Farbe = -1;
    }
    if(PlayerInfo[playerid][pTeam] == 9)
    {
    Farbe = 61;
    }
    if(PlayerInfo[playerid][pTeam] == 10)
    {
    Farbe = -1;
    }
    if(PlayerInfo[playerid][pTeam] == 11)
    {
    Farbe = 1;
    }
    if(PlayerInfo[playerid][pTeam] == 12)
    {
    Farbe = 0;
    }
    if(PlayerInfo[playerid][pTeam] == 13)
    {
    Farbe = 1;
    }
    if(PlayerInfo[playerid][pTeam] == 14)
    {
    Farbe = -1;
    }
    if(PlayerInfo[playerid][pTeam] == 15)
    {
    Farbe = 0;
    }
    if(PlayerInfo[playerid][pTeam] == 16)
    {
    Farbe = -1;
    }
    if(PlayerInfo[playerid][pTeam] == 17)
    {
    Farbe = 152;
    }
    if(PlayerInfo[playerid][pTeam] == 18)
    {
    Farbe = 93;
    }
    if(PlayerInfo[playerid][pTeam] == 19)
    {
    Farbe = 86;
    }
    if(PlayerInfo[playerid][pTeam] == 20)
    {
    Farbe = 85;
    }
    if(PlayerInfo[playerid][pTeam] == 21)
    {
    Farbe = 66;
    }
    if(PlayerInfo[playerid][pTeam] == 22)
    {
    Farbe = 79;
    }
    if(PlayerInfo[playerid][pTeam] == 23)
    {
    Farbe = 3;
    }
    if(PlayerInfo[playerid][pTeam] == 24)
    {
    Farbe = 6;
    }
    if(PlayerInfo[playerid][pTeam] == 25)
    {
    Farbe = 104;
    }
    if(PlayerInfo[playerid][pTeam] == 26)
    {
    Farbe = 123;
    }
    for(new h = 0; h < sizeof(GangAutoInfo); h++){
    if(GangAutoInfo[h][cOwner] == PlayerInfo[playerid][pTeam])
    {
    GangCars += 1;
    }
    if(GangCars >= 25)
    {
    SendClientMessage(playerid, COLOR_ERRORTEXT, " Deine Gang hat schon 25 Gangautos!");
    return 1;
    }
    }
    for(new h = 0; h < sizeof(GangAutoInfo); h++){
    if(GangAutoInfo[h][cOwner] == -1 && GangAutoInfo[h][cTyp] == -1 && GangAutoInfo[h][cColor1] == -1 && GangAutoInfo[h][cColor2] == -1){
    GangAutoInfo[h][cOwner] = PlayerInfo[playerid][pTeam];
    GangAutoInfo[h][cID] = -1;
    GangAutoInfo[h][cTyp] = GangAutoKaufliste[GangAutoSpectating[playerid]][GAModelid];
    new Zufall = random(4);
    if(Zufall == 0)
    {
    GangAutoInfo[h][cPosX] = 391;
    GangAutoInfo[h][cPosY] = 2442;
    GangAutoInfo[h][cPosZ] = 18;
    }
    else if(Zufall == 1)
    {
    GangAutoInfo[h][cPosX] = 401;
    GangAutoInfo[h][cPosY] = 2442;
    GangAutoInfo[h][cPosZ] = 18;
    }
    else if(Zufall == 2)
    {
    GangAutoInfo[h][cPosX] = 411;
    GangAutoInfo[h][cPosY] = 2442;
    GangAutoInfo[h][cPosZ] = 18;
    }
    else
    {
    GangAutoInfo[h][cPosX] = 421;
    GangAutoInfo[h][cPosY] = 2442;
    GangAutoInfo[h][cPosZ] = 18;
    }
    GangAutoInfo[h][cRot] = 90;
    GangAutoInfo[h][cColor1] = Farbe;
    GangAutoInfo[h][cColor2] = Farbe;
    GangAutoInfo[h][cStatus] = 0;
    GangAutoInfo[h][cTank] = 100;
    GangAutoInfo[h][cMeter] = 0;
    CreateNewlyGangAutos(h);
    KassenInfo[PlayerInfo[playerid][pTeam]][tKasse] -= GangAutoPreis;
    format(string, sizeof(string), "Gang Car erfolgreich gekauft für %s$, das Geld wurde von der Teamkasse abgezogen.", GetPoint(GangAutoPreis));
    SendClientMessage(playerid, COLOR_YELLOW, string);
    SetPlayerCheckpoint(playerid,403.7779,2478.6750,16.4844,5.0);
    SendClientMessage(playerid, COLOR_GRAD2,"Du Kannst dir das Fahrzeug am roten Checkpoint abholen.");
    TogglePlayerControllable(playerid,1);
    ForAllPlayers(i){
    if(IsPlayerConnected(i)){
    SetVehicleParamsForPlayer(GangAutoKaufliste[GangAutoSpectating[playerid]][GACarid],i,0,0);
    }}
    GangAutoSpectating[playerid] = -1;
    RemovePlayerFromVehicle(playerid);
    break;
    }
    }
    }
    }
    else
    {
    SendClientMessage(playerid, COLOR_ERRORTEXT, " Du besichtigst kein Gang Auto !");
    return 1;
    }
    }
    else
    {
    SendClientMessage(playerid, COLOR_ERRORTEXT, " Du bist kein Leader !");
    return 1;
    }
    return 1;
    }

    Ich weiß nicht ob das ,dass ist was du meinst

    Schönen Guten Tag Breadfish Community,
    und zwar beinhaltet mein Script ein Gangautosystem was auf Mysql basiert.
    Das Problem besteht darin das, dass erst gekaufte Gangauto nicht in die Datenbank gespeichert wird sondern nur die darauf gefolgten Fahrzeuge.


    Ich bitte um Hilfe bei diesem Problem :)


    Mit freundichen Grüßen
    Enzo Salvatore



    public SaveGangAutos()
    {
    if(SaveServerMySQL == 0)
    {
    new idx;
    new File: file2;
    idx = 0;
    while (idx < sizeof(GangAutoInfo))
    {
    if(TankSave == 1)
    {
    if(GangAutoInfo[idx][cID] != -1)
    {
    GangAutoInfo[idx][cTank] = Gas[GangAutoInfo[idx][cID]];
    }
    }
    new coordsstring[128];
    format(coordsstring, sizeof(coordsstring), "%d|%d|%d|%f|%f|%f|%f|%d|%d|%d|%d|%d|%d|%d\n",
    GangAutoInfo[idx][cID],
    GangAutoInfo[idx][cOwner],
    GangAutoInfo[idx][cTyp],
    GangAutoInfo[idx][cPosX],
    GangAutoInfo[idx][cPosY],
    GangAutoInfo[idx][cPosZ],
    GangAutoInfo[idx][cRot],
    GangAutoInfo[idx][cColor1],
    GangAutoInfo[idx][cColor2],
    GangAutoInfo[idx][cStatus],
    GangAutoInfo[idx][cTank],
    GangAutoInfo[idx][cReSpawnTime],
    GangAutoInfo[idx][cStandTime],
    GangAutoInfo[idx][cMeter]);
    if(idx == 0)
    {
    file2 = fopen("Configs/cars.cfg", io_write);
    }
    else
    {
    file2 = fopen("Configs/cars.cfg", io_append);
    }
    fwrite(file2, coordsstring);
    idx++;
    fclose(file2);
    }
    print("GangAutos Geladen");
    }
    else
    {
    new string[256];
    for(new i = 0; i < sizeof(GangAutoInfo); i++)
    {
    if(TankSave == 1)
    {
    if(GangAutoInfo[i][cID] != -1)
    {
    GangAutoInfo[i][cTank] = Gas[GangAutoInfo[i][cID]];
    }
    }
    format(string, sizeof(string), "SELECT * FROM `gangautos` WHERE `SlotID` = '%d'", i);
    self_mysql_query(string);
    mysql_store_result(MySQLConnection);
    if(mysql_num_rows(MySQLConnection) == 0)
    {
    format(string, sizeof(string), "INSERT INTO `gangautos` (`SlotID`) VALUES ('%d')", i);
    self_mysql_query(string);
    }
    mysql_free_result(MySQLConnection);
    new var[256];
    format(var, sizeof(var), "UPDATE `gangautos` SET `CarID`='%d', `OwnerID`='%d', `TypID`='%d', `PosX`='%.1f', `PosY`='%.1f', `PosZ`='%.1f', `Rotation`='%.1f', `Farbe1`='%d', `Farbe2`='%d', `Status`='%d', `Tank`='%d', `ReSpawnTime`='%d' WHERE `SlotID`='%d'",
    GangAutoInfo[i][cID],
    GangAutoInfo[i][cOwner],
    GangAutoInfo[i][cTyp],
    GangAutoInfo[i][cPosX],
    GangAutoInfo[i][cPosY],
    GangAutoInfo[i][cPosZ],
    GangAutoInfo[i][cRot],
    GangAutoInfo[i][cColor1],
    GangAutoInfo[i][cColor2],
    GangAutoInfo[i][cStatus],
    GangAutoInfo[i][cTank],
    GangAutoInfo[i][cReSpawnTime],
    //GangAutoInfo[i][cStandTime],
    i);
    self_mysql_query(var);
    }
    print("GangAutos Geladen");
    }
    return 1;
    }