Problem with clickable PlayerTextDraw (unable to cllick it)
#1

Hello i really need a problem with this since i already lost too much time with this... So here is the code

pawn Код:
//====================================MENU TEXTDRAW=============================
new PlayerText:Textdraw0[MAX_PLAYERS];
new PlayerText:Textdraw1[MAX_PLAYERS];
new PlayerText:Textdraw2[MAX_PLAYERS];
new PlayerText:Textdraw3[MAX_PLAYERS];
new PlayerText:Textdraw4[MAX_PLAYERS];
new PlayerText:Textdraw5[MAX_PLAYERS];
new PlayerText:Textdraw6[MAX_PLAYERS];
new PlayerText:Textdraw7[MAX_PLAYERS];
new PlayerText:Textdraw8[MAX_PLAYERS];
new PlayerText:Textdraw9[MAX_PLAYERS];
new PlayerText:Textdraw10[MAX_PLAYERS];
new PlayerText:Textdraw11[MAX_PLAYERS];
new PlayerText:Textdraw12[MAX_PLAYERS];
new PlayerText:Textdraw13[MAX_PLAYERS];
new PlayerText:Textdraw14[MAX_PLAYERS];
new PlayerText:Textdraw15[MAX_PLAYERS];


//On player connect 2 of 15
Textdraw4[playerid] = CreatePlayerTextDraw(playerid,239.000000, 181.000000, "Stats");
    PlayerTextDrawBackgroundColor(playerid,Textdraw4[playerid], 255);
    PlayerTextDrawFont(playerid,Textdraw4[playerid], 1);
    PlayerTextDrawLetterSize(playerid,Textdraw4[playerid], 0.500000, 1.000000);
    PlayerTextDrawColor(playerid,Textdraw4[playerid], -1);
    PlayerTextDrawSetOutline(playerid,Textdraw4[playerid], 1);
    PlayerTextDrawSetProportional(playerid,Textdraw4[playerid], 1);
    PlayerTextDrawTextSize(playerid,Textdraw4[playerid], 281.000000, 20.000000);
    PlayerTextDrawSetSelectable(playerid,PlayerText:Textdraw4[playerid], 1);

    Textdraw5[playerid] = CreatePlayerTextDraw(playerid,294.000000, 152.000000, "Phone");
    PlayerTextDrawBackgroundColor(playerid,Textdraw5[playerid], 255);
    PlayerTextDrawFont(playerid,Textdraw5[playerid], 1);
    PlayerTextDrawLetterSize(playerid,Textdraw5[playerid], 0.500000, 1.000000);
    PlayerTextDrawColor(playerid,Textdraw5[playerid], -1);
    PlayerTextDrawSetOutline(playerid,Textdraw5[playerid], 1);
    PlayerTextDrawSetProportional(playerid,Textdraw5[playerid], 1);
    PlayerTextDrawTextSize(playerid,Textdraw5[playerid], 344.000000, 20.000000);
    PlayerTextDrawSetSelectable(playerid,Textdraw5[playerid], 1);

YCMD:menu(playerid,params[], help)
{
/*
    for(new i = 0; i < MAX_PLAYER_TEXT_DRAWS; i++)
    {
    PlayerTextDrawSetSelectable(playerid,PlayerText:[i][playerid], 1);
    }
*/



    PlayerTextDrawShow(playerid, PlayerText:Textdraw0[playerid]);
    PlayerTextDrawShow(playerid, PlayerText:Textdraw1[playerid]);
    PlayerTextDrawShow(playerid, PlayerText:Textdraw2[playerid]);
    PlayerTextDrawShow(playerid, PlayerText:Textdraw3[playerid]);
    PlayerTextDrawShow(playerid, PlayerText:Textdraw4[playerid]);
    PlayerTextDrawShow(playerid, PlayerText:Textdraw5[playerid]);
    PlayerTextDrawShow(playerid, PlayerText:Textdraw6[playerid]);
    PlayerTextDrawShow(playerid, PlayerText:Textdraw7[playerid]);
    PlayerTextDrawShow(playerid, PlayerText:Textdraw8[playerid]);
    PlayerTextDrawShow(playerid, PlayerText:Textdraw9[playerid]);
    PlayerTextDrawShow(playerid, PlayerText:Textdraw10[playerid]);
    PlayerTextDrawShow(playerid, PlayerText:Textdraw11[playerid]);
    PlayerTextDrawShow(playerid, PlayerText:Textdraw12[playerid]);
    PlayerTextDrawShow(playerid, PlayerText:Textdraw13[playerid]);
    PlayerTextDrawShow(playerid, PlayerText:Textdraw14[playerid]);
    PlayerTextDrawShow(playerid, PlayerText:Textdraw15[playerid]);
    SelectTextDraw(playerid, 0xFF4040AA);

    return 1;
}

