SA-MP Forums Archive
Problem with SelectTextDraw - 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 SelectTextDraw (/showthread.php?tid=519040)



Problem with SelectTextDraw - deathrunner - 12.06.2014

Here is the problem:https://www.youtube.com/watch?v=sgDa...ature=*********

Код:
Login_Textdraw7 = CreatePlayerTextDraw(playerid,240.000000, 245.000000, "News 1: Blablablablablablablablabla");
	PlayerTextDrawBackgroundColor(playerid,Login_Textdraw7, 255);
	PlayerTextDrawFont(playerid,Login_Textdraw7, 1);
	PlayerTextDrawLetterSize(playerid,Login_Textdraw7, 0.250000, 1.200000);
	PlayerTextDrawColor(playerid,Login_Textdraw7, -1);
	PlayerTextDrawSetOutline(playerid,Login_Textdraw7, 0);
	PlayerTextDrawSetProportional(playerid,Login_Textdraw7, 1);
	PlayerTextDrawSetShadow(playerid,Login_Textdraw7, 1);
	PlayerTextDrawSetSelectable(playerid,Login_Textdraw7, 1);

	Login_Textdraw8 = CreatePlayerTextDraw(playerid,240.000000, 265.000000, "News 2: Blablablablablablablablabla");
	PlayerTextDrawBackgroundColor(playerid,Login_Textdraw8, 255);
	PlayerTextDrawFont(playerid,Login_Textdraw8, 1);
	PlayerTextDrawLetterSize(playerid,Login_Textdraw8, 0.250000, 1.200000);
	PlayerTextDrawColor(playerid,Login_Textdraw8, -1);
	PlayerTextDrawSetOutline(playerid,Login_Textdraw8, 0);
	PlayerTextDrawSetProportional(playerid,Login_Textdraw8, 1);
	PlayerTextDrawSetShadow(playerid,Login_Textdraw8, 1);
	PlayerTextDrawSetSelectable(playerid,Login_Textdraw8, 1);

	Login_Textdraw9 = CreatePlayerTextDraw(playerid,240.000000, 285.000000, "News 3: Blablablablablablablablabla");
	PlayerTextDrawBackgroundColor(playerid,Login_Textdraw9, 255);
	PlayerTextDrawFont(playerid,Login_Textdraw9, 1);
	PlayerTextDrawLetterSize(playerid,Login_Textdraw9, 0.250000, 1.200000);
	PlayerTextDrawColor(playerid,Login_Textdraw9, -1);
	PlayerTextDrawSetOutline(playerid,Login_Textdraw9, 0);
	PlayerTextDrawSetProportional(playerid,Login_Textdraw9, 1);
	PlayerTextDrawSetShadow(playerid,Login_Textdraw9, 1);
	PlayerTextDrawSetSelectable(playerid,Login_Textdraw9, 1);

	Login_Textdraw10 = CreatePlayerTextDraw(playerid,240.000000, 305.000000, "News 4: Blablablablablablablablabla");
	PlayerTextDrawBackgroundColor(playerid,Login_Textdraw10, 255);
	PlayerTextDrawFont(playerid,Login_Textdraw10, 1);
	PlayerTextDrawLetterSize(playerid,Login_Textdraw10, 0.250000, 1.200000);
	PlayerTextDrawColor(playerid,Login_Textdraw10, -1);
	PlayerTextDrawSetOutline(playerid,Login_Textdraw10, 0);
	PlayerTextDrawSetProportional(playerid,Login_Textdraw10, 1);
	PlayerTextDrawSetShadow(playerid,Login_Textdraw10, 1);
	PlayerTextDrawSetSelectable(playerid,Login_Textdraw10, 1);

	Login_Textdraw11 = CreatePlayerTextDraw(playerid,240.000000, 325.000000, "News 5: Blablablablablablablablabla");
	PlayerTextDrawBackgroundColor(playerid,Login_Textdraw11, 255);
	PlayerTextDrawFont(playerid,Login_Textdraw11, 1);
	PlayerTextDrawLetterSize(playerid,Login_Textdraw11, 0.250000, 1.200000);
	PlayerTextDrawColor(playerid,Login_Textdraw11, -1);
	PlayerTextDrawSetOutline(playerid,Login_Textdraw11, 0);
	PlayerTextDrawSetProportional(playerid,Login_Textdraw11, 1);
	PlayerTextDrawSetShadow(playerid,Login_Textdraw11, 1);
	PlayerTextDrawSetSelectable(playerid,Login_Textdraw11, 1);
