Textdraw Informationen auslesen

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
  • Guten Tag,
    Ich möchte hier den Namen auslesen aber iwie geht das nicht:
    TextDrawShowForPlayer(playerid, von);
    new Text:von;
    von = TextDrawCreate(70.399986, 57.493320, "Stats von:");
    TextDrawLetterSize(von, 0.449999, 1.600000);
    TextDrawAlignment(von, 1);
    TextDrawColor(von, -1);
    TextDrawSetShadow(von, 0);
    TextDrawSetOutline(von, 1);
    TextDrawBackgroundColor(von, 51);
    TextDrawFont(von, 1);
    TextDrawSetProportional(von, 1);
    format(string,sizeof(string1),"Stats von: %d",GetPlayerName(playerid, name, sizeof(name));


    Danke im vorraus.

  • GetPlayerName(playerid, name, sizeof(name)
    returnt auch keinen Wert, sondern schreibt den Namen in die Variable "name" (Parameter 2). Schaus dir zur Sicherheit nochmal im Wiki an.

    GetPlayerName(playerid, name, sizeof(name);
    format(string,sizeof(string1),"Stats von: %s",name);


    Und erstell bitte eine PlayerTextDraw, denn sonst steht bei jedem Spieler der gleiche Name drin. Das wäre nicht so vorteilhaft :whistling:

    Einmal editiert, zuletzt von H4rd_B4se ()

  • GetPlayerName(playerid, name, sizeof(name)
    returnt auch keinen Wert, sondern schreibt den Namen in die Variable "name" (Parameter 2). Schaus dir zur Sicherheit nochmal im Wiki an.

    GetPlayerName(playerid, name, sizeof(name);
    format(string,sizeof(string1),"Stats von: %d",name);


    Und erstell bitte eine PlayerTextDraw, denn sonst steht bei jedem Spieler der gleiche Name drin. Das wäre nicht so vorteilhaft :whistling:

    Massenhaft Erorrs:
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(4199) : error 035: argument type mismatch (argument 2)
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(5796) : warning 213: tag mismatch
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(8004) : warning 213: tag mismatch
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(9447) : warning 204: symbol is assigned a value that is never used: "string3"
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(9576) : warning 219: local variable "engine" shadows a variable at a preceding level
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(9576) : warning 219: local variable "lights" shadows a variable at a preceding level
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(9576) : warning 219: local variable "alarm" shadows a variable at a preceding level
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(9576) : warning 219: local variable "doors" shadows a variable at a preceding level
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(9576) : warning 219: local variable "bonnet" shadows a variable at a preceding level
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(9576) : warning 219: local variable "boot" shadows a variable at a preceding level
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(9576) : warning 219: local variable "objective" shadows a variable at a preceding level
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(9566) : warning 204: symbol is assigned a value that is never used: "string"
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(10108) : warning 202: number of arguments does not match definition
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(10108) : warning 202: number of arguments does not match definition
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(10108) : warning 202: number of arguments does not match definition
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(10108) : warning 202: number of arguments does not match definition
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(10108) : warning 202: number of arguments does not match definition
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(10108) : warning 202: number of arguments does not match definition
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(10108) : warning 202: number of arguments does not match definition
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(10108) : warning 202: number of arguments does not match definition
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(10095) : warning 204: symbol is assigned a value that is never used: "insgesamtstring"
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(10010) : warning 203: symbol is never used: "pz"
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(10009) : warning 203: symbol is never used: "py"
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(10008) : warning 203: symbol is never used: "px"
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(10004) : warning 204: symbol is assigned a value that is never used: "shealth"
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(10001) : warning 204: symbol is assigned a value that is never used: "expamount"
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(9999) : warning 204: symbol is assigned a value that is never used: "account"
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(9998) : warning 204: symbol is assigned a value that is never used: "Nummer"
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(9978) : warning 204: symbol is assigned a value that is never used: "ptime"
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(9977) : warning 204: symbol is assigned a value that is never used: "age"
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(9907) : warning 204: symbol is assigned a value that is never used: "cash"
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(11527) : error 033: array must be indexed (variable "Textdraw01")
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(11528) : error 035: argument type mismatch (argument 1)
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(11529) : error 035: argument type mismatch (argument 1)
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(11530) : error 035: argument type mismatch (argument 1)
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(11531) : error 035: argument type mismatch (argument 1)
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(11532) : error 035: argument type mismatch (argument 1)
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(11533) : error 035: argument type mismatch (argument 1)
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(11534) : error 035: argument type mismatch (argument 1)
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(11535) : error 035: argument type mismatch (argument 1)
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(11536) : error 035: argument type mismatch (argument 1)
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(11538) : error 033: array must be indexed (variable "Textdraw02")
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(11540) : error 035: argument type mismatch (argument 1)
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(11541) : error 035: argument type mismatch (argument 1)
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(11542) : error 035: argument type mismatch (argument 1)
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(11543) : error 035: argument type mismatch (argument 1)
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(11544) : error 035: argument type mismatch (argument 1)
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(11545) : error 035: argument type mismatch (argument 1)
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(11546) : error 035: argument type mismatch (argument 1)
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(11547) : error 035: argument type mismatch (argument 1)
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(11549) : error 033: array must be indexed (variable "Statistiken")
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(11550) : error 035: argument type mismatch (argument 1)
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(11551) : error 035: argument type mismatch (argument 1)
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(11552) : error 035: argument type mismatch (argument 1)
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(11553) : error 035: argument type mismatch (argument 1)
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(11554) : error 035: argument type mismatch (argument 1)


  • Les dir den Artikel richtig durch, du musst aus der Variable ein Array machen.


    2.Schreib lieber dein eigenes Script, GFs sind meist totaler Buggy-Shit.



    Wie willst du Erfahrung sammeln, wenn du dort nur C&P nutzen musst.


    Kannst ja aber machen was du willst, ist dir überlassen.



    E: auch ein Klammerfehler.

  • Dann hast du nen Klammerfehler gemacht, zeig doch nochmal den Code


    Jetzt hab ich das:
    -RP(1).pwn(16017) : error 035: argument type mismatch (argument 2)
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(16018) : error 035: argument type mismatch (argument 2)
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(16019) : error 035: argument type mismatch (argument 2)
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(16020) : error 035: argument type mismatch (argument 2)
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(16021) : error 035: argument type mismatch (argument 2)
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(16022) : error 035: argument type mismatch (argument 2)
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(16023) : error 035: argument type mismatch (argument 2)
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(16024) : error 035: argument type mismatch (argument 2)
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(16025) : error 017: undefined symbol "name"
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(16025) : error 017: undefined symbol "name"
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(16026) : error 017: undefined symbol "string1"

  • new name[MAX_PLAYER_NAME];

    so:
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name);
    format(string,sizeof(string1),"Stats von: %s",name);
    new Text:von[MAX_PLAYERS];


    von = TextDrawCreate(70.399986, 57.493320, "Stats von:");
    TextDrawLetterSize(von, 0.449999, 1.600000);
    TextDrawAlignment(von, 1);
    TextDrawColor(von, -1);
    TextDrawSetShadow(von, 0);
    TextDrawSetOutline(von, 1);
    TextDrawBackgroundColor(von, 51);
    TextDrawFont(von, 1);
    TextDrawSetProportional(von, 1);

  • Und jetzt noch bitte so:
    new PlayerText:von[MAX_PLAYERS];
    von[playerid] = CreatePlayerTextDraw(playerid,70.399986, 57.493320, "Stats von:");
    TextDrawLetterSize(playerid,von[playerid], 0.449999, 1.600000);
    TextDrawAlignment(playerid,von[playerid], 1);
    TextDrawColor(playerid,von[playerid], -1);
    TextDrawSetShadow(playerid,von[playerid], 0);
    TextDrawSetOutline(playerid,von[playerid], 1);
    TextDrawBackgroundColor(playerid,von[playerid], 51);
    TextDrawFont(playerid,von[playerid], 1);
    TextDrawSetProportional(playerid,von[playerid], 1);


    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name);
    format(string,sizeof(string1),"Stats von: %s",name);
    PlayerTextDrawSetString(playerid,von[playerid],string1);

  • new name[MAX_PLAYER_NAME];



    Jetzt: D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(16011) : error 035: argument type mismatch (argument 2)
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(16012) : error 017: undefined symbol "Statistiken"
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(16013) : error 035: argument type mismatch (argument 2)
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(16015) : error 001: expected token: ",", but found ";"
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(16016) : error 017: undefined symbol "string1"
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(16016) : error 029: invalid expression, assumed zero
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(16016) : warning 215: expression has no effect
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(16017) : error 017: undefined symbol "string1"


    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(11551) : error 017: undefined symbol "playerid"
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(11552) : error 017: undefined symbol "playerid"
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(11553) : error 017: undefined symbol "playerid"
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(11554) : error 017: undefined symbol "playerid"
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(11555) : error 017: undefined symbol "playerid"
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(11556) : error 017: undefined symbol "playerid"
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(11557) : error 017: undefined symbol "playerid"
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(11558) : error 017: undefined symbol "playerid"
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(11559) : error 017: undefined symbol "playerid"

  • Bitte mit Zeilen dazu :whistling:


    Du musst die PlayerTextDraws auch in OnPlayerConnect (oder Änhlichem) erstellen.

    Die Erorrs hängen mit dem zusammen:
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(11551) : error 017: undefined symbol "playerid"
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(11552) : error 017: undefined symbol "playerid"
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(11553) : error 017: undefined symbol "playerid"
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(11554) : error 017: undefined symbol "playerid"
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(11555) : error 017: undefined symbol "playerid"
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(11556) : error 017: undefined symbol "playerid"
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(11557) : error 017: undefined symbol "playerid"
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(11558) : error 017: undefined symbol "playerid"
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(11559) : error 017: undefined symbol "playerid"


    new PlayerText:von[MAX_PLAYERS];


    Und:
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(16011) : error 035: argument type mismatch (argument 2)
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(16012) : error 017: undefined symbol "Statistiken"
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(16013) : error 035: argument type mismatch (argument 2)
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(16015) : error 001: expected token: ",", but found ";"
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(16016) : error 017: undefined symbol "string1"
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(16016) : error 029: invalid expression, assumed zero
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(16016) : warning 215: expression has no effect
    D:\Users\Admin\Desktop\Gamemode\gamemodes\E-RP(1).pwn(16017) : error 017: undefined symbol "string1"


    mit:
    TextDrawShowForPlayer(playerid, von);
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name);
    format(string1,sizeof(string1),"Stats von: %s",name);
    PlayerTextDrawSetString(playerid,von[playerid],string1);
    von[playerid] = CreatePlayerTextDraw(playerid,70.399986, 57.493320, "Stats von:");
    TextDrawLetterSize(playerid,von[playerid], 0.449999, 1.600000);
    TextDrawAlignment(playerid,von[playerid], 1);
    TextDrawColor(playerid,von[playerid], -1);
    TextDrawSetShadow(playerid,von[playerid], 0);
    TextDrawSetOutline(playerid,von[playerid], 1);
    TextDrawBackgroundColor(playerid,von[playerid], 51);
    TextDrawFont(playerid,von[playerid], 1);
    TextDrawSetProportional(playerid,von[playerid], 1);


  • Du erstellst diese Falsch:


    // OnPlayerConnect
    von[playerid] = PlayerCreatePlayerTextDraw(playerid,70.399986, 57.493320, "Stats von:");
    PlayerTextDrawLetterSize(playerid, 0.449999, 1.600000);
    PlayerTextDrawAlignment(playerid, 1);
    PlayerTextDrawColor(playerid, -1);
    PlayerTextDrawSetShadow(playerid, 0);
    PlayerTextDrawSetOutline(playerid, 1);
    PlayerTextDrawBackgroundColor(playerid, 51);
    PlayerTextDrawFont(playerid, 1);
    PlayerTextDrawSetProportional(playerid, 1);

    // Textdraw dem Spieler zeigen
    PlayerTextDrawShow(playerid,von[playerid]);

    // Textdraw dem Spieler verstecken
    PlayerTextDrawHide(playerid,von[playerid]);

  • TextDrawShowForPlayer(playerid, von);
    zu:
    PlayerTextDrawShow(playerid, von[playerid]);


    Sonst weißt der doch garnicht was er verstecken soll?


    //edit
    Schick mal jz bitte alles nochmal von neu was du hattest, da es zu unübersichtlich geworden ist...

  • Alles:
    PlayerTextDrawShow(playerid, von[playerid]);
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name);
    format(string1,sizeof(string1),"Stats von: %s",name);
    PlayerTextDrawSetString(playerid,von[playerid],string1);


    von[playerid] = PlayerCreatePlayerTextDraw(playerid,70.399986, 57.493320, "Stats von:");
    PlayerTextDrawLetterSize(playerid, 0.449999, 1.600000);
    PlayerTextDrawAlignment(playerid, 1);
    PlayerTextDrawColor(playerid, -1);
    PlayerTextDrawSetShadow(playerid, 0);
    PlayerTextDrawSetOutline(playerid, 1);
    PlayerTextDrawBackgroundColor(playerid, 51);
    PlayerTextDrawFont(playerid, 1);
    PlayerTextDrawSetProportional(playerid, 1);


    new PlayerText:von[MAX_PLAYERS];


  • von[playerid] = CreatePlayerTextDraw(playerid,70.399986, 57.493320, "Stats von:");
    PlayerTextDrawLetterSize(playerid,von[playerid], 0.449999, 1.600000);
    PlayerTextDrawAlignment(playerid,von[playerid], 1);
    PlayerTextDrawColor(playerid,von[playerid], -1);
    PlayerTextDrawSetShadow(playerid,von[playerid], 0);
    PlayerTextDrawSetOutline(playerid,von[playerid], 1);
    PlayerTextDrawBackgroundColor(playerid,von[playerid], 51);
    PlayerTextDrawFont(playerid,von[playerid], 1);
    PlayerTextDrawSetProportional(playerid,von[playerid], 1);


    PlayerTextDrawShow(playerid, von[playerid]);
    new name[MAX_PLAYER_NAME],string1[68];
    GetPlayerName(playerid, name, sizeof(name));
    format(string1,sizeof(string1),"Stats von: %s",name);
    PlayerTextDrawSetString(playerid,von[playerid],string1);

  • Beitrag von AirM4X ()

    Dieser Beitrag wurde gelöscht, Informationen über den Löschvorgang sind nicht verfügbar.