OnPlayerClickTextDraw
#1

pawn Код:
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
    if(clickedid == CommandHelp[3])
    {
        for(new i = 0; i < sizeof(TextDraw); i++)
        {
        TextDrawShowForPlayer(playerid, Generalcmds[i]);
        TextDrawHideForPlayer(playerid, CommandHelp[i]);
        }
    }
    else if(clickedid == CommandHelp[4])
    {
        SetPlayerPos(playerid, -1424.6083, -290.9622, 14.1484);
        SetPlayerFacingAngle(playerid, 134.9570);
    }
    else if(clickedid == CommandHelp[5])
    {
        SetPlayerPos(playerid, 1688.7990, 1447.7753, 10.7675);
        SetPlayerFacingAngle(playerid, 267.3902);
    }

                     // Hide the textdraws after the player has teleport himself.
        for(new i = 0; i < sizeof(TextDraw); i++)
        {
        TextDrawHideForPlayer(playerid, Generalcmds[i]);
        //TextDrawHideForPlayer(playerid, CommandHelp[i]);
        }

    CancelSelectTextDraw(playerid);
    return 1;
}
pawn Код:
CMD:cmdds(playerid)
{
    for(new i = 0; i < sizeof(TextDraw); i++)
    {
    TextDrawShowForPlayer(playerid, CommandHelp[i]);
    SelectTextDraw(playerid, RED);
    }
    return 1;
}
pawn Код:
CommandHelp[3] = TextDrawCreate(13.118605, 175.000091, "click here here ! :D");
TextDrawLetterSize(CommandHelp[3], 0.449999, 1.600000);
TextDrawAlignment(CommandHelp[3], 1);
TextDrawColor(CommandHelp[3], -1);
TextDrawSetShadow(CommandHelp[3], 0);
TextDrawSetOutline(CommandHelp[3], 1);
TextDrawBackgroundColor(CommandHelp[3], 51);
TextDrawFont(CommandHelp[3], 1);
TextDrawSetProportional(CommandHelp[3], 1);
pawn Код:
new Text: CommandHelp[9];
The problem is in game it shows the arrow but when I hover over it , it does not show the color nor does it let me click on it -_-
Reply
#2

pawn Код:
for(new i = 0; i < sizeof(TextDraw); i++)
        {
        TextDrawHideForPlayer(playerid, Generalcmds[i]);
        //TextDrawHideForPlayer(playerid, CommandHelp[i]);
        }
I changed DrawHideForPlayer on Generalcmds[i] to
DrawShowForPlayer and now when I click escape it shows generalcmds
Reply
#3

...........................
Reply
#4

zzzzzzzzzzzzzzzzzzzzzzzzzzzzz
Reply
#5

zzzzzzzzzzzzzzzzzzzzzzzz
Reply
#6

zzzzzzzzzzzzzzzzzzzzz
Reply
#7

This has happened me before many times. You need to set the textdraw's text size otherwise it will not work. It's not the same as LetterSize, LetterSize defines the text/characters size and TextSize defines the clickable area for use with TextDrawSetSelectable, whether a box is shown or not.

https://sampwiki.blast.hk/wiki/TextDrawTextSize
Reply
#8

I have textdrawsize for the box but why not for the letters?
What size am I ment to set them now whats default to make them clickable?
Reply
#9

okey, lets say, this is your textdraw:
Код:
	AT_M_TD[3] = TextDrawCreate(179.000000, 336.000000, "News-Heli~n~~g~120000$");
	TextDrawBackgroundColor(AT_M_TD[3], 255);
	TextDrawFont(AT_M_TD[3], 1);
	TextDrawLetterSize(AT_M_TD[3], 0.500000, 1.200000);
	TextDrawColor(AT_M_TD[3], -1);
	TextDrawSetOutline(AT_M_TD[3], 0);
	TextDrawSetProportional(AT_M_TD[3], 1);
	TextDrawSetShadow(AT_M_TD[3], 1);
	TextDrawUseBox(AT_M_TD[3], 1);
	TextDrawBoxColor(AT_M_TD[3], -2038003969);
	TextDrawTextSize(AT_M_TD[3], 256.000000, 0.000000);
now if you would like to make it clickable, we add
"TextDrawSetSelectable(AT_M_TD[3],1);"
to it. But we're not done yet, to tell the server wich area is clickable,
we edit: "TextDrawTextSize(AT_M_TD[3], 256.000000, 0.000000);"
we will edit the Y acis part, as the X axis is always fine.
lets say we add 22 to the Y axis, the textdraw would now look like:
Код:
	AT_M_TD[3] = TextDrawCreate(179.000000, 336.000000, "News-Heli~n~~g~120000$");
	TextDrawBackgroundColor(AT_M_TD[3], 255);
	TextDrawFont(AT_M_TD[3], 1);
	TextDrawLetterSize(AT_M_TD[3], 0.500000, 1.200000);
	TextDrawColor(AT_M_TD[3], -1);
	TextDrawSetOutline(AT_M_TD[3], 0);
	TextDrawSetProportional(AT_M_TD[3], 1);
	TextDrawSetShadow(AT_M_TD[3], 1);
	TextDrawUseBox(AT_M_TD[3], 1);
	TextDrawBoxColor(AT_M_TD[3], -2038003969);
	TextDrawTextSize(AT_M_TD[3], 256.000000, 22.000000);
	TextDrawSetSelectable(AT_M_TD[3],1);
and is clickable
Reply
#10

Oh you put it under the textdraw -_- Thank You Very Much
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)