Hello everyone! I am sharing you the latest version of pa-crafting completely open-source. In the pack even I included pa-props again OPEN source so y...
Try all with :
RegisterNetEvent('pa-craft:openMenu')
AddEventHandler('pa-craft:openMenu', function(receivedMenuId)
menuId = receivedMenuId
-- This section handles the menu open state directly
menuOpen = true
-- Fetch the weapon item details and open the NUI menu
TriggerCallback('pa-craft:GetWeaponItem', function(callback, Queue)
SendNUIMessage({
type = "open",
weaponAttachment = {},
weapons = callback,
craftItems = PA.CraftItems,
append = true,
Queue = Queue,
folder = PA.InventoryFolder
})
menuOpen = true
SetNuiFocus(true, true)
while menuOpen do
Citizen.Wait(1000)
TriggerCallback('pa-craft:queueUpdate', function(callback)
SendNUIMessage({
type = "queueUpdate",
Queue = callback,
folder = PA.InventoryFolder
})
end, menuId)
end
end)
SetEntityVisible(PlayerPedId(), false)
-- Event listener to handle closing the menu
RegisterNUICallback('closeMenu', function(data, cb)
menuOpen = false
SetNuiFocus(false, false)
SetEntityVisible(PlayerPedId(), true)
cb('ok')
end)
end)
this replaced function it should open the crafting but it wont handle the receivedMenuId, should find out how this can be done so the pa-lib-2 it will not be needed