Ein Textdraw Problem

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 habe ein kleines Problem. Undzwar möchte ich Player-Textdraws erstellen, welche "anklickbar" sind. Ich habe auch bereits etwas eingefügt, aber wenn ich nun klicke passiert nichts, habe auch schon OnPlayerClickPlayerTextDraw debuggen lassen.
    Da passiert aber nichts. Hier meine Textdraws, die ich erstellt habe:

    pTutorialDrawSkin[10][playerid] = CreatePlayerTextDraw(playerid, 370.000, 251.377, "<");
    PlayerTextDrawLetterSize(playerid, pTutorialDrawSkin[10][playerid], 0.685, 2.375);
    PlayerTextDrawAlignment(playerid, pTutorialDrawSkin[10][playerid], 1);
    PlayerTextDrawColor(playerid, pTutorialDrawSkin[10][playerid], -1);
    PlayerTextDrawSetOutline(playerid, pTutorialDrawSkin[10][playerid], 1);
    PlayerTextDrawBackgroundColor(playerid, pTutorialDrawSkin[10][playerid], 51);
    PlayerTextDrawFont(playerid, pTutorialDrawSkin[10][playerid], 1);
    PlayerTextDrawSetProportional(playerid, pTutorialDrawSkin[10][playerid], 1);
    PlayerTextDrawTextSize(playerid, pTutorialDrawSkin[10][playerid], 1337.000, 1337.000);


    pTutorialDrawSkin[12][playerid] = CreatePlayerTextDraw(playerid, 532.833, 251.048, ">");
    PlayerTextDrawLetterSize(playerid, pTutorialDrawSkin[12][playerid], 0.685, 2.375);
    PlayerTextDrawAlignment(playerid, pTutorialDrawSkin[12][playerid], 1);
    PlayerTextDrawColor(playerid, pTutorialDrawSkin[12][playerid], -1);
    PlayerTextDrawSetOutline(playerid, pTutorialDrawSkin[12][playerid], 1);
    PlayerTextDrawBackgroundColor(playerid, pTutorialDrawSkin[12][playerid], 51);
    PlayerTextDrawFont(playerid, pTutorialDrawSkin[12][playerid], 1);
    PlayerTextDrawSetProportional(playerid, pTutorialDrawSkin[12][playerid], 1);
    PlayerTextDrawTextSize(playerid, pTutorialDrawSkin[12][playerid], 1337.000, 1337.000);


    PlayerTextDrawSetSelectable(playerid, pTutorialDrawSkin[playerid][10], true);
    PlayerTextDrawSetSelectable(playerid, pTutorialDrawSkin[playerid][12], true);

    SelectTextDraw(playerid, 0xFFCC00FF);


    Ich hoffe, ihr könnt mir helfen! :/

  • public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid)
    {
    SendClientMessage(playerid, COLOR_WHITE, "Clicked on TDraw");
    if(playertextid == pTutorialDrawSkin[10][playerid]) // arrow back
    {
    // female
    if(GetPlayerSkin(playerid) == 12){
    SetPlayerSkin(playerid, 193);
    pChoosedSkin[playerid] = 193;
    }
    else if(GetPlayerSkin(playerid) == 193){
    SetPlayerSkin(playerid, 192);
    pChoosedSkin[playerid] = 192;
    }
    else if(GetPlayerSkin(playerid) == 192){
    SetPlayerSkin(playerid, 152);
    pChoosedSkin[playerid] = 152;
    }
    else if(GetPlayerSkin(playerid) == 152){
    SetPlayerSkin(playerid, 93);
    pChoosedSkin[playerid] = 93;
    }
    else if(GetPlayerSkin(playerid) == 93){
    SetPlayerSkin(playerid, 56);
    pChoosedSkin[playerid] = 56;
    }
    else if(GetPlayerSkin(playerid) == 56){
    SetPlayerSkin(playerid, 55);
    pChoosedSkin[playerid] = 55;
    }
    else if(GetPlayerSkin(playerid) == 55){
    SetPlayerSkin(playerid, 41);
    pChoosedSkin[playerid] = 41;
    }
    else if(GetPlayerSkin(playerid) == 41){
    SetPlayerSkin(playerid, 40);
    pChoosedSkin[playerid] = 40;
    }
    else if(GetPlayerSkin(playerid) == 40){
    SetPlayerSkin(playerid, 12);
    pChoosedSkin[playerid] = 12;
    }
    // male coming soon
    }
    if(playertextid == pTutorialDrawSkin[12][playerid]) // Pfeil weiter
    {
    // Weiblich
    if(GetPlayerSkin(playerid) == 12){
    SetPlayerSkin(playerid, 40);
    pChoosedSkin[playerid] = 40;
    }
    else if(GetPlayerSkin(playerid) == 40){
    SetPlayerSkin(playerid, 41);
    pChoosedSkin[playerid] = 41;
    }
    else if(GetPlayerSkin(playerid) == 41){
    SetPlayerSkin(playerid, 55);
    pChoosedSkin[playerid] = 55;
    }
    else if(GetPlayerSkin(playerid) == 55){
    SetPlayerSkin(playerid, 56);
    pChoosedSkin[playerid] = 56;
    }
    else if(GetPlayerSkin(playerid) == 56){
    SetPlayerSkin(playerid, 93);
    pChoosedSkin[playerid] = 93;
    }
    else if(GetPlayerSkin(playerid) == 93){
    SetPlayerSkin(playerid, 152);
    pChoosedSkin[playerid] = 152;
    }
    else if(GetPlayerSkin(playerid) == 152){
    SetPlayerSkin(playerid, 192);
    pChoosedSkin[playerid] = 192;
    }
    else if(GetPlayerSkin(playerid) == 192){
    SetPlayerSkin(playerid, 193);
    pChoosedSkin[playerid] = 193;
    }
    else if(GetPlayerSkin(playerid) == 193){
    SetPlayerSkin(playerid, 12);
    pChoosedSkin[playerid] = 12;
    }
    }
    return 1;
    }

  • ich habe wirklich alles möglich versucht und teste schon seit min. 20 minuten daran rum ^^
    ich habe es nun letztendlich hinbekommen und ich habe eine vermutung das es an dem array liegen könnte.
    denn egal auf welchen textdraw ich geklickt habe wurde immer nur der pfeil nach links erkannt.
    letztendlich habe ich es mal so probiert und siehe da es klappt auf einmal. aber keine ahnung warum man bei OnPlayerClickPlayerTextDraw keinen array benutzen kann -.-



    #include <a_samp>
    #define BLAU 0x0087FFFF


    new PlayerText:pTutorialDrawSkin[MAX_PLAYERS];
    new PlayerText:pTutorialDrawSkin2[MAX_PLAYERS];


    main(){}


    public OnGameModeInit()
    {
    SetGameModeText("Blank Script");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    return 1;
    }
    public OnPlayerRequestClass(playerid, classid)
    {
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    return 1;
    }
    public OnPlayerCommandText(playerid, cmdtext[])
    {
    if (strcmp("/test", cmdtext, true, 10) == 0)
    {
    pTutorialDrawSkin[playerid] = CreatePlayerTextDraw(playerid, 370.000, 251.377, "<");
    pTutorialDrawSkin2[playerid] = CreatePlayerTextDraw(playerid, 532.833, 251.048, ">");


    PlayerTextDrawSetSelectable(playerid, pTutorialDrawSkin[playerid], 1);
    PlayerTextDrawSetSelectable(playerid, pTutorialDrawSkin2[playerid], 1);


    PlayerTextDrawShow(playerid,pTutorialDrawSkin[playerid]);
    PlayerTextDrawShow(playerid,pTutorialDrawSkin2[playerid]);


    SelectTextDraw(playerid, 0xFFCC00FF);


    return 1;
    }
    return 0;
    }
    public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid)
    {
    if(PlayerText:playertextid==pTutorialDrawSkin[playerid]) // arrow back
    {
    SendClientMessage(playerid, BLAU, "Links");
    return 1;
    }
    if(PlayerText:playertextid==pTutorialDrawSkin2[playerid]) // Pfeil weiter
    {
    SendClientMessage(playerid, BLAU, "Rechts");
    return 1;
    }
    return 1;
    }

    2 Mal editiert, zuletzt von Tround ()