Project-Sloth / ps-weedplanting

Project Sloth Weed Script
https://www.discord.gg/projectsloth
GNU General Public License v3.0
51 stars 43 forks source link

sv_processing.lua > ProcessBranch Event #13

Closed GitMocha closed 1 year ago

GitMocha commented 1 year ago

Installed this script, added sql, allows you to plant, maintain and harvest. When u try to "ProcessBranch" it does the animation but doesn't do anything else. No errors thrown in console/f8.

I'm gonna go on a limb and assume it's this part 'item.info.health'. I don't see where it's grabbing info.health anywhere. Maybe blind but i don't think there is. This is the only thing i see that could cause this.

GitMocha commented 1 year ago

After removing 'item.info.health' and just giving it a random number to give it processes.

RegisterNetEvent('ps-weedplanting:server:ProcessBranch', function()
    local src = source
    local Player = QBCore.Functions.GetPlayer(src)
    if not Player then return end
    local item = Player.Functions.GetItemByName(Shared.BranchItem)
    if item then
        if Player.Functions.RemoveItem(Shared.BranchItem, 1, item.slot) then
            TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items[Shared.BranchItem], 'remove', 1)
            Player.Functions.AddItem(Shared.WeedItem, 2, false)
            TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items[Shared.WeedItem], 'add', 2)
        end
    end
end)
MonkeyWhisper commented 1 year ago

Send a PR for this, thanks

GitMocha commented 1 year ago

Sure thing

MonkeyWhisper commented 1 year ago

https://github.com/Project-Sloth/ps-weedplanting/pull/14