
MissionTD[playerid] = CreatePlayerTextDraw(playerid, 255.000000, 110.000000, "Mission Text Here");
PlayerTextDrawBackgroundColor(playerid, MissionTD[playerid], 255);
PlayerTextDrawFont(playerid, MissionTD[playerid], 2);
PlayerTextDrawLetterSize(playerid, MissionTD[playerid], 0.260000, 1.100000);
PlayerTextDrawColor(playerid, MissionTD[playerid], -1);
PlayerTextDrawSetOutline(playerid, MissionTD[playerid], 1);
PlayerTextDrawSetProportional(playerid, MissionTD[playerid], 1);
PlayerTextDrawAlignment(playerid, MissionTD[playerid], 2);
PlayerTextDrawUseBox(playerid, MissionTD[playerid], 1);
PlayerTextDrawBoxColor(playerid, MissionTD[playerid], 170);
PlayerTextDrawTextSize(playerid, MissionTD[playerid], 16.000000, 657.000000);
new PlayerText:TDEditor_PTD[playerid][2];
// Box
TDEditor_PTD[playerid][0] = CreatePlayerTextDraw(playerid,45.199993, 42.160011, "box");
PlayerTextDrawLetterSize(playerid,TDEditor_PTD[playerid][0], 0.000000, 7.679999);
PlayerTextDrawTextSize(playerid,TDEditor_PTD[playerid][0], 205.000000, 0.000000);
PlayerTextDrawAlignment(playerid,TDEditor_PTD[playerid][0], 1);
PlayerTextDrawColor(playerid,TDEditor_PTD[playerid][0], -1);
PlayerTextDrawUseBox(playerid,TDEditor_PTD[playerid][0], 1);
PlayerTextDrawBoxColor(playerid,TDEditor_PTD[playerid][0], 170);
PlayerTextDrawSetShadow(playerid,TDEditor_PTD[playerid][0], 0);
PlayerTextDrawBackgroundColor(playerid, TDEditor_PTD[playerid][0], 255);
PlayerTextDrawFont(playerid, TDEditor_PTD[playerid][0] , 1);
PlayerTextDrawSetProportional(playerid,TDEditor_PTD[playerid][0], 1);
// Mission text
TDEditor_PTD[playerid][1] = CreatePlayerTextDraw(playerid,47.5999, 45.8932, "Follow the 'CJ' icon~n~on the radar to get~n~back to the hood.");
PlayerTextDrawLetterSize(playerid, TDEditor_PTD[playerid][1], 0.428000, 2.279466);
PlayerTextDrawAlignment(playerid, TDEditor_PTD[playerid][1], 1);
PlayerTextDrawColor(playerid, TDEditor_PTD[playerid][1], -1061109505);
PlayerTextDrawSetShadow(playerid, TDEditor_PTD[playerid][1], 0);
PlayerTextDrawBackgroundColor(playerid, TDEditor_PTD[playerid][1], -1061109505);
PlayerTextDrawFont(playerid, TDEditor_PTD[playerid][1], 1);
PlayerTextDrawSetProportional(playerid, TDEditor_PTD[playerid][1], 1);
|
Well, Okay i see you are suffering to make a textdraw. here is it
Код:
new PlayerText:TDEditor_PTD[playerid][2];
// Box
TDEditor_PTD[playerid][0] = CreatePlayerTextDraw(playerid,45.199993, 42.160011, "box");
PlayerTextDrawLetterSize(playerid,TDEditor_PTD[playerid][0], 0.000000, 7.679999);
PlayerTextDrawTextSize(playerid,TDEditor_PTD[playerid][0], 205.000000, 0.000000);
PlayerTextDrawAlignment(playerid,TDEditor_PTD[playerid][0], 1);
PlayerTextDrawColor(playerid,TDEditor_PTD[playerid][0], -1);
PlayerTextDrawUseBox(playerid,TDEditor_PTD[playerid][0], 1);
PlayerTextDrawBoxColor(playerid,TDEditor_PTD[playerid][0], 170);
PlayerTextDrawSetShadow(playerid,TDEditor_PTD[playerid][0], 0);
PlayerTextDrawBackgroundColor(playerid, TDEditor_PTD[playerid][0], 255);
PlayerTextDrawFont(playerid, TDEditor_PTD[playerid][0] , 1);
PlayerTextDrawSetProportional(playerid,TDEditor_PTD[playerid][0], 1);
// Mission text
TDEditor_PTD[playerid][1] = CreatePlayerTextDraw(playerid,47.5999, 45.8932, "Follow the 'CJ' icon~n~on the radar to get~n~back to the hood.");
PlayerTextDrawLetterSize(playerid, TDEditor_PTD[playerid][1], 0.428000, 2.279466);
PlayerTextDrawAlignment(playerid, TDEditor_PTD[playerid][1], 1);
PlayerTextDrawColor(playerid, TDEditor_PTD[playerid][1], -1061109505);
PlayerTextDrawSetShadow(playerid, TDEditor_PTD[playerid][1], 0);
PlayerTextDrawBackgroundColor(playerid, TDEditor_PTD[playerid][1], -1061109505);
PlayerTextDrawFont(playerid, TDEditor_PTD[playerid][1], 1);
PlayerTextDrawSetProportional(playerid, TDEditor_PTD[playerid][1], 1);
![]() |
|
why create a playertext for a box? also this could be done using 1 textdraw instead of 2
|

