From the reference libraryRedM

Player <BadgeClient/>

jo_libs/modules/player/client.md

Player <BadgeClient/>

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

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

JO Variables > jo.player.isMale

Returns if the current player is a male or not.

Example

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

JO Variables > jo.player.ped

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

Example

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

JO Variables > jo.player.playerId

Returns the current player ID.

Example

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

JO Variables > jo.player.serverId

Returns the server ID of the player.

Example

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

JO Functions > jo.player.didMoveSinceLastCall()

<!-- @include: ./slots/headers.md#client|jo.player.didMoveSinceLastCall -->

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

<!-- @include: ./slots/descriptions.md#client|jo.player.didMoveSinceLastCall -->

JO Functions > jo.player.didMoveSinceLastCall() > Syntax

jo.player.didMoveSinceLastCall(id)

JO Functions > jo.player.didMoveSinceLastCall() > Parameters

id : string

Unique ID of call

JO Functions > jo.player.didMoveSinceLastCall() > Return Value

Type : boolean

true if the player moved since the last call

<!-- @include: ./slots/examples.md#client|jo.player.didMoveSinceLastCall -->

<!-- @include: ./slots/footers.md#client|jo.player.didMoveSinceLastCall -->


JO Functions > jo.player.forceUpdate()

<!-- @include: ./slots/headers.md#client|jo.player.forceUpdate -->

A function to force the update of module value <br>

<!-- @include: ./slots/descriptions.md#client|jo.player.forceUpdate -->

JO Functions > jo.player.forceUpdate() > Syntax

jo.player.forceUpdate()

<!-- @include: ./slots/examples.md#client|jo.player.forceUpdate -->

<!-- @include: ./slots/footers.md#client|jo.player.forceUpdate -->


JO Functions > jo.player.move()

<!-- @include: ./slots/headers.md#client|jo.player.move -->

A function fired when the player move every 100ms <br>

<!-- @include: ./slots/descriptions.md#client|jo.player.move -->

JO Functions > jo.player.move() > Syntax

jo.player.move(cb, interval)

JO Functions > jo.player.move() > Parameters

cb : function

function to fired when the player moves

interval : integer <BadgeOptional />

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

<!-- @include: ./slots/examples.md#client|jo.player.move -->

<!-- @include: ./slots/footers.md#client|jo.player.move -->

JO Functions > jo.player.instanceChanged()

<!-- @include: ./slots/headers.md#client|jo.player.instanceChanged -->

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

<!-- @include: ./slots/descriptions.md#client|jo.player.instanceChanged -->

JO Functions > jo.player.instanceChanged() > Syntax

jo.player.instanceChanged(cb)

JO Functions > jo.player.instanceChanged() > Parameters

cb : function

function called with (newInstance, oldInstance)

<!-- @include: ./slots/examples.md#client|jo.player.instanceChanged -->

<!-- @include: ./slots/footers.md#client|jo.player.instanceChanged -->


Back to documentation