Textdraws
#1

So I have a simple UI for my server using textdraws but to me it looks like I am doing it the long and un-optimized way, is there a better way of doing this
pawn Код:
new Text:Textdraw0[MAX_PLAYERS];
new Text:Textdraw1[MAX_PLAYERS];
new Text:Textdraw2[MAX_PLAYERS];
new Text:Textdraw3[MAX_PLAYERS];


Textdraw0[playerid] = TextDrawCreate(155.750000, 198.083282, "usebox");
TextDrawLetterSize(Textdraw0[playerid], 0.000000, 8.111574);
TextDrawTextSize(Textdraw0[playerid], 52.375000, 0.000000);
TextDrawAlignment(Textdraw0[playerid], 1);
TextDrawColor(Textdraw0[playerid], 0);
TextDrawUseBox(Textdraw0[playerid], true);
TextDrawBoxColor(Textdraw0[playerid], 102);
TextDrawSetShadow(Textdraw0[playerid], 0);
TextDrawSetOutline(Textdraw0[playerid], 0);
TextDrawFont(Textdraw0[playerid], 0);

Textdraw1[playerid] = TextDrawCreate(73.750000, 205.916687, "Play");
TextDrawLetterSize(Textdraw1[playerid], 0.449999, 1.600000);
TextDrawAlignment(Textdraw1[playerid], 1);
TextDrawColor(Textdraw1[playerid], -1);
TextDrawSetShadow(Textdraw1[playerid], 0);
TextDrawSetOutline(Textdraw1[playerid], 1);
TextDrawBackgroundColor(Textdraw1[playerid], 51);
TextDrawFont(Textdraw1[playerid], 1);
TextDrawSetProportional(Textdraw1[playerid], 1);
TextDrawSetSelectable(Textdraw1[playerid], true);

Textdraw2[playerid] = TextDrawCreate(71.250000, 225.166671, "Statistics");
TextDrawLetterSize(Textdraw2[playerid], 0.449999, 1.600000);
TextDrawAlignment(Textdraw2[playerid], 1);
TextDrawColor(Textdraw2[playerid], -1);
TextDrawSetShadow(Textdraw2[playerid], 0);
TextDrawSetOutline(Textdraw2[playerid], 1);
TextDrawBackgroundColor(Textdraw2[playerid], 51);
TextDrawFont(Textdraw2[playerid], 1);
TextDrawSetProportional(Textdraw2[playerid], 1);
TextDrawSetSelectable(Textdraw2[playerid], true);

Textdraw3[playerid] = TextDrawCreate(71.875000, 245.583328, "Delete");
TextDrawLetterSize(Textdraw3[playerid], 0.449999, 1.600000);
TextDrawAlignment(Textdraw3[playerid], 1);
TextDrawColor(Textdraw3[playerid], -1);
TextDrawSetShadow(Textdraw3[playerid], 0);
TextDrawSetOutline(Textdraw3[playerid], 1);
TextDrawBackgroundColor(Textdraw3[playerid], 51);
TextDrawFont(Textdraw3[playerid], 1);
TextDrawSetProportional(Textdraw3[playerid], 1);
TextDrawSetSelectable(Textdraw3[playerid], true);
without showing each individual textdraw.
Reply
#2

Nope, you're doing that okay.
However, you could use functions for you'd like to..
pawn Код:
// under OnPlayerConnect or anywhere else you placed that
SetUseBoxText(playerid);
//..

// somewhere
SetUseBoxText(playerid)
{
     Textdraw0[playerid] = TextDrawCreate(155.750000, 198.083282, "usebox");
     TextDrawLetterSize(Textdraw0[playerid], 0.000000, 8.111574);
     TextDrawTextSize(Textdraw0[playerid], 52.375000, 0.000000);
     TextDrawAlignment(Textdraw0[playerid], 1);
     TextDrawColor(Textdraw0[playerid], 0);
     TextDrawUseBox(Textdraw0[playerid], true);
     TextDrawBoxColor(Textdraw0[playerid], 102);
     TextDrawSetShadow(Textdraw0[playerid], 0);
     TextDrawSetOutline(Textdraw0[playerid], 0);
     TextDrawFont(Textdraw0[playerid], 0);
}
Reply
#3

Alright thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)