mirror of
https://github.com/jimathy/jim_bridge.git
synced 2026-08-17 05:56:02 +01:00
Realised I named the player and item metadata functions too closely and made it confusing, this separates them better
1.0 KiB
1.0 KiB
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
sourceID. - Example:
local player = GetPlayer(playerId)
- Retrieves the player object (as defined by the framework in use) from the given
-
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:
local stress = GetMetadata(player, "stress") print("Player stress level:", stress)
-
setPlayerMetadata(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:
setPlayerMetadata(player, "stress", 0)