getLocalPlayer | Multi Theft Auto: Wiki Skip to content

getLocalPlayer

Client-side
Server-side
Shared

Manual Review Required

Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.


This function gets the player element of the client running the current script.

Syntax

player getLocalPlayer ( )

Returns

  • player: value

Returns the local player element.

Code Examples

shared

Example 1:This client side function outputs the player's current location to the console.

function outputLocalPlayerPosition()
-- get the local player's position
local px, py, pz = getElementPosition(localPlayer)
-- output it to the console
outputConsole("Your location: "..px.." "..py .." "..pz)
end

See Also