SA-MP Forums Archive
Problem with 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: Problem with Clickable Textdraw (/showthread.php?tid=368993)



Problem with Clickable Textdraw - Sanady - 15.08.2012

Hello I created textdraw for choose team but When I craeted for textdraw click it`s working without error but when i join in game I can`t click textdraw...I don`t know why..

pawn Код:
Textdraw0 = TextDrawCreate(260.000000, 189.000000, "_");
    TextDrawBackgroundColor(Textdraw0, 255);
    TextDrawFont(Textdraw0, 1);
    TextDrawLetterSize(Textdraw0, 0.500000, 11.599994);
    TextDrawColor(Textdraw0, -1);
    TextDrawSetOutline(Textdraw0, 0);
    TextDrawSetProportional(Textdraw0, 1);
    TextDrawSetShadow(Textdraw0, 1);
    TextDrawUseBox(Textdraw0, 1);
    TextDrawBoxColor(Textdraw0, 170);
    TextDrawTextSize(Textdraw0, 380.000000, 31.000000);

    Textdraw1 = TextDrawCreate(283.000000, 182.000000, "Team Selection");
    TextDrawBackgroundColor(Textdraw1, 255);
    TextDrawFont(Textdraw1, 2);
    TextDrawLetterSize(Textdraw1, 0.200000, 1.000000);
    TextDrawColor(Textdraw1, -1);
    TextDrawSetOutline(Textdraw1, 1);
    TextDrawSetProportional(Textdraw1, 1);

    Textdraw2 = TextDrawCreate(262.000000, 207.000000, "_");
    TextDrawBackgroundColor(Textdraw2, 255);
    TextDrawFont(Textdraw2, 1);
    TextDrawLetterSize(Textdraw2, 0.500000, 3.000000);
    TextDrawColor(Textdraw2, -1);
    TextDrawSetOutline(Textdraw2, 0);
    TextDrawSetProportional(Textdraw2, 1);
    TextDrawSetShadow(Textdraw2, 1);
    TextDrawUseBox(Textdraw2, 1);
    TextDrawBoxColor(Textdraw2, 714);
    TextDrawTextSize(Textdraw2, 378.000000, 0.000000);

    Textdraw3 = TextDrawCreate(283.000000, 215.000000, "Survivors");
    TextDrawBackgroundColor(Textdraw3, 255);
    TextDrawFont(Textdraw3, 2);
    TextDrawLetterSize(Textdraw3, 0.330000, 1.100000);
    TextDrawColor(Textdraw3, -1);
    TextDrawSetOutline(Textdraw3, 0);
    TextDrawSetProportional(Textdraw3, 1);
    TextDrawSetShadow(Textdraw3, 1);

    Textdraw4 = TextDrawCreate(262.000000, 243.000000, "_");
    TextDrawBackgroundColor(Textdraw4, 255);
    TextDrawFont(Textdraw4, 1);
    TextDrawLetterSize(Textdraw4, 0.500000, 2.899999);
    TextDrawColor(Textdraw4, -1);
    TextDrawSetOutline(Textdraw4, 0);
    TextDrawSetProportional(Textdraw4, 1);
    TextDrawSetShadow(Textdraw4, 1);
    TextDrawUseBox(Textdraw4, 1);
    TextDrawBoxColor(Textdraw4, 255);
    TextDrawTextSize(Textdraw4, 378.000000, 0.000000);

    Textdraw5 = TextDrawCreate(289.000000, 250.000000, "Zombies");
    TextDrawBackgroundColor(Textdraw5, 255);
    TextDrawFont(Textdraw5, 2);
    TextDrawLetterSize(Textdraw5, 0.360000, 1.000000);
    TextDrawColor(Textdraw5, -267774465);
    TextDrawSetOutline(Textdraw5, 0);
    TextDrawSetProportional(Textdraw5, 1);
    TextDrawSetShadow(Textdraw5, 1);

public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
    if(clickedid == Textdraw3)
    {
         SetPlayerTeam(playerid,1);//Survivors
         SpawnPlayer(playerid);
         CancelSelectTextDraw(playerid);
    }
    if(clickedid == Textdraw3)
    {
        SetPlayerTeam(playerid,2);//Zombies
        SpawnPlayer(playerid);
        CancelSelectTextDraw(playerid);
    }
    return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys == KEY_FIRE)
    {
        SelectTextDraw(playerid, 0xA3B4C5FF);
    }
    return 1;
}
Anyone can help me?


Re: Problem with Clickable Textdraw - Sanady - 15.08.2012

Please Help me...


Re: Problem with Clickable Textdraw - AntonioStyles - 15.08.2012

As far as i can see,everything seems to be fine here :/ I am not a good scripter,so i can't really tell,but this doesnt seem to have any error :P


Re: Problem with Clickable Textdraw - Vince - 15.08.2012

Make sure you use TextDrawTextSize properly. If either X or Y in that function is 0 it won't work. Fiddle around with it a little, because I'm not sure what effect it will have on the appearance of the text. Also don't forget to add TextDrawSetSelectable.


Re: Problem with Clickable Textdraw - SaYrOn - 15.08.2012

Код:
TextDrawSetSelectable(Texdraw3, 1);
Maybe this?


Re: Problem with Clickable Textdraw - Sanady - 15.08.2012

Quote:
Originally Posted by Vince
Посмотреть сообщение
Make sure you use TextDrawTextSize properly. If either X or Y in that function is 0 it won't work. Fiddle around with it a little, because I'm not sure what effect it will have on the appearance of the text. Also don't forget to add TextDrawSetSelectable.
Quote:
Originally Posted by SaYrOn
Посмотреть сообщение
Код:
TextDrawSetSelectable(Texdraw3, 1);
Maybe this?
I did what you guys says to me but nothing still not working Anyone can help me fast?? Need help fast!


Re : Problem with Clickable Textdraw - Eony - 15.08.2012

Like SaYrOn said, you have to set the TextDraws selectable (TextDrawSetSelectable(handle, 1);, also, make sure not to mess too much with the size of you TextDraw (TextSize, LetterSize, BoxSize ...), only apply the changes you really need to achieve the shape you want, sometimes changes are not visible, but do have an impact on where you can click and where you can't.


Re: Re : Problem with Clickable Textdraw - Sanady - 15.08.2012

Quote:
Originally Posted by Eony
Посмотреть сообщение
Like SaYrOn said, you have to set the TextDraws selectable (TextDrawSetSelectable(handle, 1);, also, make sure not to mess too much with the size of you TextDraw (TextSize, LetterSize, BoxSize ...), only apply the changes you really need to achieve the shape you want, sometimes changes are not visible, but do have an impact on where you can click and where you can't.
Код:
TextDrawSetSelectable(handle, 1);
I putted it into GamemodeInit...I am doing this first time about clickable textdraw.So I don`t know how to use them...But it`s still not working...


Re : Re: Problem with Clickable Textdraw - Eony - 15.08.2012

Quote:
Originally Posted by Sanady
Посмотреть сообщение
I did what you guys says to me but nothing still not working Anyone can help me fast?? Need help fast!
Better use this :
pawn Код:
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
pawn Код:
if (PRESSED( KEY_FIRE )) {
 // Your code
}

Quote:
Originally Posted by Sanady
Посмотреть сообщение
Код:
TextDrawSetSelectable(handle, 1);
I putted it into GamemodeInit...I am doing this first time about clickable textdraw.So I don`t know how to use them...But it`s still not working...
Does the mouse appear when pressing KEY_FIRE?

If not, then it's simply a problem in your TextDraw sizes.


Re: Re : Re: Problem with Clickable Textdraw - Sanady - 15.08.2012

Quote:
Originally Posted by Eony
Посмотреть сообщение
Better use this :
pawn Код:
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
pawn Код:
if (PRESSED( KEY_FIRE )) {
 // Your code
}



Does the mouse appear when pressing KEY_FIRE?
Still now working




Re: Problem with Clickable Textdraw - SaYrOn - 15.08.2012

Does your code look like this?

Код:
Textdraw3 = TextDrawCreate(283.000000, 215.000000, "Survivors");
    TextDrawBackgroundColor(Textdraw3, 255);
    TextDrawFont(Textdraw3, 2);
    TextDrawLetterSize(Textdraw3, 0.330000, 1.100000);
    TextDrawColor(Textdraw3, -1);
    TextDrawSetOutline(Textdraw3, 0);
    TextDrawSetProportional(Textdraw3, 1);
    TextDrawSetShadow(Textdraw3, 1);
    TextDrawSetSelectable(Textdraw3, 1);



Re : Problem with Clickable Textdraw - Eony - 15.08.2012

Is the mouse appearing when you press KEY_FIRE? If not, try and make a command for the TextDrawSelect, and tell us if the mouse does appear.


Re: Re : Problem with Clickable Textdraw - Sanady - 15.08.2012

Quote:
Originally Posted by SaYrOn
Посмотреть сообщение
Does your code look like this?

Код:
Textdraw3 = TextDrawCreate(283.000000, 215.000000, "Survivors");
    TextDrawBackgroundColor(Textdraw3, 255);
    TextDrawFont(Textdraw3, 2);
    TextDrawLetterSize(Textdraw3, 0.330000, 1.100000);
    TextDrawColor(Textdraw3, -1);
    TextDrawSetOutline(Textdraw3, 0);
    TextDrawSetProportional(Textdraw3, 1);
    TextDrawSetShadow(Textdraw3, 1);
    TextDrawSetSelectable(Textdraw3, 1);
Yes

Quote:
Originally Posted by Eony
Посмотреть сообщение
Is the mouse appearing when you press KEY_FIRE? If not, try and make a command for the TextDrawSelect, and tell us if the mouse does appear.
Mouse is appearing but I can`t click on textdraw
I need help fast!!


Re: Problem with Clickable Textdraw - Sanady - 15.08.2012

Here is screen how it`s looks like




Re: Problem with Clickable Textdraw - caki - 09.02.2013

pawn Код:
TextDrawTextSize(playerid,Textdraw15[playerid], x, y);
Add this to each textdraw but remeber that it must be bigger x and y than the text Survivors (you can do this with box)


Respuesta: Problem with Clickable Textdraw - Spreadhaz - 24.10.2014

I have the same problem but in mSelection. I click textdraws but nothing hapens after click, and when press ESC it doesnt hide.