SA-MP Forums Archive
Derpie doesn't understand Clickable Textdraws, frustrating! - 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: Derpie doesn't understand Clickable Textdraws, frustrating! (/showthread.php?tid=412343)



Derpie doesn't understand Clickable Textdraws, frustrating! - Biesmen - 01.02.2013

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.


Re: Derpie doesn't understand Clickable Textdraws, frustrating! - Biesmen - 02.02.2013

Is there anyone able to explain me how it works?


Re: Derpie doesn't understand Clickable Textdraws, frustrating! - Cameryn - 02.02.2013

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

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


Re: Derpie doesn't understand Clickable Textdraws, frustrating! - Biesmen - 02.02.2013

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


Re: Derpie doesn't understand Clickable Textdraws, frustrating! - Cameryn - 02.02.2013

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.


Re: Derpie doesn't understand Clickable Textdraws, frustrating! - Jewell - 02.02.2013

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


Re: Derpie doesn't understand Clickable Textdraws, frustrating! - Biesmen - 02.02.2013

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


Re : Derpie doesn't understand Clickable Textdraws, frustrating! - yusei - 02.02.2013

Код:
    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;




Re: Derpie doesn't understand Clickable Textdraws, frustrating! - Biesmen - 02.02.2013

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


Re : Derpie doesn't understand Clickable Textdraws, frustrating! - yusei - 02.02.2013

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