Frage zum HausTextDraw

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
  • Hey,
    ich habe ein Problem, und zwar, wenn ein Spieler in das Pickup vor einem Haus geht, das TextDraw nicht erscheint, obwohl es erscheinen sollte. Woran könnte das liegen?


    Hier mein Code:
    TextDraw:
    for(new haus=1;haus<MAX_HAUS;haus++)
    {
    HausInfoText[haus] = TextDrawCreate(443.000000,315.000000,"Lade...");
    TextDrawLetterSize(HausInfoText[haus],0.280000,1.700000);
    TextDrawFont(HausInfoText[haus],2);
    TextDrawSetShadow(HausInfoText[haus],2);
    TextDrawSetOutline(HausInfoText[haus],1);
    TextDrawUseBox(HausInfoText[haus],1);
    TextDrawBackgroundColor(HausInfoText[haus],255);
    TextDrawBoxColor(HausInfoText[haus],0x000000AA);
    TextDrawTextSize(HausInfoText[haus],630.000000,0.000000);
    LoadHaus(haus);
    } SetTimer("HausInfoTimer",1000,true);// Das war alles bei OnGameModeInit



    Timer:
    forward HausInfoTimer();
    public HausInfoTimer()
    {
    new string[128];
    for(new i=1;i<MAX_HAUS;i++)
    {
    format(string,sizeof(string),"Besitzer: %s~n~Preis: %d$",HausInfo[i][haus_besitzer],HausInfo[i][haus_preis]);
    TextDrawSetString(HausInfoText[i],string);
    }
    return 1;
    }


    forward UpdateHausInfoText(playerid,pickupid);
    public UpdateHausInfoText(playerid,pickupid)
    {
    for(new haus=1;haus<MAX_HAUS;haus++)
    {
    new pfad[50];
    format(pfad,sizeof(pfad),"/Haeuser/%d.txt",haus);
    if(HausInfo[haus][haus_pickup] == pickupid)
    {
    if(IsPlayerInRangeOfPoint(playerid,2,dini_Float(pfad,"x"),dini_Float(pfad,"y"),dini_Float(pfad,"z")))
    {
    SendClientMessage(playerid,Color_Green,"Hey-Ho!");
    TextDrawShowForPlayer(playerid,HausInfoText[haus]);
    }
    }
    }
    return 1;
    }



    Der Timer im OnPlayerPickuppickup:
    public OnPlayerPickUpPickup(playerid, pickupid)
    {
    SetTimer("UpdateHausInfoText",800,1);
    return 1;
    }



    Ich hoffe, ihr könnt mir weiterhelfen^^


    Mfg Maksimo :) :)

  • Wie meinst du das genau?
    Also die pickups werden im stock "LoadHaus" erstellt.
    stock LoadHaus(hausid)
    {
    new pfad[50];
    format(pfad,50,"/Haeuser/%d.txt",hausid);
    if(!fexist(pfad))return 0;


    HausInfo[hausid][haus_x] = dini_Float(pfad,"x");
    HausInfo[hausid][haus_y] = dini_Float(pfad,"y");
    HausInfo[hausid][haus_z] = dini_Float(pfad,"z");
    HausInfo[hausid][haus_preis] = dini_Int(pfad,"preis");
    HausInfo[hausid][haus_pickup] = CreatePickup(1273 ,23,HausInfo[hausid][haus_x],HausInfo[hausid][haus_y],HausInfo[hausid][haus_z],0);
    format(HausInfo[hausid][haus_besitzer],32,"%s",dini_Get(pfad,"besitzer"));
    HausInfo[hausid][haus_z] = dini_Float(pfad,"z");
    HausInfo[hausid][haus_preis] = dini_Int(pfad,"preis");
    HausInfo[hausid][haus_innenraum] = dini_Int(pfad,"innenraum");
    HausInfo[hausid][haus_id] = dini_Int(pfad,"HausID");
    return 1;
    }

  • Kann ja auch nicht pickupid wird nicht übertragen.




    SetTimerEx("UpdateHausInfoText", 800, 1, "dd", playerid, pickupid);



    Obwohl du das nicht benötigst.
    Ausserdem fragst du doch schon die position ab also nimm das hier raus:




    forward UpdateHausInfoText(playerid);
    public UpdateHausInfoText(playerid)
    {
    for(new haus=1;haus<MAX_HAUS;haus++)
    {
    new pfad[50];
    format(pfad,sizeof(pfad),"/Haeuser/%d.txt",haus);
    if(IsPlayerInRangeOfPoint(playerid,2,dini_Float(pfad,"x"),dini_Float(pfad,"y"),dini_Float(pfad,"z")))
    {
    SendClientMessage(playerid,Color_Green,"Hey-Ho!");
    TextDrawShowForPlayer(playerid,HausInfoText[haus]);
    }
    }
    return 1;
    }


    Und mach es so aber wieso du es bei jedem abfragen neu auslesen lässt ist mir ein Rätsel :P

    RFT

  • Du lässt die Werte mit Dini bei jeder benutzung auslesen.
    Wieso lässt du sie beim Server Start nicht in einer Enum Struktur laden und fragst die Werte von der Enum Struktur ab ?
    und bei veränderungen am Haus halt Updaten ist doch optisch viel schöner und schonender.

    RFT

  • do.de - Domain-Offensive - Domains für alle und zu super Preisen