This documentation is for developers who are making scripts for VORP Core Framework

Exports


These exports are client side only!

Getters

These exports are server side only!

Getters

Setters


Events

Server Side only

Listen to when an item is used

AddEventHandler("vorp_inventory:Server:OnItemUse",function(data)
    local source = data.source
    local itemName = data.item
end)

Listen to when an item is created in player inventory

OnItemCreated
AddEventHandler("vorp_inventory:Server:OnItemCreated",function(data,source)
    -- data.count, data.name, data.metadata
end)

Listen to when an item is removed from player inventory

OnItemRemoved
AddEventHandler("vorp_inventory:Server:OnItemRemoved",function(data,source)
    -- data.count , data.name , no metadata is passed here
end)

Listen for inventory state change (opens or closes) including custom inventories

OnInvStateChange
AddEventHandler("vorp_inventory:Client:OnInvStateChange",function(boolean)
    print(boolean)
end)

Statebags

contains data from the current weapon used in the inventory or last weapon used.

client side
GetEquippedWeaponData
local key = string.format("GetEquippedWeaponData_%d",weaponHash)
local data = LocalPlayer.state[key]
local serial = data.serialNumber
local id = data.weaponId
server side
GetEquippedWeaponData
local key = string.format("GetEquippedWeaponData_%d",weaponHash)
local data = Player(source).state[key]
local serial = data.serialNumber
local id = data.weaponId

check if inventory is active (open or closed) including custom inventories

client side
IsInvActive
LocalPlayer.state.IsInvActive
server side
IsInvActive
Player(source).state.IsInvActive

Global Statebags

returns timestamp from server to be used in client

local timestamp = GlobalState.TimeNow
-- Get hours, minutes and seconds from timestamp
local seconds = GlobalState.TimeNow % 60
local minutes = math.floor(GlobalState.TimeNow / 60) % 60 
local hours = math.floor(GlobalState.TimeNow / 3600) % 24