SA-MP Forums Archive
Clickable textdraw - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Clickable textdraw (/showthread.php?tid=525307)



Clickable textdraw - printer - 11.07.2014

Whenever I try to click the textdraw to select it selects them all and doesn't do anything, here's the code:

pawn Код:
BoxTD = TextDrawCreate(630.000000, 264.000000, "              ");
    TextDrawBackgroundColor(BoxTD, 255);
    TextDrawFont(BoxTD, 1);
    TextDrawLetterSize(BoxTD, 0.500000, 1.000000);
    TextDrawColor(BoxTD, -1);
    TextDrawSetOutline(BoxTD, 0);
    TextDrawSetProportional(BoxTD, 1);
    TextDrawSetShadow(BoxTD, 1);
    TextDrawUseBox(BoxTD, 1);
    TextDrawBoxColor(BoxTD, -1);
    TextDrawTextSize(BoxTD, 517.000000, 3.000000);

    LockTD = TextDrawCreate(524.000000, 270.000000, "Lock house");
    TextDrawBackgroundColor(LockTD, 255);
    TextDrawFont(LockTD, 1);
    TextDrawLetterSize(LockTD, 0.349999, 1.400000);
    TextDrawColor(LockTD, 255);
    TextDrawSetOutline(LockTD, 0);
    TextDrawSetProportional(LockTD, 1);
    TextDrawSetShadow(LockTD, 0);

    RentTD = TextDrawCreate(524.000000, 287.000000, "Rent options");
    TextDrawBackgroundColor(RentTD, 255);
    TextDrawFont(RentTD, 1);
    TextDrawLetterSize(RentTD, 0.349999, 1.400000);
    TextDrawColor(RentTD, 255);
    TextDrawSetOutline(RentTD, 0);
    TextDrawSetProportional(RentTD, 1);
    TextDrawSetShadow(RentTD, 0);

    SellTD = TextDrawCreate(524.000000, 304.000000, "Sell house");
    TextDrawBackgroundColor(SellTD, 255);
    TextDrawFont(SellTD, 1);
    TextDrawLetterSize(SellTD, 0.349999, 1.400000);
    TextDrawColor(SellTD, 255);
    TextDrawSetOutline(SellTD, 0);
    TextDrawSetProportional(SellTD, 1);
    TextDrawSetShadow(SellTD, 0);

    DetailsTD = TextDrawCreate(524.000000, 321.000000, "House details");
    TextDrawBackgroundColor(DetailsTD, 255);
    TextDrawFont(DetailsTD, 1);
    TextDrawLetterSize(DetailsTD, 0.349999, 1.400000);
    TextDrawColor(DetailsTD, 255);
    TextDrawSetOutline(DetailsTD, 0);
    TextDrawSetProportional(DetailsTD, 1);
    TextDrawSetShadow(DetailsTD, 0);

    ListTD = TextDrawCreate(524.000000, 338.000000, "List tenants");
    TextDrawBackgroundColor(ListTD, 255);
    TextDrawFont(ListTD, 1);
    TextDrawLetterSize(ListTD, 0.349999, 1.400000);
    TextDrawColor(ListTD, 255);
    TextDrawSetOutline(ListTD, 0);
    TextDrawSetProportional(ListTD, 1);
    TextDrawSetShadow(ListTD, 0);

    SignTD = TextDrawCreate(524.000000, 355.000000, "Put sign");
    TextDrawBackgroundColor(SignTD, 255);
    TextDrawFont(SignTD, 1);
    TextDrawLetterSize(SignTD, 0.349999, 1.400000);
    TextDrawColor(SignTD, 255);
    TextDrawSetOutline(SignTD, 0);
    TextDrawSetProportional(SignTD, 1);
    TextDrawSetShadow(SignTD, 0);
   
    TextDrawSetSelectable(BoxTD, false);
    TextDrawSetSelectable(LockTD, true);
    TextDrawSetSelectable(RentTD, true);
    TextDrawSetSelectable(SellTD, true);
    TextDrawSetSelectable(DetailsTD, true);
    TextDrawSetSelectable(ListTD, true);
    TextDrawSetSelectable(SignTD, true);
pawn Код:
CMD:house(playerid,params[])
{
    for(new i=0;i<MAX_HOUSES;i++)
    {
        if(IsPlayerInRangeOfPoint(playerid,3.0,HouseInfo[i][hEntrance][0],HouseInfo[i][hEntrance][1],HouseInfo[i][hEntrance][2]))
        {
            TextDrawShowForPlayer(playerid,BoxTD);
            TextDrawShowForPlayer(playerid,LockTD);
            TextDrawShowForPlayer(playerid,RentTD);
            TextDrawShowForPlayer(playerid,SellTD);
            TextDrawShowForPlayer(playerid,DetailsTD);
            TextDrawShowForPlayer(playerid,ListTD);
            TextDrawShowForPlayer(playerid,SignTD);
            SelectTextDraw(playerid, 0xA3B4C5FF);
        }
    }
    return 1;
}
pawn Код:
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
    if(_:clickedid != INVALID_TEXT_DRAW)
    {
        if(clickedid == LockTD)
        {
            SendClientMessage(playerid,C_WHITE,"test");
        }
    }
    return 1;
}



Re: Clickable textdraw - ikey07 - 11.07.2014

You need to add box parameter to your textdraw as it set the clickable area in your case.
13.0 would be reasonable height

pawn Код:
TextDrawUseBox(TD, 1);
TextDrawBoxColor(TD, 0xffffff00);
TextDrawTextSize(TD, width, height);



Re: Clickable textdraw - printer - 11.07.2014

Quote:
Originally Posted by ikey07
Посмотреть сообщение
You need to add box parameter to your textdraw as it set the clickable area in your case.
13.0 would be reasonable height

pawn Код:
TextDrawUseBox(TD, 1);
TextDrawBoxColor(TD, 0xffffff00);
TextDrawTextSize(TD, width, height);
How much width?