TextDrawCreate
Description:
Function TextDrawCreate creates a textdraw. Textdraws are, as the name implies, text (mainly - there can be boxes, sprites and model previews (skins/vehicles/weapons/objects too) that is drawn on a player's screens. See this page for extensive information about textdraws.
|
This applies ONLY to sa-mp versions before 0.3z:
|
|
Keyboard key mapping codes (such as ~k~~VEHICLE_ENTER_EXIT~ don't work beyond 255th character. |
Parameters:
(Float:x, Float:y, text[])
float | X | The X (left/right) coordinate to create the textdraw at. |
float | Y | The Y (up/down) coordinate to create the textdraw at. |
string | text | The text that will appear in the textdraw. |
Return Values:
The ID of the created textdraw. Textdraw IDs start at 0.
Default preferences of the textdraw that have just been created:
Parameter | Value |
---|---|
Alignment | 1 |
Use box | 0 |
Shadow | 2 |
Outline | 0 |
Font | 1 |
Proportional | 1 |
Selectable | 0 |
Examples:
// This variable is used to store the id of the textdraw // so that we can use it throught the script new Text:welcomeText; public OnGameModeInit() { // This line is used to create the textdraw. // Note: This creates a textdraw without any formatting. welcomeText = TextDrawCreate(240.0,580.0,"Welcome to my SA-MP server"); return 1; } public OnPlayerConnect(playerid) { //This is used to show the player the textdraw when they connect. TextDrawShowForPlayer(playerid,welcomeText); }
Related Functions
The following functions may be useful, as they are related to this function in one way or another.
- TextDrawDestroy: Destroy a textdraw.
- TextDrawColor: Set the color of the text in a textdraw.
- TextDrawBoxColor: Set the color of the box in a textdraw.
- TextDrawBackgroundColor: Set the background color of a textdraw.
- TextDrawAlignment: Set the alignment of a textdraw.
- TextDrawFont: Set the font of a textdraw.
- TextDrawLetterSize: Set the letter size of the text in a textdraw.
- TextDrawTextSize: Set the size of a textdraw box.
- TextDrawSetOutline: Choose whether the text has an outline.
- TextDrawSetShadow: Toggle shadows on a textdraw.
- TextDrawSetProportional: Scale the text spacing in a textdraw to a proportional ratio.
- TextDrawUseBox: Toggle if the textdraw has a box or not.
- TextDrawSetString: Set the text in an existing textdraw.