Help making a Textdraw
#6

First you need to declare a variable to hold the TD for each player:
pawn Код:
new
    Text: TD_Detector[MAX_PLAYERS];
Now we will create each TD, one for each player. This should be done in OnGameModeInit or OnFilterScriptExit
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
    {
                // You need to adjust the coordinates to the desired location
        TD_Detector[i] = TextDrawCreate(471.000000, 429.000000, "Your text here");
        TextDrawAlignment(TD_Detector[i], 0);
        TextDrawBackgroundColor(TD_Detector[i], 0x000000ff);
        TextDrawFont(TD_Detector[i], 1);
        TextDrawLetterSize(TD_Detector[i], 0.499999,0.899999);
        TextDrawColor(TD_Detector[i], 0xffffffff);
        TextDrawSetOutline(TD_Detector[i], 1);
        TextDrawSetProportional(TD_Detector[i], 1);
        TextDrawSetShadow(TD_Detector[i], 1);
    }
Now that the TD is created, to display it whenever you need to the player, use TextDrawShowForPlayer
pawn Код:
TextDrawShowForPlayer(playerid, TD_Detector[playerid]);
If you wish to change the text of the TD, then you will need to hide it, change the text, and re-show it.
pawn Код:
TextDrawHideForPlayer(playerid, TD_Detector[playerid]);
TextDrawSetString(TD_Detector[playerid], "Text");
TextDrawShowForPlayer(playerid, TD_Detector[playerid]);
For any documentation of these functions, refer to the Wiki. I CBA to explain them all myself. For easy textdraw creation, look at this script (all done in-game via a menu): https://sampforum.blast.hk/showthread.php?tid=387597
Reply


Messages In This Thread
Help making a Textdraw - by jakejohnsonusa - 24.11.2012, 22:56
Re: Help making a Textdraw - by Joshman543 - 25.11.2012, 00:07
Re: Help making a Textdraw - by jakejohnsonusa - 25.11.2012, 03:14
Re: Help making a Textdraw - by Bakr - 25.11.2012, 03:18
Re: Help making a Textdraw - by jakejohnsonusa - 25.11.2012, 03:21
Re: Help making a Textdraw - by Bakr - 25.11.2012, 03:31
Re: Help making a Textdraw - by jakejohnsonusa - 25.11.2012, 06:28

Forum Jump:


Users browsing this thread: 1 Guest(s)