Haus wird nicht geupdatet.

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
  • Warum setzt er hier alles falsch beim Befehl: /hauskaufen
    [14:51:53][DEBUG] mysql_tquery - connection: 1, query: "UPDATE db_hauser SETOwner = 'Niemand', Sell='0', Rent='0', Pric", callback: "(null)",format: "(null)"
    [14:51:53] [DEBUG] CMySQLQuery::Execute[] - starting query execution
    [14:51:54] [DEBUG] CMySQLQuery::Execute[] - query was successfully executed within 19.295 milliseconds
    [14:51:54] [DEBUG] CMySQLQuery::Execute[] - no callback specified, skipping result saving


    COMMAND:hauskaufen(playerid)
    {
    if(Spieler[playerid][Eingeloggt] == 0) return SendClientMessage(playerid,ROT,"Du bist nicht Eingeloggt!");
    if(Spieler[playerid][pAFK] == 1)return SendClientMessage(playerid,WRONGCMD,"Du bist AFK. Benutze /back");
    if(Spieler[playerid][pGetazert] == 1) return SendClientMessage(playerid,ROT,"Du bist getazert!");
    new uMoney = Spieler[playerid][pGeld], HouseText[275], HouseIText[120];

    if(Spieler[playerid][pHouseID] != defaulth &&
    Spieler[playerid][pMieter] != defaulth) return
    SendClientMessage(playerid,ROT,"Du besitzt schon ein Haus
    (/hausverkaufen) oder bist in einem Haus eingemietet (/ausmieten)!");
    for(new houseID = 0; houseID < MAX_HOUSE; houseID++)
    {


    if(IsPlayerInRangeOfPoint(playerid,5.0,HouseInfo[houseID][hPos][0],HouseInfo[houseID][hPos][1],HouseInfo[houseID][hPos][2]))
    {
    if(HouseInfo[houseID][hSell] == 1) return SendClientMessage(playerid,ROT,"Dieses Haus kannst du nicht kaufen!");
    if(uMoney < HouseInfo[houseID][hPrice]) return SendClientMessage(playerid,ROT,"Dieses Haus kannst du dir nicht leisten!");

    if(Spieler[playerid][pLevel] < HouseInfo[houseID][hLevel]) return
    SendClientMessage(playerid,ROT,"Dein Level ist zu niedrig!");
    format( HouseInfo[houseID][hOwner], 35, "%s", Spieler[playerid][pName]);
    HouseInfo[houseID][hSell] = 1;
    HouseInfo[houseID][hMietPreis] = 500;
    Delete3DTextLabel(HouseInfo[houseID][hText]);

    format(HouseText,sizeof(HouseText),""#HTML_LOGIN"HausID:
    %i\n"#HTML_LOGIN"Hausbesitzer: "#HTML_WHITE"%s\n"#HTML_LOGIN"Mietpreis:
    "#HTML_WHITE"%i$\n"#HTML_LOGIN"Mieter:"#HTML_WHITE"%i/%i\n"#HTML_LOGIN"Müll:"#HTML_WHITE"%d\n\nUm
    dich einzumieten benutze /einmieten"#HTML_WHITE" ein!\nZum Betreten
    'F'", HouseInfo[houseID][hID], HouseInfo[houseID][hOwner],
    HouseInfo[houseID][hMietPreis], HouseInfo[houseID][hRentcount],
    HouseInfo[houseID][hMaxRent], HouseInfo[houseID][hMuell]);

    HouseInfo[houseID][hText] = Create3DTextLabel(HouseText, WEISS,
    HouseInfo[houseID][hPos][0], HouseInfo[houseID][hPos][1],
    HouseInfo[houseID][hPos][2], 10, 0);

    DestroyDynamicPickup(HouseInfo[houseID][hPickup]);

    HouseInfo[houseID][hPickup] = CreateDynamicPickup(1272, 1,
    HouseInfo[houseID][hPos][0], HouseInfo[houseID][hPos][1],
    HouseInfo[houseID][hPos][2],0);
    Spieler[playerid][pHouseID] = houseID;
    ACMoney(playerid, -HouseInfo[houseID][hPrice]);
    ERTextHide(playerid);

    format(HouseIText,sizeof(HouseIText),"Haus
    gekauft:~n~ID:%d~n~Name:%s~n~Preis:%d",HouseInfo[houseID][hID],
    HouseInfo[houseID][hOwner], HouseInfo[houseID][hPrice]);
    ERText(playerid,HouseIText,5000);
    SaveHouse(HouseInfo[houseID][hID]);
    }
    }
    return true;
    }


    stock SaveHouse(sid)
    {
    new query[500];

    format(query,sizeof(query),"UPDATE "#DATENBANK"_hauser SET Owner =
    '%s', Sell='%d', Rent='%d', Price='%d', Locked='%d', Rentcount='%d',
    MaxRentcount = '%d', Posx='%f', Posy='%f', Posz='%f', Posix='%f',
    Posiy='%f', Posiz='%f', hLevel='%d', vworld='%d', hint='%d', Bank='%d',
    Muell='%d', waterprice='%d', stromprice='%d', heizprice='%d' , Mietpreis
    ='%d', Upgrade1 = '%d', Upgrade2 = '%d' WHERE hID = '%d'",

    HouseInfo[sid][hOwner], HouseInfo[sid][hSell], HouseInfo[sid][hRent],
    HouseInfo[sid][hPrice], HouseInfo[sid][hLocked],
    HouseInfo[sid][hRentcount], HouseInfo[sid][hMaxRent],
    HouseInfo[sid][hPos][0], HouseInfo[sid][hPos][1],
    HouseInfo[sid][hPos][2], HouseInfo[sid][hiPos][0],
    HouseInfo[sid][hiPos][1],
    HouseInfo[sid][hiPos][2],
    HouseInfo[sid][hLevel], HouseInfo[sid][hvWorld], HouseInfo[sid][hint],
    HouseInfo[sid][hBank],
    HouseInfo[sid][hMuell],HouseInfo[sid][hWaterprice],HouseInfo[sid][hStromprice],
    HouseInfo[sid][hHeizprice], HouseInfo[sid][hMietPreis],
    HouseInfo[sid][hUpgrade][0],HouseInfo[sid][hUpgrade][1],HouseInfo[sid][hID]);
    mysql_function_query(MYSQLVerbindung,query,false,"","");
    }

    Einmal editiert, zuletzt von seegras () aus folgendem Grund: Code eingerückt

  • Er setzt schon beim Kaufen die Haus ID 0.
    case _SQL_HOUSE_LOAD:
    {
    cache_get_data(rows,fields);
    if(rows)
    {
    new hcount = 0, HouseText[300];
    while(hcount<rows)
    {
    cache_get_field_content(hcount,"Owner",result);
    format( HouseInfo[hcount][hOwner], 35, "%s",result);


    cache_get_field_content(hcount,"Sell",result);
    HouseInfo[hcount][hSell] = strval(result);

    cache_get_field_content(hcount,"hcreate",result);
    HouseInfo[hcount][hcreate] = strval(result);


    cache_get_field_content(hcount,"Rent",result);
    HouseInfo[hcount][hRent] = strval(result);


    cache_get_field_content(hcount,"Price",result);
    HouseInfo[hcount][hPrice] = strval(result);


    cache_get_field_content(hcount,"Locked",result);
    HouseInfo[hcount][hLocked] = strval(result);


    cache_get_field_content(hcount,"Rentcount",result);
    HouseInfo[hcount][hRentcount] = strval(result);


    HouseInfo[hcount][hPos][0] = cache_get_field_content_float(hcount, "Posx");
    HouseInfo[hcount][hPos][1] = cache_get_field_content_float(hcount, "Posy");
    HouseInfo[hcount][hPos][2] = cache_get_field_content_float(hcount, "Posz");


    HouseInfo[hcount][hiPos][0] = cache_get_field_content_float(hcount, "Posix");
    HouseInfo[hcount][hiPos][1] = cache_get_field_content_float(hcount, "Posiy");
    HouseInfo[hcount][hiPos][2] = cache_get_field_content_float(hcount, "Posiz");



    cache_get_field_content(hcount,"hLevel",result);
    HouseInfo[hcount][hLevel] = strval(result);


    cache_get_field_content(hcount,"vworld",result);
    HouseInfo[hcount][hvWorld] = strval(result);


    cache_get_field_content(hcount,"hint",result);
    HouseInfo[hcount][hint] = strval(result);


    cache_get_field_content(hcount,"Bank",result);
    HouseInfo[hcount][hBank] = strval(result);


    cache_get_field_content(hcount,"Muell",result);
    HouseInfo[hcount][hMuell] = strval(result);


    cache_get_field_content(hcount,"waterprice",result);
    HouseInfo[hcount][hWaterprice] = strval(result);


    cache_get_field_content(hcount,"stromprice",result);
    HouseInfo[hcount][hStromprice] = strval(result);


    cache_get_field_content(hcount,"heizprice",result);
    HouseInfo[hcount][hHeizprice] = strval(result);


    cache_get_field_content(hcount,"MaxRentcount",result);
    HouseInfo[hcount][hMaxRent] = strval(result);


    cache_get_field_content(hcount,"Upgrade1",result);
    HouseInfo[hcount][hUpgrade][0] = strval(result);

    cache_get_field_content(hcount,"Upgrade2",result);
    HouseInfo[hcount][hUpgrade][1] = strval(result);

    cache_get_field_content(hcount,"Mietpreis",result);
    HouseInfo[hcount][hMietPreis] = strval(result);


    if(HouseInfo[hcount][hPos][0] != 0)
    {
    if(HouseInfo[hcount][hSell] == 0)
    {
    HouseInfo[hcount][hPickup] = CreateDynamicPickup(1272,1, HouseInfo[hcount][hPos][0], HouseInfo[hcount][hPos][1], HouseInfo[hcount][hPos][2],0);
    format(HouseText,sizeof(HouseText),""#HTML_LOGIN"HausID: "#HTML_WHITE"%i\n"#HTML_LOGIN"Preis: "#HTML_WHITE"%i$ "#HTML_LOGIN"Level: "#HTML_WHITE"%d\n"#HTML_LOGIN"Müll: "#HTML_WHITE"%d\n"#HTML_WHITE"Haus steht zum "#HTML_GREEN"Verkauf \n"#HTML_WHITE"/hauskaufen",hcount, HouseInfo[hcount][hPrice], HouseInfo[hcount][hLevel],HouseInfo[hcount][hMuell]);
    HouseInfo[hcount][hText] = Create3DTextLabel(HouseText, WEISS, HouseInfo[hcount][hPos][0], HouseInfo[hcount][hPos][1], HouseInfo[hcount][hPos][2], 10, 0);
    }
    else if(HouseInfo[hcount][hSell] == 1)
    {
    HouseInfo[hcount][hPickup] = CreateDynamicPickup(1273,1,HouseInfo[hcount][hPos][0], HouseInfo[hcount][hPos][1], HouseInfo[hcount][hPos][2],0);
    HouseInfo[hcount][hiPickup] = CreateDynamicPickup(1272,1,HouseInfo[hcount][hiPos][0], HouseInfo[hcount][hiPos][1], HouseInfo[hcount][hiPos][2], HouseInfo[hcount][hvWorld], HouseInfo[hcount][hint]);
    format(HouseText,sizeof(HouseText),""#HTML_LOGIN"HausID: %i\n"#HTML_LOGIN"Hausbesitzer: "#HTML_WHITE"%s\n"#HTML_LOGIN"Mietpreis: "#HTML_WHITE"%i$\n"#HTML_LOGIN"Mieter: "#HTML_WHITE"%i/%i\n"#HTML_LOGIN"Müll: "#HTML_WHITE"%d\n\nUm dich einzumieten benutze /einmieten"#HTML_WHITE" ein!\nZum Betreten 'F'", hcount, HouseInfo[hcount][hOwner], HouseInfo[hcount][hMietPreis], HouseInfo[hcount][hRentcount], HouseInfo[hcount][hMaxRent], HouseInfo[hcount][hMuell]);
    HouseInfo[hcount][hText] = Create3DTextLabel(HouseText, WEISS, HouseInfo[hcount][hPos][0], HouseInfo[hcount][hPos][1], HouseInfo[hcount][hPos][2], 10, 0);
    }
    }
    hcount++;
    }
    printf(""#SERVERNAME" Häuser geladen %d/%d geladen!",rows, MAX_HOUSE);
    }
    return true;
    }

  • Haus lass ich nun folgend laden:
    case _SQL_HOUSE_LOAD:
    {
    cache_get_data(rows,fields);
    if(rows)
    {
    new hcount = 0, HouseText[300];
    while(hcount<rows)
    {
    cache_get_field_content(hcount,"Owner",result);
    format( HouseInfo[hcount][hOwner], 35, "%s",result);


    cache_get_field_content(hcount,"hID",result);
    HouseInfo[hcount][hID] = strval(result);
    printf("Haus id: %d",HouseInfo[hcount][hID]);

    cache_get_field_content(hcount,"Sell",result);
    HouseInfo[hcount][hSell] = strval(result);

    cache_get_field_content(hcount,"hcreate",result);
    HouseInfo[hcount][hcreate] = strval(result);


    cache_get_field_content(hcount,"Rent",result);
    HouseInfo[hcount][hRent] = strval(result);


    cache_get_field_content(hcount,"Price",result);
    HouseInfo[hcount][hPrice] = strval(result);


    cache_get_field_content(hcount,"Locked",result);
    HouseInfo[hcount][hLocked] = strval(result);


    cache_get_field_content(hcount,"Rentcount",result);
    HouseInfo[hcount][hRentcount] = strval(result);


    HouseInfo[hcount][hPos][0] = cache_get_field_content_float(hcount, "Posx");
    HouseInfo[hcount][hPos][1] = cache_get_field_content_float(hcount, "Posy");
    HouseInfo[hcount][hPos][2] = cache_get_field_content_float(hcount, "Posz");


    HouseInfo[hcount][hiPos][0] = cache_get_field_content_float(hcount, "Posix");
    HouseInfo[hcount][hiPos][1] = cache_get_field_content_float(hcount, "Posiy");
    HouseInfo[hcount][hiPos][2] = cache_get_field_content_float(hcount, "Posiz");



    cache_get_field_content(hcount,"hLevel",result);
    HouseInfo[hcount][hLevel] = strval(result);


    cache_get_field_content(hcount,"vworld",result);
    HouseInfo[hcount][hvWorld] = strval(result);


    cache_get_field_content(hcount,"hint",result);
    HouseInfo[hcount][hint] = strval(result);


    cache_get_field_content(hcount,"Bank",result);
    HouseInfo[hcount][hBank] = strval(result);


    cache_get_field_content(hcount,"Muell",result);
    HouseInfo[hcount][hMuell] = strval(result);


    cache_get_field_content(hcount,"waterprice",result);
    HouseInfo[hcount][hWaterprice] = strval(result);


    cache_get_field_content(hcount,"stromprice",result);
    HouseInfo[hcount][hStromprice] = strval(result);


    cache_get_field_content(hcount,"heizprice",result);
    HouseInfo[hcount][hHeizprice] = strval(result);


    cache_get_field_content(hcount,"MaxRentcount",result);
    HouseInfo[hcount][hMaxRent] = strval(result);


    cache_get_field_content(hcount,"Upgrade1",result);
    HouseInfo[hcount][hUpgrade][0] = strval(result);

    cache_get_field_content(hcount,"Upgrade2",result);
    HouseInfo[hcount][hUpgrade][1] = strval(result);

    cache_get_field_content(hcount,"Mietpreis",result);
    HouseInfo[hcount][hMietPreis] = strval(result);


    if(HouseInfo[hcount][hPos][0] != 0)
    {
    if(HouseInfo[hcount][hSell] == 0)
    {
    HouseInfo[hcount][hPickup] = CreateDynamicPickup(1272,1, HouseInfo[hcount][hPos][0], HouseInfo[hcount][hPos][1], HouseInfo[hcount][hPos][2],0);
    format(HouseText,sizeof(HouseText),""#HTML_LOGIN"HausID: "#HTML_WHITE"%i\n"#HTML_LOGIN"Preis: "#HTML_WHITE"%i$ "#HTML_LOGIN"Level: "#HTML_WHITE"%d\n"#HTML_LOGIN"Müll: "#HTML_WHITE"%d\n"#HTML_WHITE"Haus steht zum "#HTML_GREEN"Verkauf \n"#HTML_WHITE"/hauskaufen",hcount, HouseInfo[hcount][hPrice], HouseInfo[hcount][hLevel],HouseInfo[hcount][hMuell]);
    HouseInfo[hcount][hText] = Create3DTextLabel(HouseText, WEISS, HouseInfo[hcount][hPos][0], HouseInfo[hcount][hPos][1], HouseInfo[hcount][hPos][2], 10, 0);
    }
    else if(HouseInfo[hcount][hSell] == 1)
    {
    HouseInfo[hcount][hPickup] = CreateDynamicPickup(1273,1,HouseInfo[hcount][hPos][0], HouseInfo[hcount][hPos][1], HouseInfo[hcount][hPos][2],0);
    HouseInfo[hcount][hiPickup] = CreateDynamicPickup(1272,1,HouseInfo[hcount][hiPos][0], HouseInfo[hcount][hiPos][1], HouseInfo[hcount][hiPos][2], HouseInfo[hcount][hvWorld], HouseInfo[hcount][hint]);
    format(HouseText,sizeof(HouseText),""#HTML_LOGIN"HausID: %i\n"#HTML_LOGIN"Hausbesitzer: "#HTML_WHITE"%s\n"#HTML_LOGIN"Mietpreis: "#HTML_WHITE"%i$\n"#HTML_LOGIN"Mieter: "#HTML_WHITE"%i/%i\n"#HTML_LOGIN"Müll: "#HTML_WHITE"%d\n\nUm dich einzumieten benutze /einmieten"#HTML_WHITE" ein!\nZum Betreten 'F'", hcount, HouseInfo[hcount][hOwner], HouseInfo[hcount][hMietPreis], HouseInfo[hcount][hRentcount], HouseInfo[hcount][hMaxRent], HouseInfo[hcount][hMuell]);
    HouseInfo[hcount][hText] = Create3DTextLabel(HouseText, WEISS, HouseInfo[hcount][hPos][0], HouseInfo[hcount][hPos][1], HouseInfo[hcount][hPos][2], 10, 0);
    }
    }
    hcount++;
    }
    printf(""#SERVERNAME" Häuser geladen %d/%d geladen!",rows, MAX_HOUSE);
    }
    return true;
    }


    Jetzt beim COMMAND: hauskaufen wird danach die ID um eins erhöht also von 40 auf 41.

  • do.de - Domain-Offensive - Domains für alle und zu super Preisen
  • Beitrag von Heav3n ()

    Dieser Beitrag wurde gelöscht, Informationen über den Löschvorgang sind nicht verfügbar.
  • Hier wird gekauft:
    COMMAND:hauskaufen(playerid)
    {
    if(Spieler[playerid][Eingeloggt] == 0) return SendClientMessage(playerid,ROT,"Du bist nicht Eingeloggt!");
    if(Spieler[playerid][pAFK] == 1)return SendClientMessage(playerid,WRONGCMD,"Du bist AFK. Benutze /back");
    if(Spieler[playerid][pGetazert] == 1) return SendClientMessage(playerid,ROT,"Du bist getazert!");
    new uMoney = Spieler[playerid][pGeld], HouseText[275], HouseIText[120];
    if(Spieler[playerid][pHouseID] != defaulth && Spieler[playerid][pMieter] != defaulth) return SendClientMessage(playerid,ROT,"Du besitzt schon ein Haus (/hausverkaufen) oder bist in einem Haus eingemietet (/ausmieten)!");
    for(new houseID = 0; houseID < MAX_HOUSE; houseID++)
    {
    if(IsPlayerInRangeOfPoint(playerid,5.0,HouseInfo[houseID][hPos][0],HouseInfo[houseID][hPos][1],HouseInfo[houseID][hPos][2]))
    {
    if(HouseInfo[houseID][hSell] == 1) return SendClientMessage(playerid,ROT,"Dieses Haus kannst du nicht kaufen!");
    if(uMoney < HouseInfo[houseID][hPrice]) return SendClientMessage(playerid,ROT,"Dieses Haus kannst du dir nicht leisten!");
    if(Spieler[playerid][pLevel] < HouseInfo[houseID][hLevel]) return SendClientMessage(playerid,ROT,"Dein Level ist zu niedrig!");
    format( HouseInfo[houseID][hOwner], 35, "%s", Spieler[playerid][pName]);
    HouseInfo[houseID][hSell] = 1;
    HouseInfo[houseID][hMietPreis] = 500;
    Delete3DTextLabel(HouseInfo[houseID][hText]);
    format(HouseText,sizeof(HouseText),""#HTML_LOGIN"HausID: %i\n"#HTML_LOGIN"Hausbesitzer: "#HTML_WHITE"%s\n"#HTML_LOGIN"Mietpreis: "#HTML_WHITE"%i$\n"#HTML_LOGIN"Mieter:"#HTML_WHITE"%i/%i\n"#HTML_LOGIN"Müll:"#HTML_WHITE"%d\n\nUm dich einzumieten benutze /einmieten"#HTML_WHITE" ein!\nZum Betreten 'F'", HouseInfo[houseID][hID], HouseInfo[houseID][hOwner], HouseInfo[houseID][hMietPreis], HouseInfo[houseID][hRentcount], HouseInfo[houseID][hMaxRent], HouseInfo[houseID][hMuell]);
    HouseInfo[houseID][hText] = Create3DTextLabel(HouseText, WEISS, HouseInfo[houseID][hPos][0], HouseInfo[houseID][hPos][1], HouseInfo[houseID][hPos][2], 10, 0);


    DestroyDynamicPickup(HouseInfo[houseID][hPickup]);
    HouseInfo[houseID][hPickup] = CreateDynamicPickup(1272, 1, HouseInfo[houseID][hPos][0], HouseInfo[houseID][hPos][1], HouseInfo[houseID][hPos][2],0);
    Spieler[playerid][pHouseID] = houseID;
    ACMoney(playerid, -HouseInfo[houseID][hPrice]);
    ERTextHide(playerid);
    format(HouseIText,sizeof(HouseIText),"Haus gekauft:~n~ID:%d~n~Name:%s~n~Preis:%d",HouseInfo[houseID][hID], HouseInfo[houseID][hOwner], HouseInfo[houseID][hPrice]);
    ERText(playerid,HouseIText,5000);
    SaveHouse(houseID);
    }
    }
    return true;
    }


    Hier wird es Createt:
    stock CreateHouse(playerid, price, level, uID, slot, Float:x , Float:y , Float:z)
    {
    new query[750], HouseText[300], HouseIText[120];
    for(new i=0;i<MAX_HOUSE;i++)
    {
    if(HouseInfo[i][hPos][0] == 0 ||HouseInfo[i][hPos][1] == 0 || HouseInfo[i][hPos][2] == 0)
    {
    if(HouseInfo[i][hcreate] == 0)
    {
    if(uID == defaulth)
    {
    HouseInfo[i][hPos][0] = x;
    HouseInfo[i][hPos][1] = y;
    HouseInfo[i][hPos][2] = z;
    HouseInfo[i][hLevel] = level;
    HouseInfo[i][hPrice] = price;
    HouseInfo[i][hLocked] = 1;
    HouseInfo[i][hcreate] = 1;
    HouseInfo[i][hRent] = 0;
    HouseInfo[i][hSell] = 0;
    HouseInfo[i][hRentcount] = 0;
    format( HouseInfo[i][hOwner], 35, "Niemand");
    HouseInfo[i][hiPos][0] = 244.411987;
    HouseInfo[i][hiPos][1] = 305.032989;
    HouseInfo[i][hiPos][2] = 999.148437;
    HouseInfo[i][hvWorld] = GetRandomWorld();
    HouseInfo[i][hint] = 1;
    HouseInfo[i][hMuell] = 0;
    HouseInfo[i][hID] = i;
    HouseInfo[i][hMuell] = 0;
    HouseInfo[i][hMaxRent] = slot;


    HouseInfo[i][hiPickup] = CreateDynamicPickup(1273,1,HouseInfo[i][hiPos][0], HouseInfo[i][hiPos][1], HouseInfo[i][hiPos][2], HouseInfo[i][hvWorld], HouseInfo[i][hint]);
    HouseInfo[i][hPickup] = CreateDynamicPickup(1273,1, HouseInfo[i][hPos][0], HouseInfo[i][hPos][1], HouseInfo[i][hPos][2],0);


    format(HouseText,sizeof(HouseText),""#HTML_LOGIN"HausID: "#HTML_WHITE"%i\n"#HTML_LOGIN"Preis: "#HTML_WHITE"%i$ \n"#HTML_LOGIN"Level: "#HTML_WHITE"%d\n"#HTML_LOGIN"Müll: "#HTML_WHITE"%d\n"#HTML_WHITE"Haus steht zum "#HTML_GREEN"Verkauf \n"#HTML_WHITE"/hauskaufen",i, HouseInfo[i][hPrice], HouseInfo[i][hLevel], HouseInfo[i][hMuell]);
    HouseInfo[i][hText] = Create3DTextLabel(HouseText, WEISS, HouseInfo[i][hPos][0], HouseInfo[i][hPos][1], HouseInfo[i][hPos][2], 10, 0 );


    format(HouseIText,sizeof(HouseIText),"Haus erstellt:~n~ID:%d~n~Preis:%d~n~Level:%d",i, HouseInfo[i][hPrice], HouseInfo[i][hLevel]);
    ERText(playerid,HouseIText,5000);


    format(query,sizeof(query),"INSERT INTO "#DATENBANK"_hauser (`hcreate`,`hID`,`Owner`,`Sell`,`Rent`,`Price`,`Locked`,`Rentcount`,`MaxRentcount`,`Posx`,`Posy`,`Posz`,`Posix`,`Posiy`,`Posiz`,`vworld`,`hint`,`hLevel`,`Bank`,`Muell`,`waterprice`,`stromprice`,`heizprice`,`Mietpreis`) VALUES ('1','%d','Niemand','0','0','%d','1','0','%d','%f','%f','%f','%f','%f','%f','%d','1','%d','0','0','%d','%d','%d','500')",
    i,HouseInfo[i][hPrice],slot,x,y,z,HouseInfo[i][hiPos][0],HouseInfo[i][hiPos][1],HouseInfo[i][hiPos][2],HouseInfo[i][hvWorld],level,BusinessInfo[11][WasserKosten],
    BusinessInfo[5][StromKosten],BusinessInfo[12][GasKosten]);
    mysql_function_query(MYSQLVerbindung,query,false,"","");
    SaveHouse(i);
    return 1;
    }
    else
    {
    if(IsPlayerConnected(uID))
    {
    if(uID != INVALID_PLAYER_ID || !IsPlayerNPC(uID))
    {
    if(Spieler[uID][pHouseID] == defaulth)
    {
    format( HouseInfo[i][hOwner], 35, "%s", Spieler[uID][pName]);
    HouseInfo[i][hPos][0] = x;
    HouseInfo[i][hPos][1] = y;
    HouseInfo[i][hPos][2] = z;
    HouseInfo[i][hRent] = 0;
    HouseInfo[i][hSell] = 1;
    HouseInfo[i][hcreate] = 1;
    HouseInfo[i][hLevel] = level;
    HouseInfo[i][hPrice] = price;
    HouseInfo[i][hLocked] = 1;
    HouseInfo[i][hiPos][0] = 244.411987;
    HouseInfo[i][hiPos][1] = 305.032989;
    HouseInfo[i][hiPos][2] = 999.148437;
    HouseInfo[i][hvWorld] = GetRandomWorld();
    HouseInfo[i][hint] = 1;
    HouseInfo[i][hMuell] = 0;
    HouseInfo[i][hiPickup] = CreateDynamicPickup(1272,1,HouseInfo[i][hiPos][0], HouseInfo[i][hiPos][1], HouseInfo[i][hiPos][2], HouseInfo[i][hvWorld], HouseInfo[i][hint]);
    format(HouseText,sizeof(HouseText),""#HTML_LOGIN"HausID: %i\n"#HTML_LOGIN"Hausbesitzer: "#HTML_WHITE"%s\n"#HTML_LOGIN"Mietpreis: "#HTML_WHITE"%i$\n"#HTML_LOGIN"Müll: "#HTML_WHITE"%d\n"#HTML_LOGIN"Mieter: "#HTML_WHITE"%i/%i\n\nUm dich einzumieten benutze /einmieten"#HTML_WHITE"\nZum Betreten 'F'", i, HouseInfo[i][hOwner], HouseInfo[i][hMietPreis], HouseInfo[i][hRentcount], HouseInfo[i][hMaxRent], HouseInfo[i][hMuell]);
    HouseInfo[i][hText] = Create3DTextLabel(HouseText, WEISS, HouseInfo[i][hPos][0], HouseInfo[i][hPos][1], HouseInfo[i][hPos][2], 10, 0);
    HouseInfo[i][hPickup] = CreateDynamicPickup(1272, 1, HouseInfo[i][hPos][0], HouseInfo[i][hPos][1], HouseInfo[i][hPos][2], 0);
    HouseInfo[i][hID] = i;
    Spieler[uID][pHouseID] = i;
    ACMoney(uID, -HouseInfo[i][hPrice]);
    HouseInfo[i][hMaxRent] = slot;


    format(HouseIText,sizeof(HouseIText),"Haus erstellt:~n~ID:%d~n~Name:%s~n~Preis:%d~n~Level:%d",i, HouseInfo[i][hOwner], HouseInfo[i][hPrice], HouseInfo[i][hLevel]);
    ERText(playerid,HouseIText,5000);


    format(query,sizeof(query),"INSERT INTO "#DATENBANK"_hauser (`hcreate`,`hID`,`Owner`,`Sell`,`Rent`,`Price`,`Locked`,`Rentcount`,`MaxRentcount`,`Posx`,`Posy`,`Posz`,`Posix`,`Posiy`,`Posiz`,`vworld`,`hint`,`hLevel`,`Bank`,`Muell`,`waterprice`,`stromprice`,`heizprice`,`Mietpreis`) VALUES ('1','%d','%s','0','0','%d','1','0','%d','%f','%f','%f','%f','%f','%f','%d','1','%d','0','0','%d','%d','%d','500')",
    i,Spieler[uID][pName],HouseInfo[i][hPrice],slot,x,y,z,HouseInfo[i][hiPos][0],HouseInfo[i][hiPos][1],HouseInfo[i][hiPos][2],HouseInfo[i][hvWorld],level,BusinessInfo[11][WasserKosten],
    BusinessInfo[5][StromKosten],BusinessInfo[12][GasKosten]);
    mysql_function_query(MYSQLVerbindung,query,false,"","");
    SaveHouse(i);
    return 1;
    }else return SendClientMessage(playerid,ROT,"Dieser Spieler hat schon ein Haus!");
    }else return SendClientMessage(playerid,ROT,"Unbekannte Spieler ID!");
    }else return SendClientMessage(playerid,ROT,"Dieser Spieler ist nicht Online!");
    }
    }
    }
    }
    return 1;
    }


    Gespeichert:
    stock SaveHouse(sid)
    {
    new query[500];
    format(query,sizeof(query),"UPDATE "#DATENBANK"_hauser SET Owner = '%s', Sell='%d', Rent='%d', Price='%d', Locked='%d', Rentcount='%d', MaxRentcount = '%d', Posx='%f', Posy='%f', Posz='%f', Posix='%f', Posiy='%f', Posiz='%f', hLevel='%d', vworld='%d', hint='%d', Bank='%d', Muell='%d', waterprice='%d', stromprice='%d', heizprice='%d' , Mietpreis ='%d', Upgrade1 = '%d', Upgrade2 = '%d' WHERE hID = '%d'",
    HouseInfo[sid][hOwner], HouseInfo[sid][hSell], HouseInfo[sid][hRent], HouseInfo[sid][hPrice], HouseInfo[sid][hLocked], HouseInfo[sid][hRentcount], HouseInfo[sid][hMaxRent], HouseInfo[sid][hPos][0], HouseInfo[sid][hPos][1], HouseInfo[sid][hPos][2], HouseInfo[sid][hiPos][0], HouseInfo[sid][hiPos][1],
    HouseInfo[sid][hiPos][2], HouseInfo[sid][hLevel], HouseInfo[sid][hvWorld], HouseInfo[sid][hint], HouseInfo[sid][hBank], HouseInfo[sid][hMuell],HouseInfo[sid][hWaterprice],HouseInfo[sid][hStromprice], HouseInfo[sid][hHeizprice], HouseInfo[sid][hMietPreis],
    HouseInfo[sid][hUpgrade][0],HouseInfo[sid][hUpgrade][1],HouseInfo[sid][hID]);
    mysql_function_query(MYSQLVerbindung,query,false,"","");
    }

  • Falls ja, poste bitte den Code mit dem du das Haus kaufst und den Code mit dem du dir die Häuser anzeigen lässt die dir gehören.


    Das rot markierte fehlt.


    Es wäre gut, wenn du davon auch einen Screenshot ingame postest, wo du siehst, dass ID 3,4,5 dir gehören.


    Bekommst du beim Kauf 3 Nachrichten, oder nur eine? Von welcher ID?

  • Die Häuser die mir gehören werden aus der Datenbank geladen:
    http://www11.pic-upload.de/17.04.15/m3mrhh51xtx.png
    Habe Haus ID 4 gekauft und 3 und 5 dazu bekommen. Beim Kauf werden keine Nachrichten ausgegeben. Hab die Häuser einfach so bekommen.



    Hier werden die Häuser angezeigt und geladen:
    case _SQL_HOUSE_LOAD:
    {
    cache_get_data(rows,fields);
    if(rows)
    {
    new hcount = 0, HouseText[300];
    while(hcount<rows)
    {
    cache_get_field_content(hcount,"Owner",result);
    format( HouseInfo[hcount][hOwner], 35, "%s",result);


    cache_get_field_content(hcount,"hID",result);
    HouseInfo[hcount][hID] = strval(result)-1;
    printf("Haus id: %d",HouseInfo[hcount][hID]);

    cache_get_field_content(hcount,"Sell",result);
    HouseInfo[hcount][hSell] = strval(result);

    cache_get_field_content(hcount,"hcreate",result);
    HouseInfo[hcount][hcreate] = strval(result);


    cache_get_field_content(hcount,"Rent",result);
    HouseInfo[hcount][hRent] = strval(result);


    cache_get_field_content(hcount,"Price",result);
    HouseInfo[hcount][hPrice] = strval(result);


    cache_get_field_content(hcount,"Locked",result);
    HouseInfo[hcount][hLocked] = strval(result);


    cache_get_field_content(hcount,"Rentcount",result);
    HouseInfo[hcount][hRentcount] = strval(result);


    HouseInfo[hcount][hPos][0] = cache_get_field_content_float(hcount, "Posx");
    HouseInfo[hcount][hPos][1] = cache_get_field_content_float(hcount, "Posy");
    HouseInfo[hcount][hPos][2] = cache_get_field_content_float(hcount, "Posz");


    HouseInfo[hcount][hiPos][0] = cache_get_field_content_float(hcount, "Posix");
    HouseInfo[hcount][hiPos][1] = cache_get_field_content_float(hcount, "Posiy");
    HouseInfo[hcount][hiPos][2] = cache_get_field_content_float(hcount, "Posiz");



    cache_get_field_content(hcount,"hLevel",result);
    HouseInfo[hcount][hLevel] = strval(result);


    cache_get_field_content(hcount,"vworld",result);
    HouseInfo[hcount][hvWorld] = strval(result);


    cache_get_field_content(hcount,"hint",result);
    HouseInfo[hcount][hint] = strval(result);


    cache_get_field_content(hcount,"Bank",result);
    HouseInfo[hcount][hBank] = strval(result);


    cache_get_field_content(hcount,"Muell",result);
    HouseInfo[hcount][hMuell] = strval(result);


    cache_get_field_content(hcount,"waterprice",result);
    HouseInfo[hcount][hWaterprice] = strval(result);


    cache_get_field_content(hcount,"stromprice",result);
    HouseInfo[hcount][hStromprice] = strval(result);


    cache_get_field_content(hcount,"heizprice",result);
    HouseInfo[hcount][hHeizprice] = strval(result);


    cache_get_field_content(hcount,"MaxRentcount",result);
    HouseInfo[hcount][hMaxRent] = strval(result);


    cache_get_field_content(hcount,"Upgrade1",result);
    HouseInfo[hcount][hUpgrade][0] = strval(result);

    cache_get_field_content(hcount,"Upgrade2",result);
    HouseInfo[hcount][hUpgrade][1] = strval(result);

    cache_get_field_content(hcount,"Mietpreis",result);
    HouseInfo[hcount][hMietPreis] = strval(result);


    if(HouseInfo[hcount][hPos][0] != 0)
    {
    if(HouseInfo[hcount][hSell] == 0)
    {
    HouseInfo[hcount][hPickup] = CreateDynamicPickup(1272,1, HouseInfo[hcount][hPos][0], HouseInfo[hcount][hPos][1], HouseInfo[hcount][hPos][2],0);
    format(HouseText,sizeof(HouseText),""#HTML_LOGIN"HausID: "#HTML_WHITE"%i\n"#HTML_LOGIN"Preis: "#HTML_WHITE"%i$ "#HTML_LOGIN"Level: "#HTML_WHITE"%d\n"#HTML_LOGIN"Müll: "#HTML_WHITE"%d\n"#HTML_WHITE"Haus steht zum "#HTML_GREEN"Verkauf \n"#HTML_WHITE"/hauskaufen",hcount, HouseInfo[hcount][hPrice], HouseInfo[hcount][hLevel],HouseInfo[hcount][hMuell]);
    HouseInfo[hcount][hText] = Create3DTextLabel(HouseText, WEISS, HouseInfo[hcount][hPos][0], HouseInfo[hcount][hPos][1], HouseInfo[hcount][hPos][2], 10, 0);
    }
    else if(HouseInfo[hcount][hSell] == 1)
    {
    HouseInfo[hcount][hPickup] = CreateDynamicPickup(1273,1,HouseInfo[hcount][hPos][0], HouseInfo[hcount][hPos][1], HouseInfo[hcount][hPos][2],0);
    HouseInfo[hcount][hiPickup] = CreateDynamicPickup(1272,1,HouseInfo[hcount][hiPos][0], HouseInfo[hcount][hiPos][1], HouseInfo[hcount][hiPos][2], HouseInfo[hcount][hvWorld], HouseInfo[hcount][hint]);
    format(HouseText,sizeof(HouseText),""#HTML_LOGIN"HausID: %i\n"#HTML_LOGIN"Hausbesitzer: "#HTML_WHITE"%s\n"#HTML_LOGIN"Mietpreis: "#HTML_WHITE"%i$\n"#HTML_LOGIN"Mieter: "#HTML_WHITE"%i/%i\n"#HTML_LOGIN"Müll: "#HTML_WHITE"%d\n\nUm dich einzumieten benutze /einmieten"#HTML_WHITE" ein!\nZum Betreten 'F'", hcount, HouseInfo[hcount][hOwner], HouseInfo[hcount][hMietPreis], HouseInfo[hcount][hRentcount], HouseInfo[hcount][hMaxRent], HouseInfo[hcount][hMuell]);
    HouseInfo[hcount][hText] = Create3DTextLabel(HouseText, WEISS, HouseInfo[hcount][hPos][0], HouseInfo[hcount][hPos][1], HouseInfo[hcount][hPos][2], 10, 0);
    }
    }
    hcount++;
    }
    printf(""#SERVERNAME" Häuser geladen %d/%d geladen!",rows, MAX_HOUSE);
    }
    return true;
    }