CreateText3D: Difference between revisions

From Onset Developer Wiki
Kuzkay (talk | contribs)
No edit summary
No edit summary
 
(5 intermediate revisions by 3 users not shown)
Line 3: Line 3:
{{FuncDescription|Creates a 3d text (hologram) which always faces the player camera, only visible from certain range}}
{{FuncDescription|Creates a 3d text (hologram) which always faces the player camera, only visible from certain range}}


{{FuncSyntax|CreateText3D(text, size, x, y, z, rx, ry, rz)}}
{{FuncSyntax|CreateText3D(text, size, x, y, z [, rx, ry, rz])}}


{{FuncParameters}}
{{FuncParameters}}
Line 11: Line 11:
{{FuncParam|y|Y position}}
{{FuncParam|y|Y position}}
{{FuncParam|z|Z position}}
{{FuncParam|z|Z position}}
{{FuncParam|rx|X rotation}}
{{FuncParamOptional|rx|X rotation}}
{{FuncParam|ry|Y rotation}}
{{FuncParamOptional|ry|Y rotation}}
{{FuncParam|rz|Z rotation}}
{{FuncParamOptional|rz|Z rotation}}


{{FuncReturnValue|__EDIT_ME__}}
{{FuncReturnValue|Returns the text 3D identifier.}}


== Example ==
== Example ==
<syntaxhighlight lang="Lua">
<syntaxhighlight lang="Lua">
function OnPackageStart()
function OnPackageStart()
 
local i = 1
Delay(5000, function ()
for _ in pairs(Shops) do
local i = 1
Shops[i].npc = CreateNPC(Shops[i].npc_model, Shops[i].x, Shops[i].y, Shops[i].z, Shops[i].h)
for _ in pairs(Shops) do
SetNPCAnimation(Shops[i].npc, "CROSSARMS", true)
Shops[i].npc = CreateNPC(Shops[i].npc_model, Shops[i].x, Shops[i].y, Shops[i].z, Shops[i].h)
SetNPCHealth(Shops[i].npc, 999999999)
SetNPCAnimation(Shops[i].npc, "CROSSARMS", true)
CreateText3D(Shops[i].name, 17, Shops[i].x, Shops[i].y, Shops[i].z + 130, 0,0,0)
SetNPCHealth(Shops[i].npc, 999999999)
i = i + 1
CreateText3D(Shops[i].name, 17, Shops[i].x, Shops[i].y, Shops[i].z + 130, 0,0,0)
end
i = i + 1
end
end)
end
end
AddEvent("OnPackageStart", OnPackageStart)
AddEvent("OnPackageStart", OnPackageStart)
</syntaxhighlight>
</syntaxhighlight>


{{RelatedFunctions}}
{{RelatedFunctions}}
__EDIT_ME__
{{Text3DFunctions}}

Latest revision as of 13:50, 12 November 2021

CreateText3D

Type: Function
Context: Server
Introduced: v1.0

Description

Creates a 3d text (hologram) which always faces the player camera, only visible from certain range

Syntax

CreateText3D(text, size, x, y, z [, rx, ry, rz])

Parameters

  • text
    Text you want to show
  • size
    Size of the text
  • x
    X position
  • y
    Y position
  • z
    Z position
  • rx (optional)
    X rotation
  • ry (optional)
    Y rotation
  • rz (optional)
    Z rotation

Return Value

  • Returns the text 3D identifier.

Example

function OnPackageStart()
	local i = 1
	for _ in pairs(Shops) do
		Shops[i].npc = CreateNPC(Shops[i].npc_model, Shops[i].x, Shops[i].y, Shops[i].z, Shops[i].h)
		SetNPCAnimation(Shops[i].npc, "CROSSARMS", true)
		SetNPCHealth(Shops[i].npc, 999999999)
		CreateText3D(Shops[i].name, 17, Shops[i].x, Shops[i].y, Shops[i].z + 130, 0,0,0)
		i = i + 1
	end
end
AddEvent("OnPackageStart", OnPackageStart)

See also