Player Data

CLIENT SIDE ONLY

Functions

get_data

Use the following to retrieve player data for the client.

// Retrieve all player data
const player_data = exports.boii_core.get_data()

// Accessing player data
const first_name = player_data.identity.first_name

// Retrieve player data by key
const identity = exports.boii_core.get_data('identity')

// Accessing key data
const last_name = identity.last_name

get_item

Use the following to get an item the player has in their inventory by its ID, slot, or metadata.

// Get an item by its id
const item_by_id = exports.boii_core.get_item('water')

// Get an item by its slot 
const item_by_slot = exports.boii_core.get_item(1)

// Get an item by its metadata
const item_by_metadata = exports.boii_core.get_item({ serial: 123456 })

Events

boii:cl:set_data

Use the following to set data to the client instance.

emitNet('boii:cl:set_data', {
    identity: {
        first_name: 'John',
        last_name: 'Doe'
    }
})

This is done automatically when the players server stored data is updated. Isn't really a reason to set data this way unless you want some none persistent data.

Last updated