Skip to content

Player Client ​

A library to save in the client cache the value of PlayerPedId(), his location and other useful values.
All values are updated only if necessary.
Very helpfull to optimize the resource and not call natives everytime.

Alias of the module: jo.pl

JO Variables ​

jo.player.coords ​

Returns the current player coordinates.

Example ​

lua
print(jo.player.coords)
-- OR --
print(jo.pl.coords)
-- Expected output: vec3(x,y,z)

jo.player.isMale ​

Returns if the current player is a male or not.

Example ​

lua
print(jo.player.isMale)
-- OR --
print(jo.pl.isMale)
-- Expected output: same value than IsPedMale(PlayerPedId())

jo.player.ped ​

Returns the current player ped.
This variable has a function shortcut: jo.player()

Example ​

lua
print(jo.player.ped)
-- OR --
print(jo.player())
-- OR --
print(jo.pl())
-- Expected output: same value than PlayerPedId()

jo.player.playerId ​

Returns the current player ID.

Example ​

lua
print(jo.player.playerId)
-- OR --
print(jo.pl.playerId)
-- Expected output: same value than PlayerId()

jo.player.serverId ​

Returns the server ID of the player.

Example ​

lua
print(jo.player.serverId)
-- OR --
print(jo.pl.serverId)
-- Expected output: same value than GetPlayerServerId(PlayerId())

JO Functions ​

jo.player.didMoveSinceLastCall() ​

A function to know if the player moved since the last called of the function

Syntax ​

lua
jo.player.didMoveSinceLastCall(id)

Parameters ​

id : string

Unique ID of call

Return Value ​

Type : boolean

true if the player moved since the last call

Example ​

lua
local move = jo.player.didMoveSinceLastCall('moveId')
print(move)
Wait(2000)
move = jo.player.didMoveSinceLastCall('moveId')
print(move)

jo.player.forceUpdate() ​

A function to force the update of module value

Syntax ​

lua
jo.player.forceUpdate()

Example ​

lua
print(jo.pl.coords)
jo.pl.forceUpdate()
print(jo.pl.coords)

jo.player.instanceChanged() ​

A function fired when the local player's routing bucket (instance) changes.
Also fires immediately if the current instance is already known, or requests it
from the server if not — guaranteeing exactly one initial call per registration.

Syntax ​

lua
jo.player.instanceChanged(cb)

Parameters ​

cb : function

function called with (newInstance, oldInstance)


jo.player.move() ​

A function fired when the player move every 100ms

Syntax ​

lua
jo.player.move(cb, interval)

Parameters ​

cb : function

function to fired when the player moves

interval : integer Optional

minimal duration in ms between two executions. Can't be lower than 100ms

Example ​

lua
jo.player.move(function()
  print('MOVE !')
end, 1000)
-- OR --
jo.pl.move(function()
  print('MOVE !')
end, 1000)

Last updated: