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| | {{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)