SA-MP Forums Archive
Textdraw (Showing, then hiding themselves). - 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: Textdraw (Showing, then hiding themselves). (/showthread.php?tid=548604)



Textdraw (Showing, then hiding themselves). - zT KiNgKoNg - 30.11.2014

I've actually never used the Model preview for Textdraws before, and currently all the textdraws are mainly Placeholder as in (Text: not PlayerText, but I'd like to possibly know whats going on, as i'm not quite sure.

Note: The cause is not me Hiding the textdraws as the function that shows them requires false as an input to do so, and that is set to True as default eg. (Showthis(playerid); & Showthis(playerid, false);

Note 2: The boxes on the right aren't marked as MODEL PREVIEWS this is why they're showing.

Code (Slot) [There are a total of 18 and this is pretty much the same]:
pawn Код:
CharacterInventorySlots[playerid][0] = TextDrawCreate(195.999877, 127.763008, "_");
    TextDrawLetterSize(CharacterInventorySlots[playerid][0], 0.000000, 4.212957);
    TextDrawTextSize(CharacterInventorySlots[playerid][0], 157.666580, 0.000000);
    TextDrawUseBox(CharacterInventorySlots[playerid][0], true);
    TextDrawFont(CharacterInventorySlots[playerid][0], TEXT_DRAW_FONT_MODEL_PREVIEW);
    //TextDrawSetPreviewModel(CharacterInventorySlots[playerid][0], 411);
    TextDrawBackgroundColor(CharacterInventorySlots[playerid][0], 0xDDA0DDFF);
Image

Image (Finally got a screenshot of it showing):



Re: Textdraw (Showing, then hiding themselves). - zT KiNgKoNg - 01.12.2014

Important this is is answered.


Re: Textdraw (Showing, then hiding themselves). - Mauzen - 01.12.2014

Model preview textdraws are counted as sprite textdraws when it comes to limits, and you may just have 100 sprite textdraws created for each player (even created textdraws that arent shown are counting). All sprite textdraws that go above the 100 limit arent shown. I had the same problem once, and so decided to destroy/recreate model and sprite textdraws instead of just hiding them.

That would be the most probable cause of your problem i think.


Re: Textdraw (Showing, then hiding themselves). - zT KiNgKoNg - 01.12.2014

Well there is only 18 Model Previews actually as Textdraws currently. I'm still within the limit totally (48 Textdraws) for all my Textdraws.


Re: Textdraw (Showing, then hiding themselves). - zT KiNgKoNg - 02.12.2014

Still an on-going issue.


Re: Textdraw (Showing, then hiding themselves). - Dignity - 02.12.2014

Can you show some more code? Also, how are you displaying it? Do you have any idea what might be causing this?

Lastly, are you using/working on this in a filterscript, and reloading the filterscript multiple times? If this is the case, use /rcon gmx and it'll be fixed.


Re: Textdraw (Showing, then hiding themselves). - zT KiNgKoNg - 02.12.2014

A) All 18 slots are exactly the same but differ in position, so there isn't any point but here.
B) I have no idea what might be causing this issue.

