GetPlayerLocation: Difference between revisions
From Onset Developer Wiki
No edit summary |
No edit summary |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{Info|Function|Server & Client|1.0}} | {{Info|Function|Server & Client|1.0}} | ||
{{FuncDescription| | {{FuncDescription|Get the specified client's location.}} | ||
{{FuncSyntax|GetPlayerLocation(player)}} | {{FuncSyntax|GetPlayerLocation(player)}} | ||
{{FuncParameters}} | {{FuncParameters}} | ||
{{FuncParam|player| | {{FuncParam|player|The player identifier. On the client this parameter is optional and will return the local player location if not set.}} | ||
{{FuncReturnValue| | {{FuncReturnValue|Returns three float value X, Y, Z representing the players location.}} | ||
== Example == | == Example == | ||
<syntaxhighlight lang="Lua"> | |||
AddEvent("OnRenderHUD", function() | |||
local x, y, z = GetPlayerLocation() | |||
AddPlayerChat("Player location: "..x..", "..y..", "..z) | |||
end) | |||
</syntaxhighlight> | |||
{{RelatedFunctions}} | {{RelatedFunctions}} | ||
* [[SetPlayerLocation]] |
Latest revision as of 13:36, 23 November 2019
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)