I'm confused with textdraws -
Antoniohl - 14.07.2015
Код:
PlayerData[playerid][pTextdraws][2] = CreatePlayerTextDraw(playerid, 422.263641, 184.666702, "_");
PlayerTextDrawLetterSize(playerid, PlayerData[playerid][pTextdraws][2], 0.504992, 2.023329);
PlayerTextDrawTextSize(playerid, PlayerData[playerid][pTextdraws][2], 226.114166, 11.083333);
PlayerTextDrawAlignment(playerid, PlayerData[playerid][pTextdraws][2], 1);
PlayerTextDrawColor(playerid, PlayerData[playerid][pTextdraws][2], 0);
PlayerTextDrawUseBox(playerid, PlayerData[playerid][pTextdraws][2], 1);
PlayerTextDrawBoxColor(playerid, PlayerData[playerid][pTextdraws][2], 1077952576);
PlayerTextDrawSetShadow(playerid, PlayerData[playerid][pTextdraws][2], 0);
PlayerTextDrawSetOutline(playerid, PlayerData[playerid][pTextdraws][2], 0);
PlayerTextDrawFont(playerid, PlayerData[playerid][pTextdraws][2], 0);
PlayerTextDrawSetSelectable(playerid, PlayerData[playerid][pTextdraws][2], 1);
PlayerData[playerid][pTextdraws][3] = CreatePlayerTextDraw(playerid, 422.480316, 238.916671, "_");
PlayerTextDrawLetterSize(playerid, PlayerData[playerid][pTextdraws][3], -0.385123, 2.029999);
PlayerTextDrawTextSize(playerid, PlayerData[playerid][pTextdraws][3], 227.106872, 73.499977);
PlayerTextDrawAlignment(playerid, PlayerData[playerid][pTextdraws][3], 1);
PlayerTextDrawColor(playerid, PlayerData[playerid][pTextdraws][3], 0);
PlayerTextDrawUseBox(playerid, PlayerData[playerid][pTextdraws][3], 1);
PlayerTextDrawBoxColor(playerid, PlayerData[playerid][pTextdraws][3], 1077952576);
PlayerTextDrawSetShadow(playerid, PlayerData[playerid][pTextdraws][3], 0);
PlayerTextDrawSetOutline(playerid, PlayerData[playerid][pTextdraws][3], 0);
PlayerTextDrawFont(playerid, PlayerData[playerid][pTextdraws][3], 0);
PlayerTextDrawSetSelectable(playerid, PlayerData[playerid][pTextdraws][3], 1);
PlayerData[playerid][pTextdraws][4] = CreatePlayerTextDraw(playerid, 422.732086, 295.499969, "_");
PlayerTextDrawLetterSize(playerid, PlayerData[playerid][pTextdraws][4], 0.005621, 1.812500);
PlayerTextDrawTextSize(playerid, PlayerData[playerid][pTextdraws][4], 227.106887, 0.000000);
PlayerTextDrawAlignment(playerid, PlayerData[playerid][pTextdraws][4], 1);
PlayerTextDrawColor(playerid, PlayerData[playerid][pTextdraws][4], 0);
PlayerTextDrawUseBox(playerid, PlayerData[playerid][pTextdraws][4], 1);
PlayerTextDrawBoxColor(playerid, PlayerData[playerid][pTextdraws][4], 1077952576);
PlayerTextDrawSetShadow(playerid, PlayerData[playerid][pTextdraws][4], 0);
PlayerTextDrawSetOutline(playerid, PlayerData[playerid][pTextdraws][4], 0);
PlayerTextDrawFont(playerid, PlayerData[playerid][pTextdraws][4], 0);
PlayerTextDrawSetSelectable(playerid, PlayerData[playerid][pTextdraws][4], 1);
What the heck is wrong with it, it doesn't want to be selectable.
im using ipleomox textdraw editor
Re: I'm confused with textdraws -
MasterReturnz - 14.07.2015
Did you callback OnPlayerClickTextDraw?
Re: I'm confused with textdraws -
Antoniohl - 14.07.2015
Yea, it was working before i just changed that textdraw, i made them looks better. and yes it's called with the same id.
Re: I'm confused with textdraws -
Virtual1ty - 15.07.2015
When you're trying to make a selectable textdraw box follow these tips: create the box so it always goes to the right and not to the left, it won't be selectable if you make it to the left; usually the second parameter of TextDrawLetterSize determines the height of the box, you can also add "~n~" to the string; the parameters of TextDrawTextSize are what determines the "surrounding box" for the textdraw, usually the first parameter determines the width of a textdraw box so you only change the second parameter which should be the height of a box, but isn't - that's your selectable area height which you need to find out by trial and error.
I made this code based on your textdraws, modified their positions a little, and it works:
PHP код:
#define FILTERSCRIPT
#include <a_samp>
new Text:tdSelectTest[3];
public OnFilterScriptInit()
{
CreateDraws();
return 1;
}
public OnFilterScriptExit()
{
DestroyDraws();
return 1;
}
public OnPlayerSpawn(playerid)
{
ShowDrawsForPlayer(playerid);
return 1;
}
DestroyDraws()
{
TextDrawHideForAll(tdSelectTest[0]), TextDrawHideForAll(tdSelectTest[1]), TextDrawHideForAll(tdSelectTest[2]),
TextDrawDestroy (tdSelectTest[0]), TextDrawDestroy (tdSelectTest[1]), TextDrawDestroy (tdSelectTest[2]);
}
ShowDrawsForPlayer(playerid)
{
TextDrawShowForPlayer(playerid, tdSelectTest[0]),
TextDrawShowForPlayer(playerid, tdSelectTest[1]),
TextDrawShowForPlayer(playerid, tdSelectTest[2]);
SelectTextDraw(playerid, 0xFF0000AA);
}
CreateDraws()
{
tdSelectTest[0] = TextDrawCreate(230.000000, 180.000000, "_");
TextDrawLetterSize(tdSelectTest[0], 0.000000, 2.000000);
TextDrawTextSize(tdSelectTest[0], 420.000000, 22.000000);
TextDrawAlignment(tdSelectTest[0], 1);
TextDrawColor(tdSelectTest[0], 0);
TextDrawUseBox(tdSelectTest[0], true);
TextDrawBoxColor(tdSelectTest[0], 1077952576);
TextDrawSetShadow(tdSelectTest[0], 0);
TextDrawSetOutline(tdSelectTest[0], 0);
TextDrawFont(tdSelectTest[0], 0);
TextDrawSetSelectable(tdSelectTest[0], true);
tdSelectTest[1] = TextDrawCreate(230.000000, 240.000000, "_");
TextDrawLetterSize(tdSelectTest[1], 0.000000, 2.000000);
TextDrawTextSize(tdSelectTest[1], 420.000000, 22.000000);
TextDrawAlignment(tdSelectTest[1], 1);
TextDrawColor(tdSelectTest[1], 0);
TextDrawUseBox(tdSelectTest[1], true);
TextDrawBoxColor(tdSelectTest[1], 1077952576);
TextDrawSetShadow(tdSelectTest[1], 0);
TextDrawSetOutline(tdSelectTest[1], 0);
TextDrawFont(tdSelectTest[1], 0);
TextDrawSetSelectable(tdSelectTest[1], true);
tdSelectTest[2] = TextDrawCreate(230.000000, 300.000000, "_");
TextDrawLetterSize(tdSelectTest[2], 0.000000, 2.000000);
TextDrawTextSize(tdSelectTest[2], 420.000000, 22.000000);
TextDrawAlignment(tdSelectTest[2], 1);
TextDrawColor(tdSelectTest[2], 0);
TextDrawUseBox(tdSelectTest[2], true);
TextDrawBoxColor(tdSelectTest[2], 1077952576);
TextDrawSetShadow(tdSelectTest[2], 0);
TextDrawSetOutline(tdSelectTest[2], 0);
TextDrawFont(tdSelectTest[2], 0);
TextDrawSetSelectable(tdSelectTest[2], true);
}
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
if (clickedid == tdSelectTest[0])
{
SendClientMessage(playerid, -1, "First");
}
if (clickedid == tdSelectTest[1])
{
SendClientMessage(playerid, -1, "Secnd");
}
if (clickedid == tdSelectTest[2])
{
SendClientMessage(playerid, -1, "Third");
}
}