I updated the repo on github, so please make sure to download the latest one.
This specific code is for ESX. But you can modify it for your framework.
All you have to do is put this code into any server script.
ESX.RegisterUsableItem("item - change it",function(source)
local source = source
local xPlayer = ESX.GetPlayerFromId(source)
xPlayer.removeInventoryItem("item - change it",1)
TriggerEvent("case_opening:server:openCase","caseId - change it",source)
end)
RegisterNetEvent("case_opening:server:getReward",function(reward, playerId)
-- reward is the prizeID, in the example config it's the 15k_cash, 50k_cash etc..
-- playerId is the ID of the player, you can use it to give out the reward
end)
The command part in the video was used for debugging. It’s not in the published code.