SA-MP Forums Archive
PlayerTextDraw Not Clickable? - 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: PlayerTextDraw Not Clickable? (/showthread.php?tid=451581)



PlayerTextDraw Not Clickable? - faff - 17.07.2013

Hello, So i've been trying to make an textdraw clickable.
Once trying it ingame, you cant click it.
I dont know why, and when i'm compiling, it isnt showing any errors.

pawn Код:
//define
new PlayerText:DLexit[MAX_PLAYERS];

//onplayerconnect

DLexit[playerid] = CreatePlayerTextDraw(playerid, 552.000000, 274.000000, "EXIT");
PlayerTextDrawBackgroundColor(playerid, DLexit[playerid], 255);
PlayerTextDrawFont(playerid, DLexit[playerid], 1);
PlayerTextDrawLetterSize(playerid, DLexit[playerid], 1.130000, 7.400000);
PlayerTextDrawColor(playerid, DLexit[playerid], -1);
PlayerTextDrawSetOutline(playerid, DLexit[playerid], 0);
PlayerTextDrawSetProportional(playerid, DLexit[playerid], 1);
PlayerTextDrawSetShadow(playerid, DLexit[playerid], 1);
PlayerTextDrawSetSelectable(playerid, DLexit[playerid], 1);


//OnPlayerClickPlayerTextDraw

    if(playertextid == PlayerText:DLexit[playerid]) {
        SetCameraBehindPlayer(playerid);
        PlayerTextDrawShow(playerid, hunger[playerid]);
        PlayerTextDrawShow(playerid, thirst[playerid]);
        PlayerTextDrawDestroy(playerid, DLbox1[playerid]);
        PlayerTextDrawDestroy(playerid, DLbox2[playerid]);
        PlayerTextDrawDestroy(playerid, DLbox3[playerid]);
        PlayerTextDrawDestroy(playerid, DLmodify[playerid]);
        PlayerTextDrawDestroy(playerid, DLspeedtest[playerid]);
        PlayerTextDrawDestroy(playerid, DLcitytest[playerid]);
        PlayerTextDrawDestroy(playerid, DLpaint[playerid]);
        PlayerTextDrawDestroy(playerid, DLbuy[playerid]);
        PlayerTextDrawDestroy(playerid, DLexit[playerid]);
        return 1;
    }