enum MissionLabelEnum{
mlReward,
mlTitle[68],
mlDescription[512]
};
new MissionLabel[5][MissionLabelEnum] = {
{1000, "Follow the train", "Ill use it latter..."},
{1000, "Follow the train", "Ill use it latter..."},
{1000, "Follow the train", "Ill use it latter..."},
{1000, "Follow the train", "Ill use it latter..."},
{1000, "Follow the train", "Ill use it latter..."}
};
new desc[128];
desc = "To more information use the command /info";
new str[128];
format(str, sizeof(str), "Mission %i: %s~n~%s", indice, MissionLabel[indice][mlTitle], desc );
PlayerTextDrawSetString(playerid, MissionTD[playerid][1], str);
PlayerTextDrawShow(playerid, MissionTD[playerid][0]);
PlayerTextDrawShow(playerid, MissionTD[playerid][1]);
Follow the train~n~/use Mission...
~n~
|
Then you gotta programmatically increase the size according to the text.
|
//Global TextDraws: new Text:TDEditor_TD[1]; TDEditor_TD[0] = TextDrawCreate(9.824373, 10.916652, "Follow_the_'CJ'_icon~n~on_the_radar_to_get~n~back_to_the_hood."); TextDrawLetterSize(TDEditor_TD[0], 0.400000, 1.600000); TextDrawTextSize(TDEditor_TD[0], 142.000000, 0.000000); TextDrawAlignment(TDEditor_TD[0], 1); TextDrawColor(TDEditor_TD[0], -1061109505); TextDrawUseBox(TDEditor_TD[0], 1); TextDrawBoxColor(TDEditor_TD[0], 255); TextDrawSetShadow(TDEditor_TD[0], 0); TextDrawBackgroundColor(TDEditor_TD[0], 255); TextDrawFont(TDEditor_TD[0], 1); TextDrawSetProportional(TDEditor_TD[0], 1);
|
Here's an example to that:
Код:
//Global TextDraws: new Text:TDEditor_TD[1]; TDEditor_TD[0] = TextDrawCreate(9.824373, 10.916652, "Follow_the_'CJ'_icon~n~on_the_radar_to_get~n~back_to_the_hood."); TextDrawLetterSize(TDEditor_TD[0], 0.400000, 1.600000); TextDrawTextSize(TDEditor_TD[0], 142.000000, 0.000000); TextDrawAlignment(TDEditor_TD[0], 1); TextDrawColor(TDEditor_TD[0], -1061109505); TextDrawUseBox(TDEditor_TD[0], 1); TextDrawBoxColor(TDEditor_TD[0], 255); TextDrawSetShadow(TDEditor_TD[0], 0); TextDrawBackgroundColor(TDEditor_TD[0], 255); TextDrawFont(TDEditor_TD[0], 1); TextDrawSetProportional(TDEditor_TD[0], 1); https://imgur.com/a/HOJvvzo PS: I'm not saying you should use the one I made, this is just an example showing you how & when to use ~n~ |
format(str, sizeof(str), "Mission %i: %s~n~%s", indice, MissionLabel[indice][mlTitle], desc );
|
The problem is:
Код:
format(str, sizeof(str), "Mission %i: %s~n~%s", indice, MissionLabel[indice][mlTitle], desc ); |
StringInsertNewLines(string[], charcount, insert[], size = sizeof string)
{
new len = strlen(string), lastspace = -1, count, insertlen = strlen(insert);
for(new i = 0; i < len && i < size; i ++)
{
if(string[i] == ' ' && count != charcount) lastspace = i;
if(count == charcount)
{
if(lastspace == -1) // Line end reached, but no space was found for the whole line. Break it here
{
strins(string, insert, i, size);
strins(string, "-", i, size);
count = 0;
lastspace = -1;
i += insertlen + 1;
len += insertlen + 1;
continue;
}
else // Line end reached and there was a space in the line, split it there
{
strdel(string, lastspace, lastspace + 1);
strins(string, insert, lastspace, size);
count = i - lastspace;
lastspace = -1;
i += insertlen - 1;
len += insertlen - 1;
continue;
}
}
count ++;
}
return 1;
}
StringInsertNewLine(string, 30, "~n~");
|
Original: This is a test text. It contains veryveryveryveryveryvery long words too. With new lines every ~15 characters: This is a test text. It contains veryveryveryver- yveryvery long words too. |