From dd4a4a301cba41241bbe805f87d16597c781180f Mon Sep 17 00:00:00 2001 From: Linden <65407488+thelindat@users.noreply.github.com> Date: Sun, 18 Sep 2022 17:10:37 +1000 Subject: [PATCH] ox_core: add player.setdb --- docs/ox_core/Player/Server/methods.md | 54 ++++++++++++++------------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/docs/ox_core/Player/Server/methods.md b/docs/ox_core/Player/Server/methods.md index ca34b868..c6f4f03d 100644 --- a/docs/ox_core/Player/Server/methods.md +++ b/docs/ox_core/Player/Server/methods.md @@ -5,30 +5,11 @@ title: Methods import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -These functions are inherited by instances of CPlayer. - - - - -```lua -local player = Ox.GetPlayer(source) -``` - - - - -```ts -import { GetPlayer } from '@overextended/ox_core/server'; - -const player = GetPlayer(source); -``` - - - +These functions are inherited by instances of [CPlayer](../Server/). ## player.set -Sets the player's metadata for key to the given value. +Update the player's metadata, optionally syncing it with the client. @@ -49,6 +30,29 @@ player.set(key, value); +## player.setdb + +Update the player's metadata and store in the DB, optionally syncing it with the client. + + + + +```lua +local key, value = 'iq', 300 +player.setdb(key, value) +``` + + + + +```ts +const [key, value] = ['iq', 300]; +player.setdb(key, value); +``` + + + + ## player.get Return the player's metadata. Sending an argument will retrieve a specific metadata key. @@ -87,7 +91,7 @@ player.getAccounts() ```ts -player.getAccounts() +player.getAccounts(); ``` @@ -95,20 +99,20 @@ player.getAccounts() ## player.getCoords -Return the player's world position. The value will be cached for future calls, so send true for the first argument to update it. +Return the player's world position. ```lua -local coords = player.getCoords(update) +local coords = player.getCoords() ``` ```ts -const coords = player.getCoords(update); +const coords = player.getCoords(); ```