SA-MP Forums Archive
Need help with textdraws - 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: Need help with textdraws (/showthread.php?tid=407991)



Need help with textdraws - Kimossab - 16.01.2013

Hello, I need help with some textdraws I made. The problem is that a textdraw always appear under another one, but I wanted it above. The textdraws are the phonescreen[playerid] (the one I want above) and phoneback[playerid](the one I want under).

On the TextDrawShowForPlayer I already tried to put the screen under and above the back, though it always apear under the other.

Here's the codes:

pawn Код:
// create textdraw
    phonescreen[playerid] = TextDrawCreate(376.348419, 109.999984, "test");
    TextDrawLetterSize(phonescreen[playerid], 0.000000, 13.893341);
    TextDrawTextSize(phonescreen[playerid], 245.379119, 0.000000);
    TextDrawAlignment(phonescreen[playerid], 1);
    TextDrawColor(phonescreen[playerid], -1);
    TextDrawUseBox(phonescreen[playerid], true);
    TextDrawBoxColor(phonescreen[playerid], -1);
    TextDrawSetShadow(phonescreen[playerid], 0);
    TextDrawSetOutline(phonescreen[playerid], 0);
    TextDrawBackgroundColor(phonescreen[playerid], -1);
    TextDrawFont(phonescreen[playerid], 0);
   
    phoneback[playerid] = TextDrawCreate(234.040161, 100.666709, "usebox");
    TextDrawLetterSize(phoneback[playerid], 0.000000, 37.341136);
    TextDrawTextSize(phoneback[playerid], 386.404266, 0.000000);
    TextDrawAlignment(phoneback[playerid], 1);
    TextDrawColor(phoneback[playerid], -1);
    TextDrawUseBox(phoneback[playerid], true);
    TextDrawBoxColor(phoneback[playerid], 0xFF8080FF);
    TextDrawSetShadow(phoneback[playerid], 0);
    TextDrawSetOutline(phoneback[playerid], 0);
    TextDrawFont(phoneback[playerid], 0);
   
    phonen1[playerid] = TextDrawCreate(260, 250, "1");
    TextDrawLetterSize(phonen1[playerid], 2, 3);
    TextDrawSetShadow(phonen1[playerid], 0);
    TextDrawSetOutline(phonen1[playerid], 2);
    TextDrawSetSelectable(phonen1[playerid], 1);
    TextDrawUseBox(phonen1[playerid], 1);
    TextDrawAlignment(phonen1[playerid], 2);
    TextDrawBoxColor(phonen1[playerid], 0x00000000);
    TextDrawTextSize(phonen1[playerid], 25, 25);

    phonen2[playerid] = TextDrawCreate(310, 250, "2");
    TextDrawLetterSize(phonen2[playerid], 2, 3);
    TextDrawSetShadow(phonen2[playerid], 0);
    TextDrawSetOutline(phonen2[playerid], 2);
    TextDrawSetSelectable(phonen2[playerid], 1);
    TextDrawUseBox(phonen2[playerid], 1);
    TextDrawAlignment(phonen2[playerid], 2);
    TextDrawBoxColor(phonen2[playerid], 0x00000000);
    TextDrawTextSize(phonen2[playerid], 25, 25);

    phonen3[playerid] = TextDrawCreate(360, 250, "3");
    TextDrawLetterSize(phonen3[playerid], 2, 3);
    TextDrawSetShadow(phonen3[playerid], 0);
    TextDrawSetOutline(phonen3[playerid], 2);
    TextDrawSetSelectable(phonen3[playerid], 1);
    TextDrawUseBox(phonen3[playerid], 1);
    TextDrawAlignment(phonen3[playerid], 2);
    TextDrawBoxColor(phonen3[playerid], 0x00000000);
    TextDrawTextSize(phonen3[playerid], 25, 25);

    phonen4[playerid] = TextDrawCreate(260, 300, "4");
    TextDrawLetterSize(phonen4[playerid], 2, 3);
    TextDrawSetShadow(phonen4[playerid], 0);
    TextDrawSetOutline(phonen4[playerid], 2);
    TextDrawSetSelectable(phonen4[playerid], 1);
    TextDrawUseBox(phonen4[playerid], 1);
    TextDrawAlignment(phonen4[playerid], 2);
    TextDrawBoxColor(phonen4[playerid], 0x00000000);
    TextDrawTextSize(phonen4[playerid], 25, 25);

    phonen5[playerid] = TextDrawCreate(310, 300, "5");
    TextDrawLetterSize(phonen5[playerid], 2, 3);
    TextDrawSetShadow(phonen5[playerid], 0);
    TextDrawSetOutline(phonen5[playerid], 2);
    TextDrawSetSelectable(phonen5[playerid], 1);
    TextDrawUseBox(phonen5[playerid], 1);
    TextDrawAlignment(phonen5[playerid], 2);
    TextDrawBoxColor(phonen5[playerid], 0x00000000);
    TextDrawTextSize(phonen5[playerid], 25, 25);

    phonen6[playerid] = TextDrawCreate(360, 300, "6");
    TextDrawLetterSize(phonen6[playerid], 2, 3);
    TextDrawSetShadow(phonen6[playerid], 0);
    TextDrawSetOutline(phonen6[playerid], 2);
    TextDrawSetSelectable(phonen6[playerid], 1);
    TextDrawUseBox(phonen6[playerid], 1);
    TextDrawAlignment(phonen6[playerid], 2);
    TextDrawBoxColor(phonen6[playerid], 0x00000000);
    TextDrawTextSize(phonen6[playerid], 25, 25);

    phonen7[playerid] = TextDrawCreate(260, 350, "7");
    TextDrawLetterSize(phonen7[playerid], 2, 3);
    TextDrawSetShadow(phonen7[playerid], 0);
    TextDrawSetOutline(phonen7[playerid], 2);
    TextDrawSetSelectable(phonen7[playerid], 1);
    TextDrawUseBox(phonen7[playerid], 1);
    TextDrawAlignment(phonen7[playerid], 2);
    TextDrawBoxColor(phonen7[playerid], 0x00000000);
    TextDrawTextSize(phonen7[playerid], 25, 25);

    phonen8[playerid] = TextDrawCreate(310, 350, "8");
    TextDrawLetterSize(phonen8[playerid], 2, 3);
    TextDrawSetShadow(phonen8[playerid], 0);
    TextDrawSetOutline(phonen8[playerid], 2);
    TextDrawSetSelectable(phonen8[playerid], 1);
    TextDrawUseBox(phonen8[playerid], 1);
    TextDrawAlignment(phonen8[playerid], 2);
    TextDrawBoxColor(phonen8[playerid], 0x00000000);
    TextDrawTextSize(phonen8[playerid], 25, 25);

    phonen9[playerid] = TextDrawCreate(360, 350, "9");
    TextDrawLetterSize(phonen9[playerid], 2, 3);
    TextDrawSetShadow(phonen9[playerid], 0);
    TextDrawSetOutline(phonen9[playerid], 2);
    TextDrawSetSelectable(phonen9[playerid], 1);
    TextDrawUseBox(phonen9[playerid], 1);
    TextDrawAlignment(phonen9[playerid], 2);
    TextDrawBoxColor(phonen9[playerid], 0x00000000);
    TextDrawTextSize(phonen9[playerid], 25, 25);

    phonens[playerid] = TextDrawCreate(260, 400, "+");
    TextDrawLetterSize(phonens[playerid], 2, 3);
    TextDrawSetShadow(phonens[playerid], 0);
    TextDrawSetOutline(phonens[playerid], 2);
    TextDrawSetSelectable(phonens[playerid], 1);
    TextDrawUseBox(phonens[playerid], 1);
    TextDrawAlignment(phonens[playerid], 2);
    TextDrawBoxColor(phonens[playerid], 0x00000000);
    TextDrawTextSize(phonens[playerid], 25, 25);

    phonen0[playerid] = TextDrawCreate(310, 400, "0");
    TextDrawLetterSize(phonen0[playerid], 2, 3);
    TextDrawSetShadow(phonen0[playerid], 0);
    TextDrawSetOutline(phonen0[playerid], 2);
    TextDrawSetSelectable(phonen0[playerid], 1);
    TextDrawUseBox(phonen0[playerid], 1);
    TextDrawAlignment(phonen0[playerid], 2);
    TextDrawBoxColor(phonen0[playerid], 0x00000000);
    TextDrawTextSize(phonen0[playerid], 25, 25);

    phonenc[playerid] = TextDrawCreate(360, 400, "#");
    TextDrawLetterSize(phonenc[playerid], 2, 3);
    TextDrawSetShadow(phonenc[playerid], 0);
    TextDrawSetOutline(phonenc[playerid], 2);
    TextDrawSetSelectable(phonenc[playerid], 1);
    TextDrawUseBox(phonenc[playerid], 1);
    TextDrawAlignment(phonenc[playerid], 2);
    TextDrawBoxColor(phonenc[playerid], 0x00000000);
    TextDrawTextSize(phonenc[playerid], 25, 25);

