25.11.2012, 03:31
First you need to declare a variable to hold the TD for each player:
Now we will create each TD, one for each player. This should be done in OnGameModeInit or OnFilterScriptExit
Now that the TD is created, to display it whenever you need to the player, use TextDrawShowForPlayer
If you wish to change the text of the TD, then you will need to hide it, change the text, and re-show it.
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
pawn Код:
new
Text: TD_Detector[MAX_PLAYERS];
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);
}
pawn Код:
TextDrawShowForPlayer(playerid, TD_Detector[playerid]);
pawn Код:
TextDrawHideForPlayer(playerid, TD_Detector[playerid]);
TextDrawSetString(TD_Detector[playerid], "Text");
TextDrawShowForPlayer(playerid, TD_Detector[playerid]);