SetObjectMaterialText函数
From SA-MP Wiki
Description:
将文字嵌入进物件的相关函数,[0.3E新增功能].
(objectid, text[], materialindex = 0, materialsize = OBJECT_MATERIAL_SIZE_256x128, fontface[] = "Arial", fontsize = 24, bold = 1, fontcolor = 0xFFFFFFFF, backcolor = 0, textalignment = 0)
objectid | 你想要嵌入文字的物件ID. |
text | 你想显示在物件的文字. |
materialindex | 文本的材料指数. |
materialsize | 设置材料 大小. |
fontface | 设置字体. |
fontsize | 设置字体 (MAX 255). |
bold | 设置加粗选项, 1 为加粗, 0 为不加粗. |
fontcolor | 输入 ARGB格式的字体前景色. |
backcolor | 输入 ARGB格式的字体背景色. |
textalignment | 设置字体文本 对齐格式 (默认为左). |
Return Values:
This function does not return any specific values.
if (strcmp("/text", cmdtext, true) == 0) { new myobject = CreateObject(19353, 0, 0, 10, 0.0, 0.0, 90.0); //物件名称 SetObjectMaterialText(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); // 物件里将会显示 "SA-MP 0.3e RC7" , 字体前景色为橙色,背景色为黑色 return 1; }
![]() Note | Color embedding 可以使用字体颜色嵌入. |
[edit]
Related Functions
The following functions may be helpful as they relate to this function in one way or another.
- SetPlayerObjectMaterialText: Replace the texture of a player object with text.
- SetObjectMaterial: Replace the texture of an object with the texture from another model in the game.SetObjectMaterialText