GetPlayerLocation: Difference between revisions

From Onset Developer Wiki
Created page with "{{Info|Function|Server|1.0}} {{FuncDescription|__EDIT_ME__}} {{FuncSyntax|GetPlayerLocation(player)}} {{FuncParameters}} {{FuncParam|player|__EDIT_ME__}} {{FuncReturnValue..."
 
No edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Info|Function|Server|1.0}}
{{Info|Function|Server & Client|1.0}}


{{FuncDescription|__EDIT_ME__}}
{{FuncDescription|Get the specified client's location.}}


{{FuncSyntax|GetPlayerLocation(player)}}
{{FuncSyntax|GetPlayerLocation(player)}}


{{FuncParameters}}
{{FuncParameters}}
{{FuncParam|player|__EDIT_ME__}}
{{FuncParam|player|The player identifier. On the client this parameter is optional and will return the local player location if not set.}}


{{FuncReturnValue|__EDIT_ME__}}
{{FuncReturnValue|Returns three float value X, Y, Z representing the players location.}}


== Example ==
== Example ==
__EDIT_ME__
<syntaxhighlight lang="Lua">
AddEvent("OnRenderHUD", function()
local x, y, z = GetPlayerLocation()
AddPlayerChat("Player location: "..x..", "..y..", "..z)
end)
</syntaxhighlight>


{{RelatedFunctions}}
{{RelatedFunctions}}
__EDIT_ME__
* [[SetPlayerLocation]]

Latest revision as of 13:36, 23 November 2019

GetPlayerLocation

Type: Function
Context: Server & Client
Introduced: v1.0

Description

Get the specified client's location.

Syntax

GetPlayerLocation(player)

Parameters

  • player
    The player identifier. On the client this parameter is optional and will return the local player location if not set.

Return Value

  • Returns three float value X, Y, Z representing the players location.

Example

AddEvent("OnRenderHUD", function()
	local x, y, z = GetPlayerLocation()
	AddPlayerChat("Player location: "..x..", "..y..", "..z)
end)

See also