morais5 / MS-Framework

Base MS-Framework (QBus) for FiveM 💖
GNU General Public License v3.0
51 stars 56 forks source link

qb-simcard #21

Closed Zy0exe closed 3 years ago

Zy0exe commented 3 years ago

Item doesn't get out of the inventory after being used.


RegisterNetEvent('ZyoCore-simcard:startNumChange')
AddEventHandler('ZyoCore-simcard:startNumChange', function(newNum)

    ZyoCore.Functions.Progressbar("number_change", "Changin num...", 5000, false, true, {
        disableMovement = false,
        disableCarMovement = false,
        disableMouse = false,
        disableCombat = true,
    }, {
        animDict = "anim@amb@business@bgen@bgen_no_work@",
        anim = "sit_phone_idle_01_nowork" ,
        flags = 16,
    }, {}, {}, function() -- Done
        StopAnimTask(GetPlayerPed(-1), "anim@amb@business@bgen@bgen_no_work@", "sit_phone_idle_01_nowork", 1.0)
        ZyoCore.Functions.Notify("Phone number updated to " .. newNum)
        TriggerServerEvent('ZyoCore-simcard:changeNumber', newNum)        
    end, function() -- Cancel
        StopAnimTask(GetPlayerPed(-1), "anim@amb@business@bgen@bgen_no_work@", "sit_phone_idle_01_nowork", 1.0)
        ZyoCore.Functions.Notify("Failed!", "error")
    end)
        TriggerServerEvent("ZyoCore:Server:RemoveItem", "sim_card", 1)
        TriggerEvent('inventory:client:ItemBox', ZyoCore.Shared.Items["sim_card"], "remove")
end)

Should be all set.

morais5 commented 3 years ago

Thanks man for your time!

https://github.com/morais5/QBCore-Morais/blob/ae01b1de6a035885b0b26f45c80f4b5a4d28dd50/server-data/resources/%5Bqb%5D/qb-inventory/client/main.lua#L682