Textdraw Menu size problem
#1

I am trying to make Textdraw menus for Ammunation, 24-7 shops, etc.
For some reason the menu only shows options 1-12 and cuts off the rest of the options. I've tried increasing the "new Test[600],bool:necessary = true;" size but anything above 650 causes the textdraw to not show in-game and prints "Warning: Ignoring Large Textdraw Size (650)"

I know my method of making the textdraws could be made much simpler but I am only a beginner in scripting, does anybody have any idea how to fix this problem and make the whole list show in the textdraw?




Код:
public OnPlayerConnect(playerid)
{
	MenuID[playerid] = -1;
	pHasItems[playerid] = 0;
    J_TMenu[playerid][0] = CreatePlayerTextDraw(playerid, 128.249816, 170.266815, "Header");
	PlayerTextDrawLetterSize(playerid, J_TMenu[playerid][0], 0.541876, 1.489166);
	PlayerTextDrawAlignment(playerid, J_TMenu[playerid][0], 2);
	PlayerTextDrawColor(playerid, J_TMenu[playerid][0], -5963521);
	PlayerTextDrawSetShadow(playerid, J_TMenu[playerid][0], 0);
	PlayerTextDrawSetOutline(playerid, J_TMenu[playerid][0], 0);
	PlayerTextDrawBackgroundColor(playerid, J_TMenu[playerid][0], 255);
	PlayerTextDrawFont(playerid, J_TMenu[playerid][0], 3);
	PlayerTextDrawSetProportional(playerid, J_TMenu[playerid][0], 1);
	PlayerTextDrawSetShadow(playerid, J_TMenu[playerid][0], 0);

	J_TMenu[playerid][1] = CreatePlayerTextDraw(playerid, 15.724655, 169.533676, "Content");
	PlayerTextDrawLetterSize(playerid, J_TMenu[playerid][1], 0.251874, 0.940833);
	PlayerTextDrawTextSize(playerid, J_TMenu[playerid][1], 266.977142, 0.000000);
	PlayerTextDrawAlignment(playerid, J_TMenu[playerid][1], 1);
	PlayerTextDrawColor(playerid, J_TMenu[playerid][1], -1);
	PlayerTextDrawUseBox(playerid, J_TMenu[playerid][1], 1);
	PlayerTextDrawBoxColor(playerid, J_TMenu[playerid][1], 120);
	PlayerTextDrawSetShadow(playerid, J_TMenu[playerid][1], 1);
	PlayerTextDrawSetOutline(playerid, J_TMenu[playerid][1], 0);
	PlayerTextDrawBackgroundColor(playerid, J_TMenu[playerid][1], 255);
	PlayerTextDrawFont(playerid, J_TMenu[playerid][1], 1);
	PlayerTextDrawSetProportional(playerid, J_TMenu[playerid][1], 1);
	PlayerTextDrawSetShadow(playerid, J_TMenu[playerid][1], 1);
	#if defined J_OnPlayerConnect
	    return J_OnPlayerConnect(playerid);
	#else
	    return 1;
	#endif
Код:
CMD:test(playerid)
{
    new Test[600],bool:necessary = true;
    if(necessary)
    {
          strcat(Test,"~y~1-~w~ Body Armor                        ~g~ $1000~n~");
          strcat(Test,"~y~2-~w~ Chainsaw                          ~g~ $26000~n~");
          strcat(Test,"~y~3-~w~ Silenced Pistol ~b~(250ammo)         ~g~ $4500~n~");
          strcat(Test,"~y~4-~w~ Desert Eagle ~b~(100ammo)            ~g~ $7500~n~");
          strcat(Test,"~y~5-~w~ Desert Eagle ~b~(250ammo)            ~g~ $15000~n~");
          strcat(Test,"~y~6-~w~ Mac 10 ~b~(250ammo)                  ~g~ $24000~n~");
          strcat(Test,"~y~7-~w~ Mac 10 ~b~(500ammo)                  ~g~ $35000~n~");
          strcat(Test,"~y~8-~w~ MP5 ~b~(250ammo)                     ~g~ $32000~n~");
          strcat(Test,"~y~9-~w~ MP5 ~b~(500ammo)                     ~g~ $52000~n~");
          strcat(Test,"~y~10-~w~ Sawnoff Shotgun ~b~(250ammo)         ~g~ $18000~n~");
          strcat(Test,"~y~11-~w~ Sawnoff Shotgun ~b~(500ammo)         ~g~ $32000~n~");
          strcat(Test,"~y~12-~w~ AK-47 ~b~(250ammo)                   ~g~ $29000~n~");
          strcat(Test,"~y~13-~w~ AK-47 ~b~(500ammo)                   ~g~ $38000~n~");
          strcat(Test,"~y~14-~w~ M4 ~b~(250ammo)                      ~g~ $36000~n~");
          strcat(Test,"~y~15-~w~ M4 ~b~(500ammo)                      ~g~ $58000~n~");
          strcat(Test,"~y~16-~w~ Sniper Rifle ~b~(125ammo)            ~g~ $8500~n~");
          strcat(Test,"~y~17-~w~ Sniper Rifle ~b~(300ammo)            ~g~ $16500~n~");



          necessary = false;
     }
     TextMenuShowForPlayer(playerid,0,"Ammunation",Test,17);
     return 1;
}

public OnTextMenuResponse(playerid,menuid,listitem)
{
     if(menuid == 0)
     {
          switch(listitem)
          {
                case 1:
                {
                GivePlayerWeapon(playerid, 9, 1); // Give playerid a sawn-off shotgun with 64 ammo  //Your stuff
                GivePlayerMoney(playerid, -1000);
                ApplyAnimation(playerid,"INT_SHOP","shop_pay",4.0,0,0,0,0,0);
                SendClientMessage(playerid, -1, "You Have Purchased Body Armor For $1000");
                }
                case 2:
                {
                GivePlayerWeapon(playerid, 9, 1); // Give playerid a sawn-off shotgun with 64 ammo      //Your stuff
                GivePlayerMoney(playerid, -26000);
                ApplyAnimation(playerid,"INT_SHOP","shop_pay",4.0,0,0,0,0,0);
                SendClientMessage(playerid, -1, "You Have Purchased A Chainsaw For $26000");
                }
                case 3:
                {
                GivePlayerWeapon(playerid, 23, 250); // Give playerid a sawn-off shotgun with 64 ammo     //Your stuff
                GivePlayerMoney(playerid, 4500);
                ApplyAnimation(playerid,"INT_SHOP","shop_pay",4.0,0,0,0,0,0);
                SendClientMessage(playerid, -1, "You Have Purchased A Silenced Pistol For $4500");
                }
                case 4:
                {
                GivePlayerWeapon(playerid, 24, 100); // Give playerid a sawn-off shotgun with 64 ammo      //Your stuff
                                GivePlayerMoney(playerid, 4500);
                ApplyAnimation(playerid,"INT_SHOP","shop_pay",4.0,0,0,0,0,0);
                SendClientMessage(playerid, -1, "You Have Purchased A Desert Eagle For $4500");
                }
                case 5:
                {
                GivePlayerWeapon(playerid, 24, 250); // Give playerid a sawn-off shotgun with 64 ammo      //Your stuff
                GivePlayerMoney(playerid, 4500);
                ApplyAnimation(playerid,"INT_SHOP","shop_pay",4.0,0,0,0,0,0);
                SendClientMessage(playerid, -1, "You Have Purchased A Desert Eagle For $4500");
                }
                case 6:
                {
                GivePlayerWeapon(playerid, 28, 250); // Give playerid a sawn-off shotgun with 64 ammo      //Your stuff
                GivePlayerMoney(playerid, 4500);
                ApplyAnimation(playerid,"INT_SHOP","shop_pay",4.0,0,0,0,0,0);
                SendClientMessage(playerid, -1, "You Have Purchased A Mac 10 For $4500");
                }
                case 7:
                {
                GivePlayerWeapon(playerid, 28, 500); // Give playerid a sawn-off shotgun with 64 ammo  //Your stuff
                GivePlayerMoney(playerid, 4500);
                ApplyAnimation(playerid,"INT_SHOP","shop_pay",4.0,0,0,0,0,0);
                SendClientMessage(playerid, -1, "You Have Purchased A Mac 10 For $4500");
                }
                case 8:
                {
                GivePlayerWeapon(playerid, 29, 250); // Give playerid a sawn-off shotgun with 64 ammo      //Your stuff
                GivePlayerMoney(playerid, 4500);
                ApplyAnimation(playerid,"INT_SHOP","shop_pay",4.0,0,0,0,0,0);
                SendClientMessage(playerid, -1, "You Have Purchased A MP5 For $4500");
                }
                case 9:
                {
                GivePlayerWeapon(playerid, 29, 500); // Give playerid a sawn-off shotgun with 64 ammo     //Your stuff
                GivePlayerMoney(playerid, 4500);
                ApplyAnimation(playerid,"INT_SHOP","shop_pay",4.0,0,0,0,0,0);
                SendClientMessage(playerid, -1, "You Have Purchased A MP5 For $4500");
                }
                case 10:
                {
                GivePlayerWeapon(playerid, 26, 250); // Give playerid a sawn-off shotgun with 64 ammo      //Your stuff
                GivePlayerMoney(playerid, 4500);
                ApplyAnimation(playerid,"INT_SHOP","shop_pay",4.0,0,0,0,0,0);
                SendClientMessage(playerid, -1, "You Have Purchased A Sawnoff Shotgun For $4500");
                }
                case 11:
                {
                GivePlayerWeapon(playerid, 26, 500); // Give playerid a sawn-off shotgun with 64 ammo      //Your stuff
                GivePlayerMoney(playerid, 4500);
                ApplyAnimation(playerid,"INT_SHOP","shop_pay",4.0,0,0,0,0,0);
                SendClientMessage(playerid, -1, "You Have Purchased A Sawnoff Shotgun For $4500");
                }
                case 12:
                {
                GivePlayerWeapon(playerid, 30, 250); // Give playerid a sawn-off shotgun with 64 ammo      //Your stuff
                GivePlayerMoney(playerid, 4500);
                ApplyAnimation(playerid,"INT_SHOP","shop_pay",4.0,0,0,0,0,0);
                SendClientMessage(playerid, -1, "You Have Purchased A AK-47 Shotgun For $4500");
                }
                case 13:
                {
                GivePlayerWeapon(playerid, 30, 500); // Give playerid a sawn-off shotgun with 64 ammo      //Your stuff
                GivePlayerMoney(playerid, 4500);
                ApplyAnimation(playerid,"INT_SHOP","shop_pay",4.0,0,0,0,0,0);
                SendClientMessage(playerid, -1, "You Have Purchased A AK-47 For $4500");
                }
                case 14:
                {
                GivePlayerWeapon(playerid, 31, 250); // Give playerid a sawn-off shotgun with 64 ammo      //Your stuff
                GivePlayerMoney(playerid, 4500);
                ApplyAnimation(playerid,"INT_SHOP","shop_pay",4.0,0,0,0,0,0);
                SendClientMessage(playerid, -1, "You Have Purchased A M4 For $4500");
                }
                case 15:
                {
                GivePlayerWeapon(playerid, 31, 500); // Give playerid a sawn-off shotgun with 64 ammo      //Your stuff
                GivePlayerMoney(playerid, 4500);
                ApplyAnimation(playerid,"INT_SHOP","shop_pay",4.0,0,0,0,0,0);
                SendClientMessage(playerid, -1, "You Have Purchased A M4 For $4500");
                }
                case 16:
                {
                GivePlayerWeapon(playerid, 34, 125); // Give playerid a sawn-off shotgun with 64 ammo      //Your stuff
                GivePlayerMoney(playerid, 4500);
                ApplyAnimation(playerid,"INT_SHOP","shop_pay",4.0,0,0,0,0,0);
                SendClientMessage(playerid, -1, "You Have Purchased A Sniper Rifle For $4500");
                }
                case 17:
                {
                GivePlayerWeapon(playerid, 34, 300); // Give playerid a sawn-off shotgun with 64 ammo      //Your stuff
                GivePlayerMoney(playerid, 4500);
                ApplyAnimation(playerid,"INT_SHOP","shop_pay",4.0,0,0,0,0,0);
                SendClientMessage(playerid, -1, "You Have Purchased A Sniper Rifle For $4500");
                }
          }
         
     }
    return 1;
Reply
#2

Beware of this:
Quote:
Originally Posted by wiki.sa-mp.com
(***) Although the textdraw string limit is 1024 characters, if colour codes (e.g. ~r~) are used beyond the 255th character it may crash the client.
I am not sure if this could be in relation to your problem, but try removing color codes temporarily and see what happens.

Also, you could possibly create two menus? (Next/prev and pages)

Another thing could be that you're not using sufficient with size in the "TextDrawTextSize" function.
https://sampwiki.blast.hk/wiki/TextDrawTextSize
It's mainly just a guess, but could also have an impact on the text.
Reply
#3

Quote:
Originally Posted by denNorske
Посмотреть сообщение
Beware of this:


I am not sure if this could be in relation to your problem, but try removing color codes temporarily and see what happens.

Also, you could possibly create two menus? (Next/prev and pages)

Another thing could be that you're not using sufficient with size in the "TextDrawTextSize" function.
https://sampwiki.blast.hk/wiki/TextDrawTextSize
It's mainly just a guess, but could also have an impact on the text.
I am trying to recreate a similar menu to this: (it seems to use the same amount of color changes + lines/options but displays the whole thing
Reply
#4

It could be divided into two/three textdraws showing the text
You just have to try what I said above and see if it could bring you any further on the way
Reply
#5

Quote:
Originally Posted by denNorske
Посмотреть сообщение
It could be divided into two/three textdraws showing the text
You just have to try what I said above and see if it could bring you any further on the way
I'm altering the TextDrawTextSizes but i'm not getting anywhere so far, do you have a recommendation on the size (or alteration) needed to achieve the menu in the second image?
Reply
#6

Hard to say.

I usually utilize a textdraw editor for my textdraw-stuff.
Ipleomax's textdraw editor, for instance.

So I am not very familiar with numbers in such connection.

What if you create one textdraw for each of the following contents:



It will:
1. Avoid any limits
2. Easy to alter any part to change colors or alignment
3. Will probably work for you.

I drew in 5 rectangles. The box, Header, Footer and 2x text. That is one way to do it, instead of including everything in one textdraw. Also, by having more than 1 textdraw also avoids the issue with colors after the 255th character.
Reply
#7

I am still having trouble with this, your solution would probably work deNorske but I have been trying to do what you said for a couple of days now and I think I'm too novice to split the existing textdraw into multiple ones

Could anybody take a look at my code above and provide a basic template for a 'working' version? Trying to get these menus to work is driving me insane
Reply
#8

bump
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)