SA-MP Forums Archive
Clickable textdraws +rep - 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 textdraws +rep (/showthread.php?tid=364404)



Clickable textdraws +rep - EV007 - 30.07.2012

Hello, I got this problem which is really pissing me off. How do i make the textdraw selectable? I followed the tutorials but I still find my textdraws not selectable. Does it have to do something with textsize? If yes, how do I obtain THE RIGHT textsize? Because its 0.00000,72.00000 at the moment. I'm using centered (2) allignment.Any ideas?


Re: Clickable textdraws +rep - newbienoob - 30.07.2012

X = 0.00000 | won't show
Y = 72.00000 | too big


Re: Clickable textdraws +rep - EV007 - 30.07.2012

I used an zamaroths textdraw editor. Allignment 2, and streched the box out, thats how i got my Y size. So how do I get correct ones?

edit: oh sorry its textsize XD


Re: Clickable textdraws +rep - newbienoob - 30.07.2012

Not sure about this one, but you can adjust it later
X = 0.5
Y = 1


Re: Clickable textdraws +rep - EV007 - 30.07.2012

Doesn't work.


Re: Clickable textdraws +rep - newbienoob - 30.07.2012

Show the codes.


Re: Clickable textdraws +rep - BuLLeT[LTU] - 30.07.2012

pawn Код:
public OnPlayerSpawn(playerid)
{
    CreateTeamSelectTextDraws(playerid);
    PlayerTextDrawShow(playerid,TeamText1[playerid]);
    PlayerTextDrawShow(playerid,TeamText2[playerid]);
    PlayerTextDrawShow(playerid,TeamText3[playerid]);
    PlayerTextDrawShow(playerid,TeamText4[playerid]);
    PlayerTextDrawShow(playerid,TeamText5[playerid]);
    PlayerTextDrawShow(playerid,TeamText6[playerid]);
    PlayerTextDrawShow(playerid,TeamText7[playerid]);
    PlayerTextDrawShow(playerid,TeamText8[playerid]);
    PlayerTextDrawShow(playerid,TeamText9[playerid]);
    PlayerTextDrawShow(playerid,TeamText10[playerid]);
    PlayerTextDrawShow(playerid,TeamText11[playerid]);
    PlayerTextDrawShow(playerid,TeamText12[playerid]);
    PlayerTextDrawShow(playerid,TeamText13[playerid]);
    PlayerTextDrawShow(playerid,TeamText14[playerid]);
    PlayerTextDrawShow(playerid,TeamText15[playerid]);
    PlayerTextDrawSetSelectable(playerid,TeamText13[playerid],1);
    PlayerTextDrawSetSelectable(playerid,TeamText14[playerid],1);
    PlayerTextDrawSetSelectable(playerid,TeamText15[playerid],1);
    SelectTextDraw(playerid,0xA3B4C5FF);
    switch (PlayerI[playerid][Team])//TVARKYT kai bus started round turi uzdet tamsia spalva o ne sviesia
    {
        case 0:
        {
            SetPlayerColor(playerid,TeamI[0][Color]);
            SetPlayerSkin(playerid,TeamI[0][Skin]);
        }
        case 1:
        {
            SetPlayerColor(playerid,TeamI[1][Color]);
            SetPlayerSkin(playerid,TeamI[1][Skin]);
        }
        case 2:
        {
            SetPlayerColor(playerid,TeamI[2][Color]);
            SetPlayerSkin(playerid,TeamI[2][Skin]);
        }
    }
    PlayerI[playerid][Spawned] = 1;
    return 1;
}

public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
    if(_:clickedid == INVALID_TEXT_DRAW)
    {
        PlayerTextDrawSetSelectable(playerid,TeamText13[playerid],1);
        PlayerTextDrawSetSelectable(playerid,TeamText14[playerid],1);
        PlayerTextDrawSetSelectable(playerid,TeamText15[playerid],1);
        SelectTextDraw(playerid,0x00FF00FF);
    }
    return 1;
}