public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid)
{
    if(_:playertextid != INVALID_TEXT_DRAW) // If the player clicked a valid textdraw, continue with the coding. (_:var removes the Text: tag, to avoid tag mismatch)
    {
        if(playertextid == Textdraw5[playerid])
        {
            SendClientMessage(playerid, 0xFFFFFFAA, "You clicked on a textdraw.");
        }
        else if(playertextid == Textdraw4[playerid])
        {
            ShowStats(playerid);
        }
            PlayerTextDrawHide(playerid, PlayerText:Textdraw0[playerid]);
            PlayerTextDrawHide(playerid, PlayerText:Textdraw1[playerid]);
            PlayerTextDrawHide(playerid, PlayerText:Textdraw2[playerid]);
            PlayerTextDrawHide(playerid, PlayerText:Textdraw3[playerid]);
            PlayerTextDrawHide(playerid, PlayerText:Textdraw4[playerid]);
            PlayerTextDrawHide(playerid, PlayerText:Textdraw5[playerid]);
            PlayerTextDrawHide(playerid, PlayerText:Textdraw6[playerid]);
            PlayerTextDrawHide(playerid, PlayerText:Textdraw7[playerid]);
            PlayerTextDrawHide(playerid, PlayerText:Textdraw8[playerid]);
            PlayerTextDrawHide(playerid, PlayerText:Textdraw9[playerid]);
            PlayerTextDrawHide(playerid, PlayerText:Textdraw10[playerid]);
            PlayerTextDrawHide(playerid, PlayerText:Textdraw11[playerid]);
            PlayerTextDrawHide(playerid, PlayerText:Textdraw12[playerid]);
            PlayerTextDrawHide(playerid, PlayerText:Textdraw13[playerid]);
            PlayerTextDrawHide(playerid, PlayerText:Textdraw14[playerid]);
            PlayerTextDrawHide(playerid, PlayerText:Textdraw15[playerid]);
            CancelSelectTextDraw(playerid);


    }
    return 1;
}
When i type /menu all textdraws show's up and when i move mouse over them it changes the color. The problem is when i click them nothing happens , also when i press ESC key textdraw wont hide as supposed to since it's invalid textdraw. I tried many way's to fix this lost hours and hours but i'm unable to find problem. Also was reading wiki all over again and searched on forums. Does anyone know's what i'm mistaking here

NOTE: 11 out of 15 textdraws are clickable other four is a frame
Reply
#2

You can control the clickable area by using PlayerTextDrawTextSize
Reply
#3

Already done that when i hover mouse over color changes for each textdraw only when i click nothing happens
Reply
#4

I really need help with this.... :/
Reply
#5

bump?
Reply
#6

Bump
Reply
#7

After two weeks still no one can help me with this ?
Reply
#8

DO you use include

Do you include has OnPlayerClickPlayerTextDraw in it ?
Reply
#9

Quote:
Originally Posted by Azazelo
Посмотреть сообщение
DO you use include

Do you include has OnPlayerClickPlayerTextDraw in it ?
I have searched trough all includes i use in script and i found it only in //#include <mSelection> . I have disabled this include and tested again and it wont work. When i hover the mouse over textdraw i want , it's color change BUT i can't click on it , also when i press ESC key it should read invalid textdraw and hide it. Instead of that it remains on screen ....
Reply
#10

Try do print under OnPlayerClickPlayerTextDraw

Like this :

OnPlayerClickPlayerTextDraw(clickedid,....
printf("Clicked td : %i",clickedid); // may trow some warning

And see if this will be called with right id of TD
To test TD id after create TD with bug print out his id and compare if is right TD called
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)