[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


Messages In This Thread
Making a textdraw without editors - by HurtLocker - 28.05.2013, 11:47
Re: Making a textdraw without editors - by Vince - 28.05.2013, 13:23
AW: Making a textdraw without editors - by HurtLocker - 28.05.2013, 14:31
Re: Making a textdraw without editors - by Abhishek. - 28.05.2013, 15:21
Re: Making a textdraw without editors - by RvGamers - 28.05.2013, 16:11
Re: Making a textdraw without editors - by nielsbon1 - 28.05.2013, 16:22
Re: Making a textdraw without editors - by Pottus - 28.05.2013, 17:34

Forum Jump:


Users browsing this thread: 1 Guest(s)