public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid)
{
    if(_:playertextid == INVALID_TEXT_DRAW)
    {
        PlayerTextDrawSetSelectable(playerid,TeamText13[playerid],1);
        PlayerTextDrawSetSelectable(playerid,TeamText14[playerid],1);
        PlayerTextDrawSetSelectable(playerid,TeamText15[playerid],1);
        SelectTextDraw(playerid,0x00FF00FF);
    }
    if(playertextid == PlayerText:TeamText13[playerid])
    {
        CancelSelectTextDraw(playerid);
        PlayerTextDrawSetSelectable(playerid,TeamText13[playerid],0);
        PlayerTextDrawSetSelectable(playerid,TeamText14[playerid],0);
        PlayerTextDrawSetSelectable(playerid,TeamText15[playerid],0);
        PlayerI[playerid][Team] = 0;
        if(PlayerI[playerid][InClassSelection] == 1)
        {
            PlayerI[playerid][InClassSelection] = 0;
            PlayerTextDrawHide(playerid,TeamText1[playerid]);
            PlayerTextDrawHide(playerid,TeamText2[playerid]);
            PlayerTextDrawHide(playerid,TeamText3[playerid]);
            PlayerTextDrawHide(playerid,TeamText4[playerid]);
            PlayerTextDrawHide(playerid,TeamText5[playerid]);
            PlayerTextDrawHide(playerid,TeamText6[playerid]);
            PlayerTextDrawHide(playerid,TeamText7[playerid]);
            PlayerTextDrawHide(playerid,TeamText8[playerid]);
            PlayerTextDrawHide(playerid,TeamText9[playerid]);
            PlayerTextDrawHide(playerid,TeamText10[playerid]);
            PlayerTextDrawHide(playerid,TeamText11[playerid]);
            PlayerTextDrawHide(playerid,TeamText12[playerid]);
            PlayerTextDrawHide(playerid,TeamText13[playerid]);
            PlayerTextDrawHide(playerid,TeamText14[playerid]);
            PlayerTextDrawHide(playerid,TeamText15[playerid]);
            DeleteTeamSelectTextDraws(playerid);
        }
    }
    else if(playertextid == PlayerText:TeamText14[playerid])
    {
        CancelSelectTextDraw(playerid);
        PlayerTextDrawSetSelectable(playerid,TeamText13[playerid],0);
        PlayerTextDrawSetSelectable(playerid,TeamText14[playerid],0);
        PlayerTextDrawSetSelectable(playerid,TeamText15[playerid],0);
        PlayerI[playerid][Team] = 1;
        if(PlayerI[playerid][InClassSelection] == 1)
        {
            PlayerI[playerid][InClassSelection] = 0;
            PlayerTextDrawHide(playerid,TeamText1[playerid]);
            PlayerTextDrawHide(playerid,TeamText2[playerid]);
            PlayerTextDrawHide(playerid,TeamText3[playerid]);
            PlayerTextDrawHide(playerid,TeamText4[playerid]);
            PlayerTextDrawHide(playerid,TeamText5[playerid]);
            PlayerTextDrawHide(playerid,TeamText6[playerid]);
            PlayerTextDrawHide(playerid,TeamText7[playerid]);
            PlayerTextDrawHide(playerid,TeamText8[playerid]);
            PlayerTextDrawHide(playerid,TeamText9[playerid]);
            PlayerTextDrawHide(playerid,TeamText10[playerid]);
            PlayerTextDrawHide(playerid,TeamText11[playerid]);
            PlayerTextDrawHide(playerid,TeamText12[playerid]);
            PlayerTextDrawHide(playerid,TeamText13[playerid]);
            PlayerTextDrawHide(playerid,TeamText14[playerid]);
            PlayerTextDrawHide(playerid,TeamText15[playerid]);
            DeleteTeamSelectTextDraws(playerid);
        }
    }
    else if(playertextid == PlayerText:TeamText15[playerid])
    {
        CancelSelectTextDraw(playerid);
        PlayerTextDrawSetSelectable(playerid,TeamText13[playerid],0);
        PlayerTextDrawSetSelectable(playerid,TeamText14[playerid],0);
        PlayerTextDrawSetSelectable(playerid,TeamText15[playerid],0);
        PlayerI[playerid][Team] = 2;
        if(PlayerI[playerid][InClassSelection] == 1)
        {
            PlayerI[playerid][InClassSelection] = 0;
            PlayerTextDrawHide(playerid,TeamText1[playerid]);
            PlayerTextDrawHide(playerid,TeamText2[playerid]);
            PlayerTextDrawHide(playerid,TeamText3[playerid]);
            PlayerTextDrawHide(playerid,TeamText4[playerid]);
            PlayerTextDrawHide(playerid,TeamText5[playerid]);
            PlayerTextDrawHide(playerid,TeamText6[playerid]);
            PlayerTextDrawHide(playerid,TeamText7[playerid]);
            PlayerTextDrawHide(playerid,TeamText8[playerid]);
            PlayerTextDrawHide(playerid,TeamText9[playerid]);
            PlayerTextDrawHide(playerid,TeamText10[playerid]);
            PlayerTextDrawHide(playerid,TeamText11[playerid]);
            PlayerTextDrawHide(playerid,TeamText12[playerid]);
            PlayerTextDrawHide(playerid,TeamText13[playerid]);
            PlayerTextDrawHide(playerid,TeamText14[playerid]);
            PlayerTextDrawHide(playerid,TeamText15[playerid]);
            DeleteTeamSelectTextDraws(playerid);
        }
    }
    return 1;
}

