---
title: "GetObjectMaterialText | open.mp"
description: "Get the material text data from an index of the object."
canonical: https://omp.itsneufox.com/docs/scripting/functions/GetObjectMaterialText
language: en
---

# GetObjectMaterialText

warning

This function was added in omp v1.1.0.2612 and will not work in earlier versions!

## Description

Get the material text data from an index of the object.

| Name | Description |
| --- | --- |
| objectid | The ID of the object. |
| materialIndex | The material index on the object. (0 to 15) |
| text\[\] | An array into which to store the text, passed by reference. |
| textSize | The size of the text. |
| &OBJECT\_MATERIAL\_SIZE:materialSize | A variable in which to store the materialSize, passed by reference. |
| fontFace\[\] | An array into which to store the fontFace, passed by reference. |
| fontFaceSize | The size of the fontFace. |
| &fontSize | A variable in which to store the fontSize, passed by reference. |
| &bool:bold | A boolean variable in which to store the bold, passed by reference. |
| &fontColour | A variable in which to store the fontColour, passed by reference. |
| &backgroundColour | A variable in which to store the backgroundColour, passed by reference. |
| &OBJECT\_MATERIAL\_TEXT\_ALIGN:textAlignment | A variable in which to store the textAlignment, passed by reference. |

## Returns

`true` - The function was executed successfully.

`false` - The function failed to execute. The object specified does not exist or an invalid material index is specified.

## Examples

```c
new objectid = CreateObject(19174, 986.42767, -983.14850, 40.95220,   0.00000, 0.00000, 186.00000);
SetObjectMaterialText(objectid, "OPEN.MP", 0, OBJECT_MATERIAL_SIZE_256x128, "Arial", 38, true, 0xFF0000FF, 0x00000000, OBJECT_MATERIAL_TEXT_ALIGN_LEFT);

new
    text[16],
    OBJECT_MATERIAL_SIZE:materialSize,
    fontFace[16],
    fontSize,
    bool:bold,
    fontColour,
    backgroundColour,
    OBJECT_MATERIAL_TEXT_ALIGN:textAlignment;

GetObjectMaterialText(objectid, 0, text, sizeof(text), materialSize, fontFace, sizeof(fontFace), fontSize, bold, fontColour, backgroundColour, textAlignment);
// text = "OPEN.MP"
// materialSize = OBJECT_MATERIAL_SIZE_256x128
// fontFace = "Arial"
// fontSize = 38
// bold = true
// fontColour = 0xFF0000FF
// backgroundColour = 0x00000000
// textAlignment = OBJECT_MATERIAL_TEXT_ALIGN_LEFT
```

## Related Functions

-   [SetObjectMaterial](https://omp.itsneufox.com/docs/scripting/functions/SetObjectMaterial): Replace the texture of an object with the texture from another model in the game.
-   [SetObjectMaterialText](https://omp.itsneufox.com/docs/scripting/functions/SetObjectMaterialText): Replace the texture of an object with text.
-   [IsObjectMaterialSlotUsed](https://omp.itsneufox.com/docs/scripting/functions/IsObjectMaterialSlotUsed): Checks if a slot of object material is used.
-   [GetObjectMaterial](https://omp.itsneufox.com/docs/scripting/functions/GetObjectMaterial): Get the material data from an index of the object.
-   [GetPlayerObjectMaterialText](https://omp.itsneufox.com/docs/scripting/functions/GetPlayerObjectMaterialText): Get the material text data from an index of the player-object.
