SetText3DAttached: Difference between revisions
From Onset Developer Wiki
Created page with "{{Info|Function|Server|1.0}} {{FuncDescription|__EDIT_ME__}} {{FuncSyntax|SetText3DAttached(text3d, attachtype, attachid, x, y, z [, rx, ry, rz, SocketName])}} {{FuncParame..." |
FlyingFork (talk | contribs) No edit summary |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{Info|Function|Server|1.0}} | {{Info|Function|Server|1.0}} | ||
{{FuncDescription| | {{FuncDescription|Attaches a 3D Text to another entity.}} | ||
{{FuncSyntax|SetText3DAttached(text3d, attachtype, attachid, x, y, z [, rx, ry, rz, SocketName])}} | {{FuncSyntax|SetText3DAttached(text3d, attachtype, attachid, x, y, z [, rx, ry, rz, SocketName])}} | ||
{{FuncParameters}} | {{FuncParameters}} | ||
{{FuncParam| | {{FuncParam|text3d|The text 3D indentifier.}} | ||
{{FuncParam|attachtype| | {{FuncParam|attachtype|[[AttachType]]}} | ||
{{FuncParam|attachid| | {{FuncParam|attachid|The identifier of the attach type (entity)}} | ||
{{FuncParam|x| | {{FuncParam|x|Relative X location.}} | ||
{{FuncParam|y| | {{FuncParam|y|Relative Y location.}} | ||
{{FuncParam|z | | {{FuncParam|z|Relative Z location.}} | ||
{{FuncParamOptional|rx| | {{FuncParamOptional|rx|Relative pitch rotation.}} | ||
{{FuncParamOptional|ry| | {{FuncParamOptional|ry|Relative yaw rotation.}} | ||
{{FuncParamOptional|rz| | {{FuncParamOptional|rz|Relative roll rotation.}} | ||
{{FuncParamOptional|SocketName| | {{FuncParamOptional|SocketName|The socket name}} | ||
{{FuncReturnValue| | {{FuncReturnValue|Returns '''true''' on success.}} | ||
== Example == | == Example == | ||
The example given below creates a 3D Text above a player's head! | |||
<syntaxhighlight lang="Lua"> | |||
AddCommand("text", function(playerid, ...) | |||
local textCheck = GetPlayerPropertyValue(playerid, "_3DText") | |||
if textCheck and IsValidText3D(textCheck) then | |||
DestroyText3D(textCheck) | |||
SetPlayerPropertyValue(playerid, "_3DText", nil) | |||
return AddPlayerChat(playerid, "The text has been removed!") | |||
end | |||
if #{...} == 0 then | |||
return AddPlayerChat(playerid, "Usage: /text <message>") | |||
end | |||
local message = table.concat({...}, " ") | |||
local text = CreateText3D(message, 10, 0, 0, 0, 0, 0, 0) | |||
SetText3DAttached(text, ATTACH_PLAYER, playerid, 25, 0, 0, 0, 90, -90, "head") | |||
SetPlayerPropertyValue(playerid, "_3DText", text) | |||
return AddPlayerChat(playerid, "Text added!") | |||
end) | |||
</syntaxhighlight> | |||
{{RelatedFunctions}} | {{RelatedFunctions}} | ||
{{Text3DFunctions}} |
Latest revision as of 18:38, 27 May 2021
Description
Attaches a 3D Text to another entity.
Syntax
SetText3DAttached(text3d, attachtype, attachid, x, y, z [, rx, ry, rz, SocketName])
Parameters
- text3d
The text 3D indentifier. - attachtype
AttachType - attachid
The identifier of the attach type (entity) - x
Relative X location. - y
Relative Y location. - z
Relative Z location. - rx (optional)
Relative pitch rotation. - ry (optional)
Relative yaw rotation. - rz (optional)
Relative roll rotation. - SocketName (optional)
The socket name
Return Value
- Returns true on success.
Example
The example given below creates a 3D Text above a player's head!
AddCommand("text", function(playerid, ...)
local textCheck = GetPlayerPropertyValue(playerid, "_3DText")
if textCheck and IsValidText3D(textCheck) then
DestroyText3D(textCheck)
SetPlayerPropertyValue(playerid, "_3DText", nil)
return AddPlayerChat(playerid, "The text has been removed!")
end
if #{...} == 0 then
return AddPlayerChat(playerid, "Usage: /text <message>")
end
local message = table.concat({...}, " ")
local text = CreateText3D(message, 10, 0, 0, 0, 0, 0, 0)
SetText3DAttached(text, ATTACH_PLAYER, playerid, 25, 0, 0, 0, 90, -90, "head")
SetPlayerPropertyValue(playerid, "_3DText", text)
return AddPlayerChat(playerid, "Text added!")
end)
See also
- GetText3DCount
- GetAllText3D
- CreateText3D
- DestroyText3D
- IsValidText3D
- SetText3DAttached
- SetText3DDetached
- SetText3DDimension
- GetText3DDimension
- SetText3DPropertyValue
- GetText3DPropertyValue
- SetText3DText
- GetText3DText
- SetText3DLocation
- GetText3DLocation
- IsText3DStreamedIn
- GetStreamedText3D
- GetText3DActor