Note: Please dont say 'Loops can cause this issue' because that would be completely incorrect as I've used this method for showing all the textdraws on the server related to the action.
Slots:
pawn Код:
CharacterInventorySlots[playerid][0] = TextDrawCreate(195.999877, 127.763008, "_");
    TextDrawLetterSize(CharacterInventorySlots[playerid][0], 0.000000, 4.212957);
    TextDrawTextSize(CharacterInventorySlots[playerid][0], 157.666580, 0.000000);
    TextDrawUseBox(CharacterInventorySlots[playerid][0], true);
    TextDrawFont(CharacterInventorySlots[playerid][0], TEXT_DRAW_FONT_MODEL_PREVIEW);
    //TextDrawSetPreviewModel(CharacterInventorySlots[playerid][0], 411);
    TextDrawBackgroundColor(CharacterInventorySlots[playerid][0], 0xDDA0DDFF);

    CharacterInventorySlots[playerid][1] = TextDrawCreate(232.333419, 127.603828, "_");
    TextDrawLetterSize(CharacterInventorySlots[playerid][1], 0.000000, 4.230658);
    TextDrawTextSize(CharacterInventorySlots[playerid][1], 194.333389, 0.000000);
    TextDrawUseBox(CharacterInventorySlots[playerid][1], true);
    TextDrawFont(CharacterInventorySlots[playerid][1], TEXT_DRAW_FONT_MODEL_PREVIEW);
    TextDrawSetPreviewModel(CharacterInventorySlots[playerid][1], 411);
    TextDrawBackgroundColor(CharacterInventorySlots[playerid][1], 0xDDA0DDFF);

    CharacterInventorySlots[playerid][2] = TextDrawCreate(268.666503, 127.762977, "_");
    TextDrawLetterSize(CharacterInventorySlots[playerid][2], 0.000000, 4.224485);
    TextDrawTextSize(CharacterInventorySlots[playerid][2], 230.666854, 0.000000);
    TextDrawUseBox(CharacterInventorySlots[playerid][2], true);
    TextDrawFont(CharacterInventorySlots[playerid][2], TEXT_DRAW_FONT_MODEL_PREVIEW);
    TextDrawSetPreviewModel(CharacterInventorySlots[playerid][2], 411);
    TextDrawBackgroundColor(CharacterInventorySlots[playerid][2], 0xDDA0DDFF);

    CharacterInventorySlots[playerid][3] = TextDrawCreate(305.666839, 127.603645, "_");
    TextDrawLetterSize(CharacterInventorySlots[playerid][3], 0.000000, 4.236420);
    TextDrawTextSize(CharacterInventorySlots[playerid][3], 267.333526, 0.000000);
    TextDrawUseBox(CharacterInventorySlots[playerid][3], true);
    TextDrawFont(CharacterInventorySlots[playerid][3], TEXT_DRAW_FONT_MODEL_PREVIEW);
    TextDrawSetPreviewModel(CharacterInventorySlots[playerid][3], 411);
    TextDrawBackgroundColor(CharacterInventorySlots[playerid][3], 0xDDA0DDFF);

    CharacterInventorySlots[playerid][4] = TextDrawCreate(342.333435, 127.762962, "_");
    TextDrawLetterSize(CharacterInventorySlots[playerid][4], 0.000000, 4.196914);
    TextDrawTextSize(CharacterInventorySlots[playerid][4], 304.136505, 0.000000);
    TextDrawUseBox(CharacterInventorySlots[playerid][4], true);
    TextDrawFont(CharacterInventorySlots[playerid][4], TEXT_DRAW_FONT_MODEL_PREVIEW);
    TextDrawSetPreviewModel(CharacterInventorySlots[playerid][4], 411);
    TextDrawBackgroundColor(CharacterInventorySlots[playerid][4], 0xDDA0DDFF);

    CharacterInventorySlots[playerid][5] = TextDrawCreate(378.666534, 127.603614, "_");
    TextDrawLetterSize(CharacterInventorySlots[playerid][5], 0.000000, 4.242177);
    TextDrawTextSize(CharacterInventorySlots[playerid][5], 340.999908, 0.000000);
    TextDrawUseBox(CharacterInventorySlots[playerid][5], true);
    TextDrawFont(CharacterInventorySlots[playerid][5], TEXT_DRAW_FONT_MODEL_PREVIEW);
    TextDrawSetPreviewModel(CharacterInventorySlots[playerid][5], 411);
    TextDrawBackgroundColor(CharacterInventorySlots[playerid][5], 0xDDA0DDFF);

    CharacterInventorySlots[playerid][6] = TextDrawCreate(195.666732, 170.329635, "_");
    TextDrawLetterSize(CharacterInventorySlots[playerid][6], 0.000000, 4.325304);
    TextDrawTextSize(CharacterInventorySlots[playerid][6], 157.666717, 0.000000);
    TextDrawUseBox(CharacterInventorySlots[playerid][6], true);
    TextDrawFont(CharacterInventorySlots[playerid][6], TEXT_DRAW_FONT_MODEL_PREVIEW);
    TextDrawSetPreviewModel(CharacterInventorySlots[playerid][6], 411);
    TextDrawBackgroundColor(CharacterInventorySlots[playerid][6], 0xDDA0DDFF);

    CharacterInventorySlots[playerid][7] = TextDrawCreate(232.333465, 170.488815, "s8_");
    TextDrawLetterSize(CharacterInventorySlots[playerid][7], 0.000000, 4.329837);
    TextDrawTextSize(CharacterInventorySlots[playerid][7], 194.333328, 0.000000);
    TextDrawUseBox(CharacterInventorySlots[playerid][7], true);
    TextDrawFont(CharacterInventorySlots[playerid][7], TEXT_DRAW_FONT_MODEL_PREVIEW);
    TextDrawSetPreviewModel(CharacterInventorySlots[playerid][7], 411);
    TextDrawBackgroundColor(CharacterInventorySlots[playerid][7], 0xDDA0DDFF);

    CharacterInventorySlots[playerid][8] = TextDrawCreate(268.666778, 170.329650, "s9_");
    TextDrawLetterSize(CharacterInventorySlots[playerid][8], 0.000000, 4.320778);
    TextDrawTextSize(CharacterInventorySlots[playerid][8], 230.666656, 0.000000);
    TextDrawUseBox(CharacterInventorySlots[playerid][8], true);
    TextDrawFont(CharacterInventorySlots[playerid][8], TEXT_DRAW_FONT_MODEL_PREVIEW);
    TextDrawSetPreviewModel(CharacterInventorySlots[playerid][8], 411);
    TextDrawBackgroundColor(CharacterInventorySlots[playerid][8], 0xDDA0DDFF);

    CharacterInventorySlots[playerid][9] = TextDrawCreate(305.333557, 170.329666, "_");
    TextDrawLetterSize(CharacterInventorySlots[playerid][9], 0.000000, 4.327365);
    TextDrawTextSize(CharacterInventorySlots[playerid][9], 267.333404, 0.000000);
    TextDrawUseBox(CharacterInventorySlots[playerid][9], true);
    TextDrawFont(CharacterInventorySlots[playerid][9], TEXT_DRAW_FONT_MODEL_PREVIEW);
    TextDrawSetPreviewModel(CharacterInventorySlots[playerid][9], 411);
    TextDrawBackgroundColor(CharacterInventorySlots[playerid][9], 0xDDA0DDFF);

    CharacterInventorySlots[playerid][10] = TextDrawCreate(342.333221, 170.488845, "_");
    TextDrawLetterSize(CharacterInventorySlots[playerid][10], 0.000000, 4.308435);
    TextDrawTextSize(CharacterInventorySlots[playerid][10], 304.333221, 0.000000);
    TextDrawUseBox(CharacterInventorySlots[playerid][10], true);
    TextDrawFont(CharacterInventorySlots[playerid][10], TEXT_DRAW_FONT_MODEL_PREVIEW);
    TextDrawSetPreviewModel(CharacterInventorySlots[playerid][10], 411);
    TextDrawBackgroundColor(CharacterInventorySlots[playerid][10], 0xDDA0DDFF);

    CharacterInventorySlots[playerid][11] = TextDrawCreate(379.000122, 170.329528, "_");
    TextDrawLetterSize(CharacterInventorySlots[playerid][11], 0.000000, 4.321605);
    TextDrawTextSize(CharacterInventorySlots[playerid][11], 341.000030, 0.000000);
    TextDrawUseBox(CharacterInventorySlots[playerid][11], true);
    TextDrawFont(CharacterInventorySlots[playerid][11], TEXT_DRAW_FONT_MODEL_PREVIEW);
    TextDrawSetPreviewModel(CharacterInventorySlots[playerid][11], 411);
    TextDrawBackgroundColor(CharacterInventorySlots[playerid][11], 0xDDA0DDFF);

    CharacterInventorySlots[playerid][12] = TextDrawCreate(195.666687, 214.044403, "_");
    TextDrawLetterSize(CharacterInventorySlots[playerid][12], 0.000000, 4.212963);
    TextDrawTextSize(CharacterInventorySlots[playerid][12], 157.666488, 0.000000);
    TextDrawUseBox(CharacterInventorySlots[playerid][12], true);
    TextDrawFont(CharacterInventorySlots[playerid][12], TEXT_DRAW_FONT_MODEL_PREVIEW);
    TextDrawSetPreviewModel(CharacterInventorySlots[playerid][12], 411);
    TextDrawBackgroundColor(CharacterInventorySlots[playerid][12], 0xDDA0DDFF);

    CharacterInventorySlots[playerid][13] = TextDrawCreate(232.333297, 213.885192, "_");
    TextDrawLetterSize(CharacterInventorySlots[playerid][13], 0.000000, 4.239297);
    TextDrawTextSize(CharacterInventorySlots[playerid][13], 194.333251, 0.000000);
    TextDrawUseBox(CharacterInventorySlots[playerid][13], true);
    TextDrawFont(CharacterInventorySlots[playerid][13], TEXT_DRAW_FONT_MODEL_PREVIEW);
    TextDrawSetPreviewModel(CharacterInventorySlots[playerid][13], 411);
    TextDrawBackgroundColor(CharacterInventorySlots[playerid][13], 0xDDA0DDFF);

    CharacterInventorySlots[playerid][14] = TextDrawCreate(268.666687, 213.885192, "_");
    TextDrawLetterSize(CharacterInventorySlots[playerid][14], 0.000000, 4.225718);
    TextDrawTextSize(CharacterInventorySlots[playerid][14], 230.666717, 0.000000);
    TextDrawUseBox(CharacterInventorySlots[playerid][14], true);
    TextDrawFont(CharacterInventorySlots[playerid][14], TEXT_DRAW_FONT_MODEL_PREVIEW);
    TextDrawSetPreviewModel(CharacterInventorySlots[playerid][14], 411);
    TextDrawBackgroundColor(CharacterInventorySlots[playerid][14], 0xDDA0DDFF);

    CharacterInventorySlots[playerid][15] = TextDrawCreate(305.333312, 213.885147, "_");
    TextDrawLetterSize(CharacterInventorySlots[playerid][15], 0.000000, 4.214200);
    TextDrawTextSize(CharacterInventorySlots[playerid][15], 267.333312, 0.000000);
    TextDrawUseBox(CharacterInventorySlots[playerid][15], true);
    TextDrawFont(CharacterInventorySlots[playerid][15], TEXT_DRAW_FONT_MODEL_PREVIEW);
    TextDrawSetPreviewModel(CharacterInventorySlots[playerid][15], 411);
    TextDrawBackgroundColor(CharacterInventorySlots[playerid][15], 0xDDA0DDFF);

    CharacterInventorySlots[playerid][16] = TextDrawCreate(342.333557, 213.885223, "_");
    TextDrawLetterSize(CharacterInventorySlots[playerid][16], 0.000000, 4.178804);
    TextDrawTextSize(CharacterInventorySlots[playerid][16], 304.333374, 0.000000);
    TextDrawUseBox(CharacterInventorySlots[playerid][16], true);
    TextDrawFont(CharacterInventorySlots[playerid][16], TEXT_DRAW_FONT_MODEL_PREVIEW);
    TextDrawSetPreviewModel(CharacterInventorySlots[playerid][16], 411);
    TextDrawBackgroundColor(CharacterInventorySlots[playerid][16], 0xDDA0DDFF);

    CharacterInventorySlots[playerid][17] = TextDrawCreate(378.999969, 213.885101, "_");
    TextDrawLetterSize(CharacterInventorySlots[playerid][17], 0.000000, 4.219956);
    TextDrawTextSize(CharacterInventorySlots[playerid][17], 341.000000, 0.000000);
    TextDrawUseBox(CharacterInventorySlots[playerid][17], true);
    TextDrawFont(CharacterInventorySlots[playerid][17], TEXT_DRAW_FONT_MODEL_PREVIEW);
    TextDrawSetPreviewModel(CharacterInventorySlots[playerid][17], 411);
    TextDrawBackgroundColor(CharacterInventorySlots[playerid][17], 0xDDA0DDFF);
