47 lines
		
	
	
	
		
			1.2 KiB
		
	
	
	
		
			Lua
		
	
	
	
	
	
			
		
		
	
	
			47 lines
		
	
	
	
		
			1.2 KiB
		
	
	
	
		
			Lua
		
	
	
	
	
	
if GetResourceState('qb-core') ~= 'started' then return end
 | 
						|
 | 
						|
QBCore = exports['qb-core']:GetCoreObject()
 | 
						|
 | 
						|
function ShowNotification(text)
 | 
						|
	QBCore.Functions.Notify(text)
 | 
						|
end
 | 
						|
 | 
						|
function GetPlayersInArea(coords, radius)
 | 
						|
    local coords = coords or GetEntityCoords(PlayerPedId())
 | 
						|
    local radius = radius or 3.0
 | 
						|
    local list = QBCore.Functions.GetPlayersFromCoords(coords, radius)
 | 
						|
    local players = {}
 | 
						|
    for _, player in pairs(list) do 
 | 
						|
        if player ~= PlayerId() then
 | 
						|
            players[#players + 1] = player
 | 
						|
        end
 | 
						|
    end
 | 
						|
    return players
 | 
						|
end
 | 
						|
 | 
						|
RegisterNetEvent(GetCurrentResourceName()..":showNotification", function(text)
 | 
						|
    ShowNotification(text)
 | 
						|
end)
 | 
						|
 | 
						|
RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function()
 | 
						|
    TriggerServerEvent("pickle_consumables:initializePlayer")
 | 
						|
end)
 | 
						|
 | 
						|
-- Inventory Fallback
 | 
						|
 | 
						|
CreateThread(function()
 | 
						|
    Wait(100)
 | 
						|
    
 | 
						|
    if InitializeInventory then return InitializeInventory() end -- Already loaded through inventory folder.
 | 
						|
 | 
						|
    Inventory = {}
 | 
						|
 | 
						|
    Inventory.Items = {}
 | 
						|
    
 | 
						|
    Inventory.Ready = false
 | 
						|
    
 | 
						|
    RegisterNetEvent("pickle_consumables:setupInventory", function(data)
 | 
						|
        Inventory.Items = data.items
 | 
						|
        Inventory.Ready = true
 | 
						|
    end)
 | 
						|
end)
 |