Derpie doesn't understand Clickable Textdraws, frustrating!
#1

Ohello!

Alright.. so.. As I decided to take a first look at clickable textdraws, I found my first issue. I knew I had to use "TextDrawTextSize", however, that whole part is frustrating me like crazy! I'm spending time on one line since 12:00 PM (It's 7:50 PM now, spent 7 hours.). I decided to ask some help from the people who know more about this than me.

Alright, so I made a simple, small box. I want to make it clickable.
I'm talking about this box:
pawn Код:
Timerdraw[0] = CreatePlayerTextDraw(playerid, 55.666656, 91.099945, "box");
    PlayerTextDrawLetterSize(playerid, Timerdraw[0], 0.000000, 2.433331);
    PlayerTextDrawTextSize(playerid, Timerdraw[0], 17.666648, 24.888879);
    PlayerTextDrawAlignment(playerid, Timerdraw[0], 1);
    PlayerTextDrawColor(playerid, Timerdraw[0], 0);
    PlayerTextDrawUseBox(playerid, Timerdraw[0], true);
    PlayerTextDrawBoxColor(playerid, Timerdraw[0], 102);
    PlayerTextDrawSetShadow(playerid, Timerdraw[0], 0);
    PlayerTextDrawSetOutline(playerid, Timerdraw[0], 0);
    PlayerTextDrawFont(playerid, Timerdraw[0], 0);
    PlayerTextDrawSetSelectable(playerid, Timerdraw[0], true);
The TextdrawTextSize I am using now, is the first time the box actually doesn't changes it's size. HOWEVER.. I can click on the whole freaking screen and then my server tells me "Hai".
pawn Код:
public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid)
{
    if(playertextid == Timerdraw[5])
    {
        SendClientMessageToAll(0xFFFFFFAA, "Hai");
    }
    return 1;
}
I'd like to ask if there is someone who could help me to get the right size, and explain me how it works? I know the first size parameter is X, the second is Y. I know X is horizontal, Y is vertical.
Reply
#2

Is there anyone able to explain me how it works?
Reply
#3

You can checkout this tutorial. It helps a lot, trust me.

Link: https://sampforum.blast.hk/showthread.php?tid=328267
Reply
#4

Darn! I suck at searching.. If I knew that tutorial existed, I wouldn't post this! Thank you
Reply
#5

Quote:
Originally Posted by Biesmen
Посмотреть сообщение
Darn! I suck at searching.. If I knew that tutorial existed, I wouldn't post this! Thank you
You're welcome. We all miss something.
Reply
#6

SelectTextDraw(playerid, hovercolor);
ready here
https://sampwiki.blast.hk/wiki/TextDrawTextSize it's hard to get right size, are you using ingame textdraw editor or something ?

https://sampwiki.blast.hk/wiki/SelectTextDraw
and
https://sampwiki.blast.hk/wiki/CancelSelectTextDraw
Reply
#7

The tutorial unfortunately doesn't explain how to make boxes clickable, so Hiddos's tutorial isn't really helping me

@Jewell; I've actually tried two editors. Zamaroht's and iPleomax's. With some sort of trick with iPleomax's editor, I got the correct size for TextDrawTextSize. By using a normal textdraw, change the text to a dot, move it to the upper right corner (using alignment 1) then change it's size to the down-left corner, it will give me the exact size of the box. However, when I'm using that it still doesn't work.

Obviously I'm using SelectTextDraw
Reply
#8

Код:
    Timerdraw[0] = CreatePlayerTextDraw(playerid, 55.666656, 91.099945, "box");
    PlayerTextDrawLetterSize(playerid, Timerdraw[0], 0.000000, 2.433331);
    PlayerTextDrawTextSize(playerid, Timerdraw[0], 17.666648, 24.888879);
    PlayerTextDrawAlignment(playerid, Timerdraw[0], 1);
    PlayerTextDrawColor(playerid, Timerdraw[0], 0);
    PlayerTextDrawUseBox(playerid, Timerdraw[0], true);
    PlayerTextDrawBoxColor(playerid, Timerdraw[0], 102);
    PlayerTextDrawSetShadow(playerid, Timerdraw[0], 0);
    PlayerTextDrawSetOutline(playerid, Timerdraw[0], 0);
    PlayerTextDrawFont(playerid, Timerdraw[0], 0);
    PlayerTextDrawSetSelectable(playerid, Timerdraw[0], true);
    SelectTextDraw(playerid, 0xA3B4C5FF); // Allow to player to select textdraws.
PHP код:
public OnPlayerClickPlayerTextDraw(playeridPlayerText:playertextid)
{
    if(
playertextid == Timerdraw[0])
    {
        
SendClientMessageToAll(0xFFFFFFAA"Hai");
    }
    return 
1;

Reply
#9

I'm sorry, what did you change? The SelectTextDraw function is being called when the user types /test.
Reply
#10

the SelectTextDraw(playerid, 0xA3B4C5FF); to the player to select textdraws.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)