pawn Код:
//show TD
CMD:takephone(playerid, params[])
{
    SelectTextDraw(playerid, c_speedo);
    TextDrawShowForPlayer(playerid, phoneback[playerid]);
    TextDrawShowForPlayer(playerid, phonescreen[playerid]);
    TextDrawShowForPlayer(playerid, phonen1[playerid]);
    TextDrawShowForPlayer(playerid, phonen2[playerid]);
    TextDrawShowForPlayer(playerid, phonen3[playerid]);
    TextDrawShowForPlayer(playerid, phonen4[playerid]);
    TextDrawShowForPlayer(playerid, phonen5[playerid]);
    TextDrawShowForPlayer(playerid, phonen6[playerid]);
    TextDrawShowForPlayer(playerid, phonen7[playerid]);
    TextDrawShowForPlayer(playerid, phonen8[playerid]);
    TextDrawShowForPlayer(playerid, phonen9[playerid]);
    TextDrawShowForPlayer(playerid, phonens[playerid]);
    TextDrawShowForPlayer(playerid, phonen0[playerid]);
    TextDrawShowForPlayer(playerid, phonenc[playerid]);
    return 1;
}
Hope someone can help me


Re: Need help with textdraws - ikey07 - 16.01.2013

Create background first


Re: Need help with textdraws - Kimossab - 16.01.2013