Showing:
pawn Код:
stock CharacterInventoryScreen(playerid, bool:show = true)
{
    if(show)
    {
                // This section shows main part of the inventory textdraws (Visa Versa for Hiding)
        for(new maintd = 0; maintd < 10; maintd ++)
        {
            TextDrawShowForPlayer(playerid, CharacterInventory[playerid][maintd]);  
        }

                // This section shows the Inventory slots (Visa Versa for Hiding)
        for(new slots = 0; slots < MAX_INVENTORY_SLOTS; slots ++)
        {
             TextDrawShowForPlayer(playerid, CharacterInventorySlots[playerid][slots]);
        }
    } else {
        for(new maintd = 0; maintd < 10; maintd ++)
        {
            TextDrawHideForPlayer(playerid, CharacterInventory[playerid][maintd]);  
        }

        for(new slots = 0; slots < MAX_INVENTORY_SLOTS; slots ++)
        {
             TextDrawHideForPlayer(playerid, CharacterInventorySlots[playerid][slots]);
        }
    }
}



Re: Textdraw (Showing, then hiding themselves). - Dignity - 02.12.2014

Loops can cause the issue but you already wrote it in a way which avoids the loop causing the issue.

Can you look if you recreate/destroy the textdraws somewhere in your code?

Also (since you didn't answer me before); is this being written in a filterscript?


Re: Textdraw (Showing, then hiding themselves). - zT KiNgKoNg - 02.12.2014

Quote:
Originally Posted by Mionee
Посмотреть сообщение
Loops can cause the issue but you already wrote it in a way which avoids the loop causing the issue.

Can you look if you recreate/destroy the textdraws somewhere in your code?

Also (since you didn't answer me before); is this being written in a filterscript?
Sorry completely forgot about that, and the answer is No.

Destroying and Re-creating: Result, still hiding.


Re: Textdraw (Showing, then hiding themselves). - zT KiNgKoNg - 03.12.2014

Bump, still haven't found the problem after hours and hours of looking into it.