SetObjectMaterialText

SetObjectMaterialText

Description:
Function SetObjectMaterialText replace the texture of an object with text.
Function SetObjectMaterialText was added in 0.3e and will not work in earlier versions!
Color embedding can be used for multiple colors in the text.
You MUST use ARGB color format, not RGBA like used in client messages etc.


Parameters:
(objectid, text[], materialindex, materialsize, fontface[], fontsize, bold, fontcolor, backcolor, textalignment)
int objectid The ID of the object to replace the texture of with text.
string text The text to show on the object (MAX 2048 characters).
int materialindex The object's material index to replace with text (default: 0) (0 to 15).
string materialsize The size of the material (default: 256x128).
string fontface The font to use (default: Arial).
int fontsize The size of the text (default: 24) (MAX 255).
bool bold Bold text. Set to 1 for bold, 0 for not (default: 1).
int fontcolor The color of the text, in ARGB format (default: White).
int backcolor The background color, in ARGB format (default: None (transparent)).
int textalignment The alignment of the text (default: left).


Return Values:
  • 1: The function was executed successfully.
  • 0: The function failed to execute.


Examples:
if (strcmp("/text", cmdtext, true) == 0)
{
    new objectid = CreateObject(19353, 0, 0, 10, 0.0, 0.0, 90.0); //create the object
    SetObjectMaterialText(objectid, "SA-MP {FFFFFF}0.3{008500}e {FF8200}RC7", 0, OBJECT_MATERIAL_SIZE_256x128,
    "Arial", 28, 0, 0xFFFF8200, 0xFF000000, OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
    // write "SA-MP 0.3e RC7" on the object, with orange font color and black background
    return 1;
}


Related Functions
The following functions may be useful, as they are related to this function in one way or another.


Filterscripts with texturing/text support:
  • Ultimate Creator
  • SetObjectMaterialText Editor by RIDE2DAY
  • Fusez's Map Editor by RedFusion