CreateWaypoint: Difference between revisions

From Onset Developer Wiki
28days (talk | contribs)
Created page with "{{Info|Function|Client|1.0}} {{FuncDescription|Creates a waypoint in the world. Distance is calculated automatically and shown to the player.}} {{FuncSyntax|CreateWaypoint(n..."
 
No edit summary
 
Line 3: Line 3:
{{FuncDescription|Creates a waypoint in the world. Distance is calculated automatically and shown to the player.}}
{{FuncDescription|Creates a waypoint in the world. Distance is calculated automatically and shown to the player.}}


{{FuncSyntax|CreateWaypoint(name, x, y, z)}}
{{FuncSyntax|CreateWaypoint(x, y, z, text)}}
<div class="noprint" style="float:right;">
<div class="noprint" style="float:right;">
[[File:Example_Waypoint2.png]]
[[File:Example_Waypoint2.png]]
</div>
</div>
{{FuncParameters}}
{{FuncParameters}}
{{FuncParam|name|Text that appears on the waypoint. Pass an empty string to remove a waypoint.}}
{{FuncParam|x|Coordinate X}}
{{FuncParam|x|Coordinate X}}
{{FuncParam|y|Coordinate Y}}
{{FuncParam|y|Coordinate Y}}
{{FuncParam|z|Coordinate Z}}
{{FuncParam|z|Coordinate Z}}
{{FuncParam|text|Text that appears on the waypoint. Pass an empty string to remove a waypoint.}}


{{FuncReturnValue|Returns the waypoint identifier.}}
{{FuncReturnValue|Returns the waypoint identifier.}}
Line 20: Line 20:
if k == "K" then
if k == "K" then
local x, y, z = GetPlayerLocation()
local x, y, z = GetPlayerLocation()
CreateWaypoint("Saved Location", x, y, z)
CreateWaypoint(x, y, z, "Saved Location")
end
end
end
end

Latest revision as of 21:55, 10 December 2019

CreateWaypoint

Type: Function
Context: Client
Introduced: v1.0

Description

Creates a waypoint in the world. Distance is calculated automatically and shown to the player.

Syntax

CreateWaypoint(x, y, z, text)

Parameters

  • x
    Coordinate X
  • y
    Coordinate Y
  • z
    Coordinate Z
  • text
    Text that appears on the waypoint. Pass an empty string to remove a waypoint.

Return Value

  • Returns the waypoint identifier.

Example

function OnKeyPress(k)
	if k == "K" then
		local x, y, z = GetPlayerLocation()
		CreateWaypoint(x, y, z, "Saved Location")
	end
end
AddEvent("OnKeyPress", OnKeyPress)

See also