Код:
PlayerTextDrawShow(playerid, Login_Textdraw7);
PlayerTextDrawShow(playerid, Login_Textdraw8);
PlayerTextDrawShow(playerid, Login_Textdraw9);
PlayerTextDrawShow(playerid, Login_Textdraw10);
PlayerTextDrawShow(playerid, Login_Textdraw11);
SelectTextDraw(playerid, 0xFFFFFF);
with cant select one??
pls help


Re: Problem with SelectTextDraw - sl!x - 12.06.2014

so you want to click on them or what?


Re: Problem with SelectTextDraw - deathrunner - 12.06.2014

yes, but he select all, if you see in the video


Re: Problem with SelectTextDraw - Faisal_khan - 12.06.2014

Change PlayerTextDrawLetterSize by small value till the problem is fixed.


Re: Problem with SelectTextDraw - sl!x - 12.06.2014

try to add this at the bottom of gamemode init
Код:
	TextDrawSetSelectable(Login_Textdraw11, true);
	TextDrawSetSelectable(Login_Textdraw10, true);
	TextDrawSetSelectable(Login_Textdraw9, true);
	TextDrawSetSelectable(Login_Textdraw7, true);
	TextDrawSetSelectable(Login_Textdraw8, true);
and you should also have this
Код:
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
    if(_:clickedid != INVALID_TEXT_DRAW) // If the player clicked a valid textdraw, continue with the coding. (_:var removes the Text: tag, to avoid tag mismatch)
    {
        if(clickedid == Login_Textdraw11)
        {
        //write what you want the script to do when the click on the dialog
        }
        else if(clickedid == Login_Textdraw10)
        {
        //write what you want the script to do when the click on the dialog
        }
        else if(clickedid == Login_Textdraw9)
        {
        //write what you want the script to do when the click on the dialog
        }
        else if(clickedid == Login_Textdraw8)
        {
        //write what you want the script to do when the click on the dialog
        }
        else if(clickedid == Login_Textdraw7)
        {
        //write what you want the script to do when the click on the dialog
        }

        TextDrawHideForPlayer(playerid, Login_Textdraw11);
        TextDrawHideForPlayer(playerid, Login_Textdraw10);
        TextDrawHideForPlayer(playerid, Login_Textdraw9);
        TextDrawHideForPlayer(playerid, Login_Textdraw8);
        TextDrawHideForPlayer(playerid, Login_Textdraw7);
        CancelSelectTextDraw(playerid); // This will indeed call OnPlayerClickTextDraw again, but with an ID of 65535. The code above stops it from resulting in an eternal loop.
    }
    return 1;
}



Re: Problem with SelectTextDraw - deathrunner - 12.06.2014

i use playertextdraws, shouldnt i use
OnPlayerClickPlayerTextDraw(playerid, PlayerTextlayertextid)
instead of
OnPlayerClickTextDraw(playerid, Text:clickedid)

and
"try to add this at the bottom of gamemode init "
i create the textdraws with onplayerconnect


Re: Problem with SelectTextDraw - Faisal_khan - 12.06.2014

Have you tried what I said?


Re: Problem with SelectTextDraw - deathrunner - 12.06.2014

and
"try to add this at the bottom of gamemode init "
i create the textdraws with onplayerconnect

//edit: you mean i should create the textdraws with gamemod init and only show it the player or?


Re: Problem with SelectTextDraw - sl!x - 12.06.2014

actually i think both would work correct but you have to add this code at the bottom of them
Код:
	TextDrawSetSelectable(Login_Textdraw11, true);
	TextDrawSetSelectable(Login_Textdraw10, true);
	TextDrawSetSelectable(Login_Textdraw9, true);
	TextDrawSetSelectable(Login_Textdraw7, true);
	TextDrawSetSelectable(Login_Textdraw8, true);



Re: Problem with SelectTextDraw - deathrunner - 12.06.2014

i cant use
Код:
TextDrawSetSelectable(Login_Textdraw11, true);
	TextDrawSetSelectable(Login_Textdraw10, true);
	TextDrawSetSelectable(Login_Textdraw9, true);
	TextDrawSetSelectable(Login_Textdraw7, true);
	TextDrawSetSelectable(Login_Textdraw8, true);
because of playertextdraw, but i tried with

Код:
PlayerTextDrawSetSelectable
but i dont work when i use true instead of 1

//edit
i can try to make normal textdraws and do [MAX_PLAYERS] probably it works