mirror of
https://github.com/jimathy/jim_bridge.git
synced 2026-08-19 06:46:04 +01:00
better documentation layout
- seperated the 2000+ lines in ReadMe.md into seperate files. - useful if things expand - better readability for users - more organised layout
This commit is contained in:
32
documentation/main_functions/metahandlers.md
Normal file
32
documentation/main_functions/metahandlers.md
Normal file
@@ -0,0 +1,32 @@
|
||||
### metaHandlers.lua
|
||||
|
||||
This module provides access and control over player metadata, which is useful for storing temporary or persistent player-specific values like stats, states, or tags.
|
||||
|
||||
- **GetPlayer(source)**
|
||||
|
||||
⚠️ Server side only
|
||||
- Retrieves the player object (as defined by the framework in use) from the given `source` ID.
|
||||
- **Example:**
|
||||
```lua
|
||||
local player = GetPlayer(playerId)
|
||||
```
|
||||
|
||||
- **GetMetadata(player, key)**
|
||||
|
||||
- Retrieves the value of a metadata field from the given player.
|
||||
- If called client-side (player is nil), it triggers a server callback to retrieve metadata.
|
||||
- **Example:**
|
||||
```lua
|
||||
local stress = GetMetadata(player, "stress")
|
||||
print("Player stress level:", stress)
|
||||
```
|
||||
|
||||
- **SetMetadata(player, key, value)**
|
||||
|
||||
⚠️ Server side only
|
||||
- Updates or assigns a value to a specific metadata key for a player.
|
||||
- The function updates the player's metadata using the active core export.
|
||||
- **Example:**
|
||||
```lua
|
||||
SetMetadata(player, "stress", 0)
|
||||
```
|
||||
Reference in New Issue
Block a user