//OnDialogResponse

    else if(dialogid == 601)
    {
        if(response)
        {
            switch(listitem)
            {
                case 0: // Freeway
                {
                DLCar[11] = CreateVehicle(463,347.5634,2935.0889,46.5648,90.6536,0,0, 2000); //
                SetPlayerCameraLookAt(playerid, 347.5634,2935.0889,46.5678);
                SetPlayerCameraPos(playerid, 341.0376,2935.0881,48.5146);
                PlayerTextDrawHide(playerid, hunger[playerid]);
                PlayerTextDrawHide(playerid, thirst[playerid]);
                PlayerTextDrawShow(playerid, DLbox1[playerid]);
                PlayerTextDrawShow(playerid, DLbox2[playerid]);
                PlayerTextDrawShow(playerid, DLbox3[playerid]);
                PlayerTextDrawShow(playerid, DLmodify[playerid]);
                PlayerTextDrawShow(playerid, DLspeedtest[playerid]);
                PlayerTextDrawShow(playerid, DLcitytest[playerid]);
                PlayerTextDrawShow(playerid, DLpaint[playerid]);
                PlayerTextDrawShow(playerid, DLbuy[playerid]);
                PlayerTextDrawShow(playerid, DLexit[playerid]);
                PlayerTextDrawSetSelectable(playerid, DLexit[playerid], 0);
                }
                case 1: // Faggio
                {
                DLCar[11] = CreateVehicle(462,347.5634,2935.0889,46.5648,90.6536,0,0, 2000); //
                SetPlayerCameraLookAt(playerid, 347.5634,2935.0889,46.5678);
                SetPlayerCameraPos(playerid, 341.0376,2935.0881,48.5146);
                PlayerTextDrawHide(playerid, hunger[playerid]);
                PlayerTextDrawHide(playerid, thirst[playerid]);
                PlayerTextDrawShow(playerid, DLbox1[playerid]);
                PlayerTextDrawShow(playerid, DLbox2[playerid]);
                PlayerTextDrawShow(playerid, DLbox3[playerid]);
                PlayerTextDrawShow(playerid, DLmodify[playerid]);
                PlayerTextDrawShow(playerid, DLspeedtest[playerid]);
                PlayerTextDrawShow(playerid, DLcitytest[playerid]);
                PlayerTextDrawShow(playerid, DLpaint[playerid]);
                PlayerTextDrawShow(playerid, DLbuy[playerid]);
                PlayerTextDrawShow(playerid, DLexit[playerid]);
                PlayerTextDrawSetSelectable(playerid, DLexit[playerid], 0);
                }
                case 2: // Sanchez
                {
                SetPlayerCameraLookAt(playerid, 347.5634,2935.0889,46.5678);
                SetPlayerCameraPos(playerid, 341.0376,2935.0881,48.5146);
                DLCar[11] = CreateVehicle(468,347.5634,2935.0889,46.5648,90.6536,0,0, 2000); //
                PlayerTextDrawHide(playerid, hunger[playerid]);
                PlayerTextDrawHide(playerid, thirst[playerid]);
                PlayerTextDrawShow(playerid, DLbox1[playerid]);
                PlayerTextDrawShow(playerid, DLbox2[playerid]);
                PlayerTextDrawShow(playerid, DLbox3[playerid]);
                PlayerTextDrawShow(playerid, DLmodify[playerid]);
                PlayerTextDrawShow(playerid, DLspeedtest[playerid]);
                PlayerTextDrawShow(playerid, DLcitytest[playerid]);
                PlayerTextDrawShow(playerid, DLpaint[playerid]);
                PlayerTextDrawShow(playerid, DLbuy[playerid]);
                PlayerTextDrawShow(playerid, DLexit[playerid]);
                PlayerTextDrawSetSelectable(playerid, DLexit[playerid], 0);
                }
                case 3: // PCJ-600
                {
                SetPlayerCameraLookAt(playerid, 347.5634,2935.0889,46.5678);
                SetPlayerCameraPos(playerid, 341.0376,2935.0881,48.5146);
                DLCar[11] = CreateVehicle(461,347.5634,2935.0889,46.5648,90.6536,0,0, 2000); //
                PlayerTextDrawHide(playerid, hunger[playerid]);
                PlayerTextDrawHide(playerid, thirst[playerid]);
                PlayerTextDrawShow(playerid, DLbox1[playerid]);
                PlayerTextDrawShow(playerid, DLbox2[playerid]);
                PlayerTextDrawShow(playerid, DLbox3[playerid]);
                PlayerTextDrawShow(playerid, DLmodify[playerid]);
                PlayerTextDrawShow(playerid, DLspeedtest[playerid]);
                PlayerTextDrawShow(playerid, DLcitytest[playerid]);
                PlayerTextDrawShow(playerid, DLpaint[playerid]);
                PlayerTextDrawShow(playerid, DLbuy[playerid]);
                PlayerTextDrawShow(playerid, DLexit[playerid]);
                PlayerTextDrawSetSelectable(playerid, DLexit[playerid], 0);
                }
                case 4: // Cheetah
                {
                SetPlayerCameraLookAt(playerid, 347.5634,2935.0889,46.5678);
                SetPlayerCameraPos(playerid, 341.0376,2935.0881,48.5146);
                DLCar[11] = CreateVehicle(415,347.5634,2935.0889,46.5648,90.6536,0,0, 2000); //
                PlayerTextDrawHide(playerid, hunger[playerid]);
                PlayerTextDrawHide(playerid, thirst[playerid]);
                PlayerTextDrawShow(playerid, DLbox1[playerid]);
                PlayerTextDrawShow(playerid, DLbox2[playerid]);
                PlayerTextDrawShow(playerid, DLbox3[playerid]);
                PlayerTextDrawShow(playerid, DLmodify[playerid]);
                PlayerTextDrawShow(playerid, DLspeedtest[playerid]);
                PlayerTextDrawShow(playerid, DLcitytest[playerid]);
                PlayerTextDrawShow(playerid, DLpaint[playerid]);
                PlayerTextDrawShow(playerid, DLbuy[playerid]);
                PlayerTextDrawShow(playerid, DLexit[playerid]);
                PlayerTextDrawSetSelectable(playerid, DLexit[playerid], 0);
                }
                case 5: // Infernus
                {
                SetPlayerCameraLookAt(playerid, 347.5634,2935.0889,46.5678);
                SetPlayerCameraPos(playerid, 341.0376,2935.0881,48.5146);
                DLCar[11] = CreateVehicle(411,347.5634,2935.0889,46.5648,90.6536,0,0, 2000); //
                PlayerTextDrawHide(playerid, hunger[playerid]);
                PlayerTextDrawHide(playerid, thirst[playerid]);
                PlayerTextDrawShow(playerid, DLbox1[playerid]);
                PlayerTextDrawShow(playerid, DLbox2[playerid]);
                PlayerTextDrawShow(playerid, DLbox3[playerid]);
                PlayerTextDrawShow(playerid, DLmodify[playerid]);
                PlayerTextDrawShow(playerid, DLspeedtest[playerid]);
                PlayerTextDrawShow(playerid, DLcitytest[playerid]);
                PlayerTextDrawShow(playerid, DLpaint[playerid]);
                PlayerTextDrawShow(playerid, DLbuy[playerid]);
                PlayerTextDrawShow(playerid, DLexit[playerid]);
                PlayerTextDrawSetSelectable(playerid, DLexit[playerid], 0);
                }
                case 6: // Turismo
                {
                SetPlayerCameraLookAt(playerid, 347.5634,2935.0889,46.5678);
                SetPlayerCameraPos(playerid, 341.0376,2935.0881,48.5146);
                DLCar[11] = CreateVehicle(451,347.5634,2935.0889,46.5648,90.6536,0,0, 2000); //
                PlayerTextDrawHide(playerid, hunger[playerid]);
                PlayerTextDrawHide(playerid, thirst[playerid]);
                PlayerTextDrawShow(playerid, DLbox1[playerid]);
                PlayerTextDrawShow(playerid, DLbox2[playerid]);
                PlayerTextDrawShow(playerid, DLbox3[playerid]);
                PlayerTextDrawShow(playerid, DLmodify[playerid]);
                PlayerTextDrawShow(playerid, DLspeedtest[playerid]);
                PlayerTextDrawShow(playerid, DLcitytest[playerid]);
                PlayerTextDrawShow(playerid, DLpaint[playerid]);
                PlayerTextDrawShow(playerid, DLbuy[playerid]);
                PlayerTextDrawShow(playerid, DLexit[playerid]);
                PlayerTextDrawSetSelectable(playerid, DLexit[playerid], 0);
                }
                case 7: // Pheonix
                {
                SetPlayerCameraLookAt(playerid, 347.5634,2935.0889,46.5678);
                SetPlayerCameraPos(playerid, 341.0376,2935.0881,48.5146);
                DLCar[11] = CreateVehicle(603,347.5634,2935.0889,46.5648,90.6536,0,0, 2000); //
                PlayerTextDrawHide(playerid, hunger[playerid]);
                PlayerTextDrawHide(playerid, thirst[playerid]);
                PlayerTextDrawShow(playerid, DLbox1[playerid]);
                PlayerTextDrawShow(playerid, DLbox2[playerid]);
                PlayerTextDrawShow(playerid, DLbox3[playerid]);
                PlayerTextDrawShow(playerid, DLmodify[playerid]);
                PlayerTextDrawShow(playerid, DLspeedtest[playerid]);
                PlayerTextDrawShow(playerid, DLcitytest[playerid]);
                PlayerTextDrawShow(playerid, DLpaint[playerid]);
                PlayerTextDrawShow(playerid, DLbuy[playerid]);
                PlayerTextDrawShow(playerid, DLexit[playerid]);
                PlayerTextDrawSetSelectable(playerid, DLexit[playerid], 0);
                }
                case 8: // Banshee
                {
                SetPlayerCameraLookAt(playerid, 347.5634,2935.0889,46.5678);
                SetPlayerCameraPos(playerid, 341.0376,2935.0881,48.5146);
                DLCar[11] = CreateVehicle(429,347.5634,2935.0889,46.5648,90.6536,0,0, 2000); //
                PlayerTextDrawHide(playerid, hunger[playerid]);
                PlayerTextDrawHide(playerid, thirst[playerid]);
                PlayerTextDrawShow(playerid, DLbox1[playerid]);
                PlayerTextDrawShow(playerid, DLbox2[playerid]);
                PlayerTextDrawShow(playerid, DLbox3[playerid]);
                PlayerTextDrawShow(playerid, DLmodify[playerid]);
                PlayerTextDrawShow(playerid, DLspeedtest[playerid]);
                PlayerTextDrawShow(playerid, DLcitytest[playerid]);
                PlayerTextDrawShow(playerid, DLpaint[playerid]);
                PlayerTextDrawShow(playerid, DLbuy[playerid]);
                PlayerTextDrawShow(playerid, DLexit[playerid]);
                PlayerTextDrawSetSelectable(playerid, DLexit[playerid], 0);
                }
                case 9: // Bullet
                {
                SetPlayerCameraLookAt(playerid, 347.5634,2935.0889,46.5678);
                SetPlayerCameraPos(playerid, 341.0376,2935.0881,48.5146);
                DLCar[11] = CreateVehicle(541,347.5634,2935.0889,46.5648,90.6536,0,0, 2000); //
                PlayerTextDrawHide(playerid, hunger[playerid]);
                PlayerTextDrawHide(playerid, thirst[playerid]);
                PlayerTextDrawShow(playerid, DLbox1[playerid]);
                PlayerTextDrawShow(playerid, DLbox2[playerid]);
                PlayerTextDrawShow(playerid, DLbox3[playerid]);
                PlayerTextDrawShow(playerid, DLmodify[playerid]);
                PlayerTextDrawShow(playerid, DLspeedtest[playerid]);
                PlayerTextDrawShow(playerid, DLcitytest[playerid]);
                PlayerTextDrawShow(playerid, DLpaint[playerid]);
                PlayerTextDrawShow(playerid, DLbuy[playerid]);
                PlayerTextDrawShow(playerid, DLexit[playerid]);
                PlayerTextDrawSetSelectable(playerid, DLexit[playerid], 0);
                }
                case 10: // ZR-350
                {
                SetPlayerCameraLookAt(playerid, 347.5634,2935.0889,46.5678);
                SetPlayerCameraPos(playerid, 341.0376,2935.0881,48.5146);
                DLCar[11] = CreateVehicle(477,347.5634,2935.0889,46.5648,90.6536,0,0, 2000); //
                PlayerTextDrawHide(playerid, hunger[playerid]);
                PlayerTextDrawHide(playerid, thirst[playerid]);
                PlayerTextDrawShow(playerid, DLbox1[playerid]);
                PlayerTextDrawShow(playerid, DLbox2[playerid]);
                PlayerTextDrawShow(playerid, DLbox3[playerid]);
                PlayerTextDrawShow(playerid, DLmodify[playerid]);
                PlayerTextDrawShow(playerid, DLspeedtest[playerid]);
                PlayerTextDrawShow(playerid, DLcitytest[playerid]);
                PlayerTextDrawShow(playerid, DLpaint[playerid]);
                PlayerTextDrawShow(playerid, DLbuy[playerid]);
                PlayerTextDrawShow(playerid, DLexit[playerid]);
                PlayerTextDrawSetSelectable(playerid, DLexit[playerid], 0);
                }
            }
        }
    }
Can somebody help me?

Regards, Faff


Re: PlayerTextDraw Not Clickable? - Pottus - 17.07.2013

TextDrawTextSize() needs to be set to define the clickable area.


Re: PlayerTextDraw Not Clickable? - faff - 18.07.2013

Hmm.. Thanks.
But.. What should be an perfect Textsize?
As example, this one.

pawn Код:
DLexit[playerid] = CreatePlayerTextDraw(playerid, 552.000000, 274.000000, "EXIT");
PlayerTextDrawBackgroundColor(playerid, DLexit[playerid], 255);
PlayerTextDrawFont(playerid, DLexit[playerid], 1);
PlayerTextDrawLetterSize(playerid, DLexit[playerid], 1.130000, 7.400000);
PlayerTextDrawColor(playerid, DLexit[playerid], -1);
PlayerTextDrawSetOutline(playerid, DLexit[playerid], 0);
PlayerTextDrawSetProportional(playerid, DLexit[playerid], 1);
PlayerTextDrawSetShadow(playerid, DLexit[playerid], 1);
PlayerTextDrawSetSelectable(playerid, DLexit[playerid], 1);
PlayerTextDrawTextSize(playerid, DLexit[playerid], 1.130000, 7.400000);