Documentation
TebexDiscordYouTubeGitHub
  • Introduction
  • FIVEM FREE RESOURCES
    • BDSC
      • Guides
        • Core Setup
          • Installing BDSC
          • Configuring BDSC
        • Plugin Development
          • What is a Plugin?
          • Plugin Structure
          • Extending Player Objects
      • API
        • Functions
          • Player
          • Server
          • Client
          • Shared
        • Modules
          • Player Manager
          • Buckets
          • Plugins
        • UI Components
    • boii_utils
      • Installation
      • Configuration
      • Modules
      • API
        • Callbacks
        • Characters
        • Commands
        • Cooldowns
        • Debugging
        • Entities
        • Environment
        • Framework Bridge
        • Geometry
        • Items
        • Keys
        • Licences
        • Maths
        • Methods
        • Player
        • Requests
        • Strings
        • Tables
        • Timestamps
        • UI Bridges
        • Vehicles
        • Version
        • XP
        • UI Elements
  • FIVEM PAID RESOURCES
    • Page 2
Powered by GitBook
On this page
  • has_loaded
  • dump_data
  • has_data
  • get_data
  • add_data
  • set_data
  • remove_data
  • sync_data
  • has_method
  • get_method
  • add_method
  • remove_method
  • has_extension
  • get_extension
  • add_extension
  • list_extensions
  • save
  • unload
  • load
  1. FIVEM FREE RESOURCES
  2. BDSC
  3. API
  4. Functions

Player

Technical reference only.

See the Guides for usage examples and system flow.


has_loaded

Returns whether the player has completed loading.

player:has_loaded()

Returns

  • boolean: True if player has fully loaded.


dump_data

Logs all player data to the console using debug_log.

player:dump_data()

has_data

Check if the player contains a data category.

player:has_data("player")

Parameters

  • category (string): The data category name.

Returns

  • boolean: True if data exists.


get_data

Get a single category or all data.

player:get_data("player")
player:get_data()

Parameters

  • category (string|nil): Optional category to get.

Returns

  • table|nil: The requested data or all player data.


add_data

Adds a data table to the player object.

player:add_data("accounts", data_table, true)

Parameters

  • category (string): Category name.

  • value (table): Data to store.

  • replicated (boolean|nil): Whether to sync to client.


set_data

Merge changes into a category.

player:set_data("settings", { some_value = true }, true)

Parameters

  • category (string): Category name.

  • updates (table): Table of changes.

  • sync (boolean|nil): Sync to client.

Returns

  • boolean: True on success.


remove_data

Removes and syncs a data category.

player:remove_data("accounts")

Parameters

  • category (string): Category to remove.


sync_data

Sync one or all replicated categories to client.

player:sync_data("settings") -- single category
player:sync_data() -- all data

Parameters

  • category (string|nil): Category to sync, or all.


has_method

Check if a method exists.

player:has_method("kick")

Parameters

  • name (string): Method name.

Returns

  • boolean: True if found.


get_method

Return a method reference.

local fn = player:get_method("kick")

Parameters

  • name (string): Method name.

Returns

  • function|nil: Function if found.


add_method

Attach a method directly to a player instance.

player:add_method("test", function(self) print(self:get_data("player").username) end)

Parameters

  • name (string): Method name.

  • fn (function): Function reference.


remove_method

Remove a dynamic method.

player:remove_method("test")

Parameters

  • name (string): Method name.


has_extension

Check if the extension exists.

player:has_extension("accounts")

Parameters

  • name (string): Extension name.

Returns

  • boolean: True if present.


get_extension

Get the extension table.

local ext = player:get_extension("accounts")

Parameters

  • name (string): Extension name.

Returns

  • table|nil: The extension object.


add_extension

Attach an extension object.

player:add_extension("accounts", AccountModule.new(player))

Parameters

  • name (string): Extension key.

  • obj (table): Object to attach.


list_extensions

Get a list of all extension keys.

local all = player:list_extensions()

Returns

  • string[]: List of extension keys.


save

Triggers save_player() on all extensions.

player:save()

unload

Triggers unload_player() on all extensions.

player:unload()

load

Attempts to load the main player from the database and calls load_player() on extensions.

local success = player:load()

Returns

  • boolean: True if successfully loaded.

Last updated 1 day ago