[Tutorial] Making a textdraw without editors
#1

I make this tutorial cause I see many people having difficulties on making textdraws especially with the desirable position on screen. Of cource editor applications are useful but there's no reason to use them unless you want to make advanced elaborations on your textdraws. Using a textdraw editor to make a textdraw like the one below, is like killing an insect with an rpg. I remembered I made a comment on a relative thread and the guy asked me: "So you just guess the position?" Of cource not. How to adjust the textdraw's size is also described here. This is the simple way to do this:

You create a command on a filterscript you already use, like this:

By typing for 1st time the command, the textdraw appears, typing again makes it dissapear.
pawn Code:
new Text:Textdraw, is=0;

CMD:test(playerid, params[])
{
    if (is==0)
    {
        is=1;
        Textdraw = TextDrawCreate(0, 0, "Fire in the hole!");
        TextDrawColor(Textdraw, 0x000000FF);
        TextDrawSetOutline(Textdraw, 1);
        TextDrawBackgroundColor(Textdraw, 0x7FA31AFF);
        TextDrawLetterSize(Textdraw, 0.27, 0.9);
        TextDrawFont(Textdraw, 2);
        TextDrawShowForPlayer(playerid, Textdraw);

    }
    else
    {
        TextDrawDestroy(Textdraw);
        is=0;
    }
    return 1;
}
Elaborating the textdraw

You want to adjust the size first rather than the position, cause if position is set and you change size, you might have issues if textdraw is placed on screen borders.

Size
To set your size you play with this line: TextDrawLetterSize(Textdraw, x, y);
Increasing the x makes your textdraw longer, while changing the y make it longer downwards, having bigger length vertically.

Position
This is the line you will be dealing with: Textdraw = TextDrawCreate(x, y, "Fire in the hole!");
The (0, 0) coordinates place the textdraw full left up on screen. Increasing the x value transfers it to the right. Increasing the y value transfers it downwards. Vince's textdraw map can give you a very clear view about position coordinates: https://sampwiki.blast.hk/wiki/Image:Textdraw_map.png

The "algorithm"
After saving any change to the filterscript's code and successfully compiling, you type "reloadfs yourfs" in server's command window so changes do get applied, open samp and enter the command. The textdraw appears. Of cource you can't get the size/position with 1 try! You go to pawno, change the x, y accordingly to the desirable position's direction, or the x, y for the size, then go to the server command window and type "reloadfs yourfs". Open samp again, type the command... etc, until you get your position/size.

Of cource there are more things to change on a textdraw but all others are much easier, like fonts or words' alignment.
Information about every function on wiki: https://sampwiki.blast.hk/wiki/TextDrawCreate and scroll down.
I hope this helps many beginners.
Reply
#2

Quote:
Originally Posted by HurtLocker
View Post
Using a textdraw editor to make a textdraw like the one below, is like killing an insect with an rpg.
Quote:
Originally Posted by HurtLocker
View Post
Of cource you can't get the size/position with 1 try! You go to pawno, change the x, y accordingly to the desirable position's direction, or the x, y for the size, then go to the server command window and type "reloadfs yourfs". Open samp again, type the command... etc, until you get your position/size.
Quite the contradiction. Personally I think that using a textdraw editor to do it right the first time is a much better option, rather than trying to just guess the size and positions. If you're making many textdraws you'll get acquainted with scales and positions eventually, but still.

Also refer to this map that I made last year: https://sampwiki.blast.hk/wiki/Image:Textdraw_map.png
Reply
#3

Thanks for sharing your opinion Vince, I added your map.
Reply
#4

Quote:

"So you just guess the position?" Of cource not.

i still think its a bit of common sense guess work not for just placeing it,
but to place it accurately we need a guess and try it a bit times...........
Dont you?
Reply
#5

While I do agree that simply using an editor is a more practical solution long term, it also could not hurt to gain an understanding of the fundamentals of textdraws. After all, if you ever have an issue using one of these systems I'm sure fundamental knowledge of textdraws could go a long way in troubleshooting.

Also, when using textdraw editors you are typically eyeballing your placement. With a knowledge of textdraw fundamentals (and an excellent resource like that map you posted), you can have more precise control over placement.
Reply
#6

Quote:
Originally Posted by RvGamers
View Post
While I do agree that simply using an editor is a more practical solution long term, it also could not hurt to gain an understanding of the fundamentals of textdraws. After all, if you ever have an issue using one of these systems I'm sure fundamental knowledge of textdraws could go a long way in troubleshooting.

Also, when using textdraw editors you are typically eyeballing your placement. With a knowledge of textdraw fundamentals (and an excellent resource like that map you posted), you can have more precise control over placement.
I agree at this point, using editors will never get your really understand how textdraws work. You just copy paste in some codes in to your gamemode and your done. I find this a great tutorial specially for me because i need to create some textdraws, without editors. So thank you for sharing this knowlage!
Reply
#7

I'd never waste my time trying to do it manually, by the time I get it looking how I want it with just one TD I could have made several in a TD editor.

Quote:
Originally Posted by nielsbon1
View Post
I agree at this point, using editors will never get your really understand how textdraws work. You just copy paste in some codes in to your gamemode and your done. I find this a great tutorial specially for me because i need to create some textdraws, without editors. So thank you for sharing this knowlage!
This is complete non-sense, your not going to get very far with them if you don't understand them TD editor or not. Actually you'd probably learn more using a TD editor since you'd be spending less time fiddle fucking with your TD's and actually doing the implementation.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)