our textdraws:
TeamText13[playerid] = CreatePlayerTextDraw(playerid,91.000000, 229.000000, "Attackers");
    PlayerTextDrawAlignment(playerid,TeamText13[playerid], 2);
    PlayerTextDrawBackgroundColor(playerid,TeamText13[playerid], 255);
    PlayerTextDrawFont(playerid,TeamText13[playerid], 2);
    PlayerTextDrawLetterSize(playerid,TeamText13[playerid], 0.319999, 1.400000);
    PlayerTextDrawColor(playerid,TeamText13[playerid], -2113199732);
    PlayerTextDrawSetOutline(playerid,TeamText13[playerid], 0);
    PlayerTextDrawSetProportional(playerid,TeamText13[playerid], 1);
    PlayerTextDrawSetShadow(playerid,TeamText13[playerid], 1);
    PlayerTextDrawUseBox(playerid,TeamText13[playerid], 1);
    PlayerTextDrawBoxColor(playerid,TeamText13[playerid], 255);
    PlayerTextDrawTextSize(playerid,TeamText13[playerid], 0.000000, 72.000000);
    PlayerTextDrawSetString(playerid,TeamText13[playerid],TeamI[0][Name]);

    TeamText14[playerid] = CreatePlayerTextDraw(playerid,91.000000, 268.000000, "Defenders");
    PlayerTextDrawAlignment(playerid,TeamText14[playerid], 2);
    PlayerTextDrawBackgroundColor(playerid,TeamText14[playerid], 255);
    PlayerTextDrawFont(playerid,TeamText14[playerid], 2);
    PlayerTextDrawLetterSize(playerid,TeamText14[playerid], 0.319999, 1.400000);
    PlayerTextDrawColor(playerid,TeamText14[playerid], 842183820);
    PlayerTextDrawSetOutline(playerid,TeamText14[playerid], 0);
    PlayerTextDrawSetProportional(playerid,TeamText14[playerid], 1);
    PlayerTextDrawSetShadow(playerid,TeamText14[playerid], 1);
    PlayerTextDrawUseBox(playerid,TeamText14[playerid], 1);
    PlayerTextDrawBoxColor(playerid,TeamText14[playerid], 255);
    PlayerTextDrawTextSize(playerid,TeamText14[playerid], 0.000000, 73.000000);
    PlayerTextDrawSetString(playerid,TeamText14[playerid],TeamI[1][Name]);

    TeamText15[playerid] = CreatePlayerTextDraw(playerid,91.000000, 306.000000, "Spectator");
    PlayerTextDrawAlignment(playerid,TeamText15[playerid], 2);
    PlayerTextDrawBackgroundColor(playerid,TeamText15[playerid], 255);
    PlayerTextDrawFont(playerid,TeamText15[playerid], 2);
    PlayerTextDrawLetterSize(playerid,TeamText15[playerid], 0.319999, 1.400000);
    PlayerTextDrawColor(playerid,TeamText15[playerid], -1768515956);
    PlayerTextDrawSetOutline(playerid,TeamText15[playerid], 0);
    PlayerTextDrawSetProportional(playerid,TeamText15[playerid], 1);
    PlayerTextDrawSetShadow(playerid,TeamText15[playerid], 1);
    PlayerTextDrawUseBox(playerid,TeamText15[playerid], 1);
    PlayerTextDrawBoxColor(playerid,TeamText15[playerid], 255);
    PlayerTextDrawTextSize(playerid,TeamText15[playerid], 0.000000, 73.000000);
    PlayerTextDrawSetString(playerid,TeamText15[playerid],TeamI[2][Name]);



Re: Clickable textdraws +rep - EV007 - 30.07.2012

We're working together with the person above, the code he posted is what we have. Any help?


Re: Clickable textdraws +rep - Benjo - 30.07.2012

To answer your original post, yes, it will not be selectable because of the text size. When using PlayerTextDrawTextSize on a textdraw with alignment 2, the Float: x is the height of the textdraw and the Float: y is the width. So in your case you have a textdraw that is selectable at 72.00 wide, but 0.00 height, therefore not selectable at all. Change it so that the Float: x is 10.00.

You may well find that the size of your textdraw does not change, but that the selectable area will. If that works for you, experiment a bit with it until you get a nice fit.


Re: Clickable textdraws +rep - EV007 - 31.07.2012

I changed X many times. 10,36,100 etc etc. And I still find it not clickable. I have no idea whats wrong..