warning Not Translated
This page has not been translated into the language that your browser requested yet. The English content is being shown as a fallback.
If you want to contribute a translation for this page then please click here.
Create3DTextLabel
Description
Creates a 3D Text Label at a specific location in the world
Name | Description |
---|---|
const text[] | The initial text string. |
colour | The text Color, as an integer or hex in RGBA color format |
Float:x | X-Coordinate |
Float:y | Y-Coordinate |
Float:z | Z-Coordinate |
Float:drawDistance | The distance from where you are able to see the 3D Text Label |
virtualWorld | The virtual world in which you are able to see the 3D Text |
bool:testLOS | Test the line-of-sight so this text can't be seen through objects (true/false) |
OPEN_MP_TAGS:... | Indefinite number of arguments of any tag. |
Returns
The ID of the newly created 3D Text Label, or INVALID_3DTEXT_ID
if the 3D Text Label limit (MAX_3DTEXT_GLOBAL
) was reached.
Examples
public OnGameModeInit()
{
Create3DTextLabel("I'm at the coordinates:\n30.0, 40.0, 50.0", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0, false);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/mark", true))
{
new name[MAX_PLAYER_NAME];
new Float:x, Float:y, Float:z;
new worldid;
GetPlayerName(playerid, name, sizeof(name));
GetPlayerPos(playerid, x, y, z);
worldid = GetPlayerVirtualWorld(playerid);
Create3DTextLabel("%s marked this place", 0xFF0000FF, x, y, z, 15.0, worldid, false, name);
return 1;
}
return 0;
}
Notes
tip
drawDistance seems to be a lot smaller when spectating.
tip
Use colour embedding for multiple colours in the text.
warning
- If text[] is empty, the server/clients next to the text might crash! (Fixed in open.mp)
- If the virtualworld is set as -1 the text will not appear.
Related Functions
- Delete3DTextLabel: Delete a 3D text label.
- IsValid3DTextLabel: Checks if a 3D text label is valid.
- Is3DTextLabelStreamedIn: Checks if a 3D text label is streamed in for a player.
- Attach3DTextLabelToPlayer: Attach a 3D text label to a player.
- Attach3DTextLabelToVehicle: Attach a 3D text label to a vehicle.
- Update3DTextLabelText: Change the text of a 3D text label.
- Get3DTextLabelText: Gets the 3D text label text.
- Get3DTextLabelColour: Gets the 3D text label colour.
- Get3DTextLabelPos: Gets the 3D text label position.
- Get3DTextLabelDrawDistance: Gets the 3D text label draw distance.
- Set3DTextLabelDrawDistance: Sets the 3D text label draw distance.
- Get3DTextLabelVirtualWorld: Gets the 3D text label virtual world id.
- Set3DTextLabelVirtualWorld: Sets the 3D text label virtual world id.
- Get3DTextLabelLOS: Gets the 3D text label line-of-sight.
- Set3DTextLabelLOS: Sets the 3D text label line-of-sight.
- CreatePlayer3DTextLabel: Create A 3D text label for one player.
- DeletePlayer3DTextLabel: Delete a player's 3D text label.
- UpdatePlayer3DTextLabelText: Change the text of a player's 3D text label.