mirror of
https://github.com/darksaid98/overextended.github.io.git
synced 2026-12-02 22:22:46 +00:00
ox_core: add player.setdb
This commit is contained in:
1 parent
a3f1e8a419
commit
dd4a4a301c
1 file changed
+29
-25
@@ -5,30 +5,11 @@ title: Methods
|
|||||||
import Tabs from '@theme/Tabs';
|
import Tabs from '@theme/Tabs';
|
||||||
import TabItem from '@theme/TabItem';
|
import TabItem from '@theme/TabItem';
|
||||||
|
|
||||||
These functions are inherited by instances of CPlayer.
|
These functions are inherited by instances of [CPlayer](../Server/).
|
||||||
|
|
||||||
<Tabs>
|
|
||||||
<TabItem value='lua' label='Lua'>
|
|
||||||
|
|
||||||
```lua
|
|
||||||
local player = Ox.GetPlayer(source)
|
|
||||||
```
|
|
||||||
|
|
||||||
</TabItem>
|
|
||||||
<TabItem value='js/ts' label='JS/TS'>
|
|
||||||
|
|
||||||
```ts
|
|
||||||
import { GetPlayer } from '@overextended/ox_core/server';
|
|
||||||
|
|
||||||
const player = GetPlayer(source);
|
|
||||||
```
|
|
||||||
|
|
||||||
</TabItem>
|
|
||||||
</Tabs>
|
|
||||||
|
|
||||||
## player.set
|
## player.set
|
||||||
|
|
||||||
Sets the player's metadata for key to the given value.
|
Update the player's metadata, optionally syncing it with the client.
|
||||||
|
|
||||||
<Tabs>
|
<Tabs>
|
||||||
<TabItem value='lua' label='Lua'>
|
<TabItem value='lua' label='Lua'>
|
||||||
@@ -49,6 +30,29 @@ player.set(key, value);
|
|||||||
</TabItem>
|
</TabItem>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
|
||||||
|
## player.setdb
|
||||||
|
|
||||||
|
Update the player's metadata and store in the DB, optionally syncing it with the client.
|
||||||
|
|
||||||
|
<Tabs>
|
||||||
|
<TabItem value='lua' label='Lua'>
|
||||||
|
|
||||||
|
```lua
|
||||||
|
local key, value = 'iq', 300
|
||||||
|
player.setdb(key, value)
|
||||||
|
```
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
<TabItem value='js/ts' label='JS/TS'>
|
||||||
|
|
||||||
|
```ts
|
||||||
|
const [key, value] = ['iq', 300];
|
||||||
|
player.setdb(key, value);
|
||||||
|
```
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
</Tabs>
|
||||||
|
|
||||||
## player.get
|
## player.get
|
||||||
|
|
||||||
Return the player's metadata. Sending an argument will retrieve a specific metadata key.
|
Return the player's metadata. Sending an argument will retrieve a specific metadata key.
|
||||||
@@ -87,7 +91,7 @@ player.getAccounts()
|
|||||||
<TabItem value='js/ts' label='JS/TS'>
|
<TabItem value='js/ts' label='JS/TS'>
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
player.getAccounts()
|
player.getAccounts();
|
||||||
```
|
```
|
||||||
|
|
||||||
</TabItem>
|
</TabItem>
|
||||||
@@ -95,20 +99,20 @@ player.getAccounts()
|
|||||||
|
|
||||||
## player.getCoords
|
## 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.
|
||||||
|
|
||||||
<Tabs>
|
<Tabs>
|
||||||
<TabItem value='lua' label='Lua'>
|
<TabItem value='lua' label='Lua'>
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
local coords = player.getCoords(update)
|
local coords = player.getCoords()
|
||||||
```
|
```
|
||||||
|
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem value='js/ts' label='JS/TS'>
|
<TabItem value='js/ts' label='JS/TS'>
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
const coords = player.getCoords(update);
|
const coords = player.getCoords();
|
||||||
```
|
```
|
||||||
|
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
|||||||
Reference in new issue
Block a user