SetPlayerObjectMaterialText

From SA-MP Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 21:02, 22 February 2020
OstGot (Talk | contribs)

← Previous diff
Current revision
OstGot (Talk | contribs)

Line 9: Line 9:
{{Param|objectid|The ID of the object on which to place the text.}} {{Param|objectid|The ID of the object on which to place the text.}}
{{Param|text|The text to set (MAX 2048 characters).}} {{Param|text|The text to set (MAX 2048 characters).}}
-{{Param|materialindex|The material index to replace with text (DEFAULT: 0) (0 to 15).}}+{{Param|materialindex|The material index to replace with text (default: 0) (0 to 15).}}
-{{Param|materialsize|The [[Material_Size|size]] of the material (DEFAULT: 256x128).}}+{{Param|materialsize|The [[Material_Size|size]] of the material (default: 256x128).}}
-{{Param|fontface|The font to use (DEFAULT: Arial).}}+{{Param|fontface|The font to use (default: Arial).}}
-{{Param|fontsize|The size of the text (DEFAULT: 24) (MAX 255).}}+{{Param|fontsize|The size of the text (default: 24) (MAX 255).}}
-{{Param|bold|Bold text. Set to 1 for bold, 0 for not (DEFAULT: 1).}}+{{Param|bold|Bold text. Set to 1 for bold, 0 for not (default: 1).}}
-{{Param|fontcolor|The color of the text (DEFAULT: White).}}+{{Param|fontcolor|The color of the text (default: White).}}
-{{Param|backcolor|The background color (DEFAULT: None (transparent)).}}+{{Param|backcolor|The background color (default: None (transparent)).}}
-{{Param|textalignment|The [[Text_Alignments|alignment]] of the text (DEFAULT: Left).}}+{{Param|textalignment|The [[Text_Alignments|alignment]] of the text (default: left).}}
{{NoReturn}} {{NoReturn}}

Current revision



SetPlayerObjectMaterialText was added in SA-MP 0.3e This function was added in SA-MP 0.3e and will not work in earlier versions!


Description:

Replace the texture of a player object with text.


Parameters:
(playerid, objectid, text[], materialindex = 0, materialsize = OBJECT_MATERIAL_SIZE_256x128, fontface[] = "Arial", fontsize = 24, bold = 1, fontcolor = 0xFFFFFFFF, backcolor = 0, textalignment = 0)
playeridThe ID of the player whose player object to set the text of.
objectidThe ID of the object on which to place the text.
textThe text to set (MAX 2048 characters).
materialindexThe material index to replace with text (default: 0) (0 to 15).
materialsizeThe size of the material (default: 256x128).
fontfaceThe font to use (default: Arial).
fontsizeThe size of the text (default: 24) (MAX 255).
boldBold text. Set to 1 for bold, 0 for not (default: 1).
fontcolorThe color of the text (default: White).
backcolorThe background color (default: None (transparent)).
textalignmentThe alignment of the text (default: left).


Return Values:

This function does not return any specific values.


if (strcmp("/text", cmdtext, true) == 0)
{
    new myobject = CreatePlayerObject(playerid, 19353, 0, 0, 10, 0.0, 0.0, 90.0); //create the object
    SetPlayerObjectMaterialText(playerid, myobject, "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;
}
Image:32px-Ambox_warning_orange.png

Note

Color embedding can be used for multiple colors in the text.


Related Functions

The following functions may be helpful as they relate to this function in one way or another.

Filterscripts with texturing/text support

Personal tools