Warum wird beim Hauserstellen kein Text angezeigt

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. Ich hab ein Problem und zwar wenn ich ein Haus erstelle wird kein Text angezeigt also ob es verkauft ist oder ob es zum kaufen ist welchen Preis etc.... siehe bilder. Bitte um hilfe


    ocmd:createhouse(playerid,params[])
    {
    if(pInfo[playerid][pAdmin] == 5) {
    new p,r,int;
    if(sscanf(params,"iii",p,r,int))return SendClientMessage(playerid,COLOR_GREY,"Benutze: /createhouse [Preis] [Zimmer (max. 6)] [Interior ID (Liste: /hints)]");
    {
    if(r <= 6) {
    if(int <= 10) {
    new st[16];
    format(st,sizeof st,"%d",r);
    mysql_pquery(dbHandle,"SELECT * FROM `haeuser`","OnQueryFinish","sdddsd","SELECT * FROM `haeuser`",QuerySelectAllHouse,playerid,p,st,int);
    SendClientMessage(playerid,COLOR_LIGHTGREEN,"Du hast das Haus erfolgreich erstellt!");
    } else {
    SendClientMessage(playerid,COLOR_LIGHTRED,"Die InteriorID eines Hauses darf nicht größer als 10 sein!");
    }
    } else {
    SendClientMessage(playerid,COLOR_LIGHTRED,"Die Zimmer eines Hauses dürfen nicht mehr als 6 sein!");
    }
    }
    }
    return 1;
    }


    case QueryCallHouse:
    {
    cache_get_data(rows,fields);
    if(rows) {
    oldtime=GetTickCount();
    new ho;
    for(;ho<rows;ho++) {
    //if(ho==0){ho++;}
    cache_get_field_content(ho,"ID",result);
    HausInfo[ho][hID] = strval(result);
    cache_get_field_content(ho,"PosX",result);
    HausInfo[ho][hPosX] = floatstr(result);
    cache_get_field_content(ho,"PosY",result);
    HausInfo[ho][hPosY] = floatstr(result);
    cache_get_field_content(ho,"PosZ",result);
    HausInfo[ho][hPosZ] = floatstr(result);
    cache_get_field_content(ho,"Level",result);
    HausInfo[ho][hLevel] = strval(result);
    cache_get_field_content(ho,"Preis",result);
    HausInfo[ho][hPreis] = strval(result);
    cache_get_field_content(ho,"Besitzer",result);
    format(HausInfo[ho][hBesitzer],24,"%s",result);
    cache_get_field_content(ho,"Bought",result);
    HausInfo[ho][hBought] = strval(result);
    cache_get_field_content(ho,"Rooms",result);
    HausInfo[ho][hRooms] = strval(result);
    cache_get_field_content(ho,"InteriorID",result);
    HausInfo[ho][hInteriorID] = strval(result);
    cache_get_field_content(ho,"Interior",result);
    HausInfo[ho][hInterior] = strval(result);
    cache_get_field_content(ho,"IntX",result);
    HausInfo[ho][hIntX] = floatstr(result);
    cache_get_field_content(ho,"IntY",result);
    HausInfo[ho][hIntY] = floatstr(result);
    cache_get_field_content(ho,"IntZ",result);
    HausInfo[ho][hIntZ] = floatstr(result);
    cache_get_field_content(ho,"Locked",result);
    HausInfo[ho][hLocked] = strval(result);
    cache_get_field_content(ho,"Rentable",result);
    HausInfo[ho][hRentable] = strval(result);
    cache_get_field_content(ho,"RentPrice",result);
    HausInfo[ho][hRentPrice] = strval(result);
    cache_get_field_content(ho,"Renter1",result);
    format(HausInfo[ho][hRenter1],24,"%s",result);
    cache_get_field_content(ho,"Renter2",result);
    format(HausInfo[ho][hRenter2],24,"%s",result);
    cache_get_field_content(ho,"Renter3",result);
    format(HausInfo[ho][hRenter3],24,"%s",result);
    cache_get_field_content(ho,"Renter4",result);
    format(HausInfo[ho][hRenter4],24,"%s",result);
    cache_get_field_content(ho,"Renter5",result);
    format(HausInfo[ho][hRenter5],24,"%s",result);
    cache_get_field_content(ho,"Renter6",result);
    format(HausInfo[ho][hRenter6],24,"%s",result);
    HausInfo[ho][hVW] = HausInfo[ho][hID]+1;
    HausInfo[ho][hOutPickup] = CreatePickup(1318,1,HausInfo[ho][hIntX],HausInfo[ho][hIntY],HausInfo[ho][hIntZ],HausInfo[ho][hVW]);
    if(HausInfo[ho][hBought] == 0) {
    HausInfo[ho][hPickup] = CreatePickup(1272,1,HausInfo[ho][hPosX],HausInfo[ho][hPosY],HausInfo[ho][hPosZ]);
    format(str,256,"Hausnummer %d\nDieses Haus ist zu verkaufen!\nPreis: %s€\nLevel: %d\nMieträume: %d\nHaus besichtigen: ~k~~VEHICLE_ENTER_EXIT~ drücken\nHaus kaufen: /buy",ho,inspoints(HausInfo[ho][hPreis]),HausInfo[ho][hLevel],HausInfo[ho][hRooms]);
    } else {
    if(HausInfo[ho][hRentable] == 1) {
    format(str,256,"Hausnummer %d\nBesitzer: %s\nMietpreis: %s€\nZimmer mieten - /rentroom",ho,HausInfo[ho][hBesitzer],inspoints(HausInfo[ho][hRentPrice]));
    } else if(HausInfo[ho][hRentable] == 0) {
    format(str,256,"Hausnummer %d\nBesitzer: %s",ho,HausInfo[ho][hBesitzer]);
    }
    HausInfo[ho][hPickup] = CreatePickup(1239,1,HausInfo[ho][hPosX],HausInfo[ho][hPosY],HausInfo[ho][hPosZ]);
    }
    HausInfo[ho][hLabel]=Create3DTextLabel(str,COLOR_AO,HausInfo[ho][hPosX],HausInfo[ho][hPosY],HausInfo[ho][hPosZ],7,1);
    HausInfo[ho][hOutLabel]=Create3DTextLabel("Austreten:\n~k~~VEHICLE_ENTER_EXIT~ drücken",COLOR_AO,HausInfo[ho][hIntX],HausInfo[ho][hIntY],HausInfo[ho][hIntZ],5,HausInfo[ho][hVW],1);
    HausInfo[ho][hCreated]=true;
    }
    printf("<-| [MYSQL-LOAD] Es wurden %d Häuser geladen - Dauer: %dms",ho,GetTickCount()-oldtime);
    }
    }

  • Dein Query geht auf QuerySelectAllHouse, das Create3DTextLabel ist aber im case-Teil von QueryCallHouse. Möglicherweise ist das das Problem, falls das nicht so gewollt ist. Ansonsten müsstest du mal den entsprechenden case-Teil posten.

  • Richtig ist das so aber immer noch nicht, denn jetzt machst du jedes mal einen SELECT auf die ganze Tabelle, und lädst alles raus, dann erstellst du laut Code für alle Häuser wieder die Items.
    Das kannst du so nicht machen, sonst erstellt sich jedes mal wenn du ein Haus erstellst an jedem alten Haus das Pickup/Label... nochmal, sprich es ist dann X-Fach vorhanden.



    Außerdem kann mit dem SELECT nichts in der Datenbank eingetragen werden, deshalb wird nichts eingetragen.



    DJ Deagle ist das dein Code?

  • case QuerySelectAllHouse:
    {
    cache_get_data(rows,fields);
    if(rows > MAX_HAEUSER) return 0;
    new Float:X,Float:Y,Float:Z;
    GetPlayerPos(playerid,X,Y,Z);
    format(query,sizeof query,"INSERT INTO `haeuser` (`ID`, `PosX`, `PosY`,\
    `PosZ`, `Level`, `Preis`, `Besitzer`, `Bought`, `Rooms`,`InteriorID`,`Interior`,`IntX`,`IntY`,`IntZ`,`Rentable`,\
    `RentPrice`, `Renter1`, `Renter2`, `Renter3`, `Renter4`, `Renter5`");
    format(query,sizeof query,"%s,`Renter6`)VALUES('%d', '%f', '%f', '%f', '5', '%d', 'Niemand','0', '%d',\
    '%d', '%d', '%f', '%f', '%f', '1', '100', 'Niemand', 'Niemand', 'Niemand', 'Niemand', 'Niemand', 'Niemand')"\
    ,query,rows,X,Y,Z,pID,strval(extrastr),extraid,hIntID[extraid][0],hInteriorList[extraid][0], hInteriorList[extraid][1], hInteriorList[extraid][2]);
    mysql_pquery(dbHandle,query);


    format(str,sizeof str,"SELECT * FROM `haeuser` WHERE `ID` = '%d'",rows);
    mysql_pquery(dbHandle, str, "OnQueryFinish", "sdd", str, QueryCallLoadHouse, playerid);
    }


    so hier. Sry hat etwas länger gedauert @Jeffry

  • Ahh, jetzt macht der Befehl Sinn, wie er aufgebaut ist.
    Eigentlich müsste es sogar klappen.


    Versuche es so:
    ocmd:createhouse(playerid,params[])
    {
    if(pInfo[playerid][pAdmin] == 5)
    {
    new p,r,int;
    if(sscanf(params,"iii",p,r,int))return SendClientMessage(playerid,COLOR_GREY,"Benutze: /createhouse [Preis] [Zimmer (max. 6)] [Interior ID (Liste: /hints)]");
    {
    if(r <= 6)
    {
    if(int <= 10)
    {
    new st[16];
    format(st,sizeof st,"%d",r);
    mysql_pquery(dbHandle,"SELECT * FROM `haeuser`","OnQueryFinish","sdddsd","SELECT * FROM `haeuser`",QuerySelectAllHouse,playerid,p,st,int);
    SendClientMessage(playerid,COLOR_LIGHTGREEN,"Du hast das Haus erfolgreich erstellt!");
    }
    else
    {
    SendClientMessage(playerid,COLOR_LIGHTRED,"Die InteriorID eines Hauses darf nicht größer als 10 sein!");
    }
    }
    else
    {
    SendClientMessage(playerid,COLOR_LIGHTRED,"Die Zimmer eines Hauses dürfen nicht mehr als 6 sein!");
    }
    }
    }
    return 1;
    }



    case QuerySelectAllHouse:
    {
    cache_get_data(rows,fields);
    if(rows >= MAX_HAEUSER) return 0;
    new Float:X,Float:Y,Float:Z;
    GetPlayerPos(playerid,X,Y,Z);
    format(query,sizeof query,"INSERT INTO `haeuser` (`ID`, `PosX`, `PosY`,\
    `PosZ`, `Level`, `Preis`, `Besitzer`, `Bought`, `Rooms`,`InteriorID`,`Interior`,`IntX`,`IntY`,`IntZ`,`Rentable`,\
    `RentPrice`, `Renter1`, `Renter2`, `Renter3`, `Renter4`, `Renter5`");
    format(query,sizeof query,"%s,`Renter6`)VALUES('%d', '%f', '%f', '%f', '5', '%d', 'Niemand','0', '%d',\
    '%d', '%d', '%f', '%f', '%f', '1', '100', 'Niemand', 'Niemand', 'Niemand', 'Niemand', 'Niemand', 'Niemand')"\
    ,query,rows,X,Y,Z,pID,strval(extrastr),extraid,hIntID[extraid][0],hInteriorList[extraid][0], hInteriorList[extraid][1], hInteriorList[extraid][2]);
    mysql_pquery(dbHandle,query);


    format(str,sizeof str,"SELECT * FROM `haeuser` WHERE `ID` = '%d'",rows);
    mysql_pquery(dbHandle, str, "OnQueryFinish", "sdd", str, QueryCallLoadHouse, playerid);
    }


    Falls das nicht klappt, dann schaue bitte im MySQL Log nach, was dir dort ausgegeben wird (gegebenenfalls zuvor löschen/leeren) und poste das mal.

  • do.de - Domain-Offensive - Domains für alle und zu super Preisen
  • Werden die Häuser korrekt in der Datenbank angelegt? Im MySQL Log konnte ich nämlich keinen Fehler dazu finden.
    Wenn ja, werden die Texte angezeigt, wenn du den Server neu startest, oder werden die für kein Haus angezeigt, auch nicht für die, die vor dem Server Restart erstellt worden sind?

  • hier der Code


    case QueryCallLoadHouse:
    {
    cache_get_data(rows,fields);
    if(rows) {
    new ho;
    for(;ho<rows;ho++) {
    //if(ho==0){ho++;}
    cache_get_field_content(ho,"ID",result);
    HausInfo[ho][hID] = strval(result);
    cache_get_field_content(ho,"PosX",result);
    HausInfo[ho][hPosX] = floatstr(result);
    cache_get_field_content(ho,"PosY",result);
    HausInfo[ho][hPosY] = floatstr(result);
    cache_get_field_content(ho,"PosZ",result);
    HausInfo[ho][hPosZ] = floatstr(result);
    cache_get_field_content(ho,"Level",result);
    HausInfo[ho][hLevel] = strval(result);
    cache_get_field_content(ho,"Preis",result);
    HausInfo[ho][hPreis] = strval(result);
    cache_get_field_content(ho,"Besitzer",result);
    format(HausInfo[ho][hBesitzer],24,"%s",result);
    cache_get_field_content(ho,"Bought",result);
    HausInfo[ho][hBought] = strval(result);
    cache_get_field_content(ho,"Rooms",result);
    HausInfo[ho][hRooms] = strval(result);
    cache_get_field_content(ho,"InteriorID",result);
    HausInfo[ho][hInteriorID] = strval(result);
    cache_get_field_content(ho,"Interior",result);
    HausInfo[ho][hInterior] = strval(result);
    cache_get_field_content(ho,"IntX",result);
    HausInfo[ho][hIntX] = floatstr(result);
    cache_get_field_content(ho,"IntY",result);
    HausInfo[ho][hIntY] = floatstr(result);
    cache_get_field_content(ho,"IntZ",result);
    HausInfo[ho][hIntZ] = floatstr(result);
    cache_get_field_content(ho,"Locked",result);
    HausInfo[ho][hLocked] = strval(result);
    cache_get_field_content(ho,"Rentable",result);
    HausInfo[ho][hRentable] = strval(result);
    cache_get_field_content(ho,"RentPrice",result);
    HausInfo[ho][hRentPrice] = strval(result);
    cache_get_field_content(ho,"Renter1",result);
    format(HausInfo[ho][hRenter1],24,"%s",result);
    cache_get_field_content(ho,"Renter2",result);
    format(HausInfo[ho][hRenter2],24,"%s",result);
    cache_get_field_content(ho,"Renter3",result);
    format(HausInfo[ho][hRenter3],24,"%s",result);
    cache_get_field_content(ho,"Renter4",result);
    format(HausInfo[ho][hRenter4],24,"%s",result);
    cache_get_field_content(ho,"Renter5",result);
    format(HausInfo[ho][hRenter5],24,"%s",result);
    cache_get_field_content(ho,"Renter6",result);
    format(HausInfo[ho][hRenter6],24,"%s",result);
    HausInfo[ho][hVW] = HausInfo[ho][hID]+1;
    HausInfo[ho][hOutPickup] = CreatePickup(1318,1,HausInfo[ho][hIntX],HausInfo[ho][hIntY],HausInfo[ho][hIntZ],HausInfo[ho][hVW]);
    if(HausInfo[ho][hBought] == 0) {
    HausInfo[ho][hPickup] = CreatePickup(1272,1,HausInfo[ho][hPosX],HausInfo[ho][hPosY],HausInfo[ho][hPosZ]);
    format(str,256,"Hausnummer %d\nDieses Haus ist zu verkaufen!\nPreis: %s€\nLevel: %d\nMieträume: %d\nHaus besichtigen: ~k~~VEHICLE_ENTER_EXIT~ drücken\nHaus kaufen: /buy",ho,inspoints(HausInfo[ho][hPreis]),HausInfo[ho][hLevel],HausInfo[ho][hRooms]);
    } else {
    if(HausInfo[ho][hRentable] == 1) {
    format(str,256,"Hausnummer %d\nBesitzer: %s\nMietpreis: %s€\nZimmer mieten - /rentroom",ho,HausInfo[ho][hBesitzer],inspoints(HausInfo[ho][hRentPrice]));
    } else if(HausInfo[ho][hRentable] == 0) {
    format(str,256,"Hausnummer %d\nBesitzer: %s",ho,HausInfo[ho][hBesitzer]);
    }
    HausInfo[ho][hPickup] = CreatePickup(1239,1,HausInfo[ho][hPosX],HausInfo[ho][hPosY],HausInfo[ho][hPosZ]);
    }
    Create3DTextLabel(str,COLOR_AO,HausInfo[ho][hPosX],HausInfo[ho][hPosY],HausInfo[ho][hPosZ],15,1);
    HausInfo[ho][hOutLabel]=Create3DTextLabel("Austreten:\n~k~~VEHICLE_ENTER_EXIT~ drücken",COLOR_AO,HausInfo[ho][hIntX],HausInfo[ho][hIntY],HausInfo[ho][hIntZ],5,HausInfo[ho][hVW],1);
    HausInfo[ho][hCreated]=true;
    }
    }
    }

  • Ok, ändere dort mal:
    Create3DTextLabel(str,COLOR_AO,HausInfo[ho][hPosX],HausInfo[ho][hPosY],HausInfo[ho][hPosZ],15,1);
    zu:
    HausInfo[ho][hLabel]=Create3DTextLabel(str,COLOR_AO,HausInfo[ho][hPosX],HausInfo[ho][hPosY],HausInfo[ho][hPosZ],HausInfo[ho][hVW],1);


    Und dort wo alle geladen werden:
    HausInfo[ho][hLabel]=Create3DTextLabel(str,COLOR_AO,HausInfo[ho][hPosX],HausInfo[ho][hPosY],HausInfo[ho][hPosZ],7,1);
    zu:
    HausInfo[ho][hLabel]=Create3DTextLabel(str,COLOR_AO,HausInfo[ho][hPosX],HausInfo[ho][hPosY],HausInfo[ho][hPosZ],HausInfo[ho][hVW],1);

  • In welcher virtuellen Welt bist du denn?
    Es wundert mich nämlich auch, dass bei CreatePickup nichts angegeben ist.


    Versuche es mal anstatt wie oben beschrieben mit HausInfo[ho][hVW] im vorletzten Parameter bei den beiden Create3DTextLabel, mit 0, also so:
    HausInfo[ho][hLabel]=Create3DTextLabel(str,COLOR_AO,HausInfo[ho][hPosX],HausInfo[ho][hPosY],HausInfo[ho][hPosZ],0,1);