Quote:
Originally Posted by ikey07
Посмотреть сообщение
Create background first
Like with TextDrawBackgroundColor? If yes not worked, if not than explain better please.


Re: Need help with textdraws - Kwarde - 16.01.2013

Have you tried creating the 'phoneback[playerid]' before the 'phonescreen[playerid]' already? Perhaps that may help (I've never been really active with textdraws)


Re: Need help with textdraws - Kimossab - 16.01.2013

Thank you so much, it worked. I didn't know that what's important to this was the creation position and not the showing position.


Re: Need help with textdraws - Kwarde - 16.01.2013

But I do. All the created textdraws will get an ID (that's why you can show a specific textdraw to an user). The first created one will be placed, and simply when you create another one, it's being placed on that one.
You can compare this with 2 papers, a black one, and a red one. Let's say that the black one is "0" and the red one is "1". If you put paper 0 on the table first, and then paper 1, you see 1 better then 0 because it's created later... if you know what I mean


Re: Need help with textdraws - Kimossab - 16.01.2013

Yea I understand, now it's clear, though I thought that what make you see one above the other is the order of the show, let's take those 2 papers, let's imagine that the 1 was created before the 0, but if you show 0 first you can see better the 0 than the 1.
Anyway, it's clear to me now how it works. Thanks!