Mission label
#1

I wanna remake offline mission system to SAMP, i just need one visual help...



How to create this label?
Textdraw?
There is a example or someone could give me a base?
Reply
#2

Try creating a textdraw similiar to that
Reply
#3

I tried, but it being a shit:
Код:
        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);
I wanna a square, my is only in a line

Is anybody can help me to do something like the image?
Reply
#4

https://sampforum.blast.hk/showthread.php?tid=376758
Reply
#5

Quote:
Originally Posted by Shinja
Посмотреть сообщение
I'm already did one in a textdraw editor...
Test my one, it's in only in a line, i was try to do like on the image...

Did u know why?
Reply
#6

use ipleomax textdraw editor
-Make the box adujust its size as per picture
-Then write text in it if you want to make your text in another line put this "Mission~n~Text here"
Reply
#7

You must use usebox
Reply
#8

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);
Preview :

Reply
#9

Quote:
Originally Posted by UFF
Посмотреть сообщение
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);
Preview :

why create a playertext for a box? also this could be done using 1 textdraw instead of 2
Reply
#10

Quote:
Originally Posted by Lokii
Посмотреть сообщение
why create a playertext for a box? also this could be done using 1 textdraw instead of 2
The code he provided above is playertext(box with text).So, I thought he is showing that textdraw for a player but not for global. But, it's not that much hard to change a player textdraw to a global textdraw.


I just provided that separately for him to understand how to create textdraws like userbox and mission text. Didn't you see his textdraw code which he provided above? (It was like a straight line box with mission text, messed up with coordinates). I could have made it in 1 textdraw but yet he failed to make one like that. So, for that i made it separately so that he can re-edit it and understand.

If i give him the textdraw code which you said, he will just copy and paste it which doesn't give him anything other than confusion later on.
Reply
#11

The letters are escaping to the mission square...



What do i need to do to this be inside of the square?
I mean, limit the lines, when break the limit, break a line...
Код:
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]);
Reply
#12

PHP код:
Follow the train~n~/use Mission... 
Reply
#13

Quote:
Originally Posted by willbedie
Посмотреть сообщение
PHP код:
Follow the train~n~/use Mission... 
^ also increase the userbox size.
Reply
#14

increase width of the box or put
PHP код:
~n
after how and make increase of height of the box
Reply
#15

But there is no way to detect when text get the max width add a ~n~ to next line?
Reply
#16

Then you gotta programmatically increase the size according to the text.
Reply
#17

Quote:
Originally Posted by ShihabSoft
Посмотреть сообщение
Then you gotta programmatically increase the size according to the text.
How? Thats like my first tbox textdraw and i just made because i got helps in here...
Reply
#18

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);
Picture:
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~
Reply
#19

Quote:
Originally Posted by willbedie
Посмотреть сообщение
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);
Picture:
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~
The problem is:
Код:
format(str, sizeof(str), "Mission %i: %s~n~%s", indice, MissionLabel[indice][mlTitle], desc );
My text box is not a static value, it will change, i have to in some way break the line automatically
Reply
#20

Quote:
Originally Posted by binnyl
Посмотреть сообщение
The problem is:
Код:
format(str, sizeof(str), "Mission %i: %s~n~%s", indice, MissionLabel[indice][mlTitle], desc );
My text box is not a static value, it will change, i have to in some way break the line automatically
You could insert a new line identifier automatically every X characters.

Код:
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;
}
Usage:

Код:
StringInsertNewLine(string, 30, "~n~");
Will insert a new line each 30 characters. It will break the line correctly when there is a space before the end of the line. If there is no space, it will attach a "-" and break the line.

Example:

Quote:

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.

Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)