Beiträge von aytef

    Firerfan: Hier bitte


    Der Speicherbefehl:

    if(strcmp("/saveall", cmd, true) == 0)
    {
    if(IsPlayerConnected(playerid))
    {
    if(PlayerInfo[playerid][pAdmin] >= 5)
    {
    SaveAll();
    return 1;
    }
    else
    {
    SendClientMessage(playerid, COLOR_KEINADMIN, "*** INFO: Dies ist ein Adminbefehl, du bist kein Admin.");
    }
    }
    return 1;
    }


    Die SaveAll Funktion:

    public SaveAll()
    {
    SendClientMessageToAll(COLOR_ORANGE,""#SERVERFARBE"ACHTUNG! Server wird nur gespeichert, es kann zu kleinen Laggs führen!");
    SavePlayers();
    SaveServer();
    SendClientMessageToAll(COLOR_GRAD2,"Server erfolgreich gespeichert!");
    return 1;
    }


    Die Anderen Funktionen
    - SaveServer

    public SaveServer()
    {
    OnPropUpdate();
    SaveKassenInfo();
    SaveGangAutos();
    SaveStuff();
    SaveGangfightZones();
    SaveGangWarInfos();
    SaveGangmotd();
    SaveGangBNDInfos();
    return 1;
    }


    - SavePlayers

    public SavePlayers()
    {
    ForAllPlayers(i){
    if(IsPlayerConnected(i) && gPlayerLogged[i]){
    if(strcmp(PlayerInfo[i][pForceName], "Niemand", true) != 0)
    {
    SetPlayerName(i,PlayerInfo[i][pForceName]);
    SetPlayerScore(i, PlayerInfo[i][pLevel]);
    }
    PlayerUpdate(i);
    PlayerCarUpdate(i);
    }
    }
    return 1;
    }


    - OnPropUpdate

    public OnPropUpdate()
    {
    new string[128];
    for(new i = 0; i < sizeof(HouseInfo); i++)
    {
    format(string, sizeof(string),"SELECT * FROM `haeuser` WHERE `HouseID` = '%d'", i);
    self_mysql_query(string);
    mysql_store_result(MySQLConnection);
    if(mysql_num_rows(MySQLConnection) == 0)
    {
    format(string, sizeof(string), "INSERT INTO `haeuser` (`HouseID`) VALUES ('%d')", i);
    self_mysql_query(string);
    }
    mysql_free_result(MySQLConnection);
    new var[768];
    format(var, sizeof(var), "UPDATE `haeuser` SET `Owner`='%s', `Beschreibung`='%s', `Preis`='%d', `HealUpgrade`='%d', `ArmorUpgrade`='%d', `Lock`='%d', `Owned`='%d', `Rooms`='%d', `Rent`='%d', `Rentabil`='%d', `Kasse`='%d', `Level`='%d' WHERE `HouseID`='%d'",
    HouseInfo[i][hOwner],
    HouseInfo[i][hBeschreibung],
    HouseInfo[i][hPreis],
    HouseInfo[i][hHealUpgrade],
    HouseInfo[i][hArmorUpgrade],
    HouseInfo[i][hLock],
    HouseInfo[i][hOwned],
    HouseInfo[i][hRooms],
    HouseInfo[i][hRent],
    HouseInfo[i][hRentabil],
    HouseInfo[i][hKasse],
    //HouseInfo[i][hDate],
    HouseInfo[i][hLevel],
    i);
    self_mysql_query(var);
    }
    for(new i = 0; i < sizeof(BizInfo); i++) //MySQL Speicherung
    {
    format(string, sizeof(string),"SELECT * FROM `buissnes` WHERE `BizID` = '%d'", i);
    self_mysql_query(string);
    mysql_store_result(MySQLConnection);
    if(mysql_num_rows(MySQLConnection) == 0)
    {
    format(string, sizeof(string), "INSERT INTO `buissnes` (`BizID`) VALUES ('%d')", i);
    self_mysql_query(string);
    }
    mysql_free_result(MySQLConnection);
    new var[768];
    format(var, sizeof(var), "UPDATE `buissnes` SET `Owned`='%d', `Owner`='%s', `Message`='%s', `Extortion`='%s', `LevelNeeded`='%d', `BuyPrice`='%d', `EntranceCost`='%d', `Till`='%d', `Locked`='%d', `Products`='%d', `MaxProducts`='%d', `PriceProd`='%d' WHERE `BizID`='%d'",
    BizInfo[i][bOwned],
    BizInfo[i][bOwner],
    BizInfo[i][bMessage],
    BizInfo[i][bExtortion],
    BizInfo[i][bLevelNeeded],
    BizInfo[i][bBuyPrice],
    BizInfo[i][bEntranceCost],
    BizInfo[i][bTill],
    BizInfo[i][bLocked],
    BizInfo[i][bProducts],
    BizInfo[i][bMaxProducts],
    BizInfo[i][bPriceProd],
    i);
    self_mysql_query(var);
    }
    for(new i = 0; i < sizeof(SBizInfo); i++)
    {
    format(string, sizeof(string),"SELECT * FROM `sbuissnes` WHERE `SBizID` = '%d'", i);
    self_mysql_query(string);
    mysql_store_result(MySQLConnection);
    if(mysql_num_rows(MySQLConnection) == 0)
    {
    format(string, sizeof(string), "INSERT INTO `sbuissnes` (`SBizID`) VALUES ('%d')", i);
    self_mysql_query(string);
    }
    mysql_free_result(MySQLConnection);
    new var[768];
    format(var, sizeof(var), "UPDATE `sbuissnes` SET `Owned`='%d', `Owner`='%s', `Message`='%s', `Extortion`='%s', `LevelNeeded`='%d', `BuyPrice`='%d', `EntranceCost`='%d', `Till`='%d', `Locked`='%d', `Products`='%d', `MaxProducts`='%d', `PriceProd`='%d' WHERE `SBizID`='%d'",
    SBizInfo[i][sbOwned],
    SBizInfo[i][sbOwner],
    SBizInfo[i][sbMessage],
    SBizInfo[i][sbExtortion],
    SBizInfo[i][sbLevelNeeded],
    SBizInfo[i][sbBuyPrice],
    SBizInfo[i][sbEntranceCost],
    SBizInfo[i][sbTill],
    SBizInfo[i][sbLocked],
    SBizInfo[i][sbProducts],
    SBizInfo[i][sbMaxProducts],
    SBizInfo[i][sbPriceProd],
    i);
    self_mysql_query(var);
    }
    for(new i = 0; i < sizeof(TankenBizInfo); i++)
    {
    format(string, sizeof(string),"SELECT * FROM `tankstellen` WHERE `TankenBizID` = '%d'", i);
    self_mysql_query(string);
    mysql_store_result(MySQLConnection);
    if(mysql_num_rows(MySQLConnection) == 0)
    {
    format(string, sizeof(string), "INSERT INTO `tankstellen` (`TankenBizID`) VALUES ('%d')", i);
    self_mysql_query(string);
    }
    mysql_free_result(MySQLConnection);
    new var[768];
    format(var, sizeof(var), "UPDATE `tankstellen` SET `Owned`='%d', `Owner`='%s', `Message`='%s', `Extortion`='%s', `LevelNeeded`='%d', `KaufPreis`='%d', `SpritPreis`='%d', `Kasse`='%d', `Locked`='%d', `Products`='%d', `MaxProducts`='%d', `ProdPreis`='%d' WHERE `TankenBizID`='%d'",
    TankenBizInfo[i][TBOwned],
    TankenBizInfo[i][TBOwner],
    TankenBizInfo[i][TBMessage],
    TankenBizInfo[i][TBExtortion],
    TankenBizInfo[i][TBLevelNeeded],
    TankenBizInfo[i][TBKaufPreis],
    TankenBizInfo[i][TBSpritPreis],
    TankenBizInfo[i][TBKasse],
    TankenBizInfo[i][TBLocked],
    TankenBizInfo[i][TBProducts],
    TankenBizInfo[i][TBMaxProducts],
    TankenBizInfo[i][TBProdPreis],
    i);
    self_mysql_query(var);
    }
    return 1;
    }


    - Gangautos

    public SaveGangAutos()
    {
    new string[128];
    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);
    }
    return 1;
    }