diff --git a/README.md b/README.md index 1e0e345..3d2cfd1 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,11 @@ # esx-lumberjack -LumberJack Script for QBCore - Converted to ESX by Mycroft (Manager of ESX-Framework) +LumberJack Script for QBCore - Converted to ESX by Mycroft (Manager of ESX-Framework) - Updated to ox_lib and ox_inventory and new esx-legacy by: Gojan#1450 ## Discord - [Join Discord](https://discord.esx-framework.org/) -## Donate - -- [trclassic Ko-fi Link](https://ko-fi.com/trclassic) -- [ESX-Framework Ko-fi Link](https://ko-fi.com/esxframework) - ## Original Script - [tr-lumberjack](https://github.com/trclassic92/tr-lumberjack) @@ -27,14 +22,12 @@ LumberJack Script for QBCore - Converted to ESX by Mycroft (Manager of ESX-Frame - [esx-legacy](https://docs.esx-framework.org) - [qtarget](https://github.com/overextended/qtarget/releases) - [PolyZone](https://github.com/mkafrin/PolyZone) -- [mythic_progbar](https://github.com/HalCroves/mythic_progbar) +- [ox_lib](https://github.com/overextended/ox_lib/releases) ## Preview Pictures -- [Youtube Video](https://youtu.be/DpmRvZUhPAo) -![Preview Screenshot](https://i.imgur.com/5ZC9RNo.jpeg) -![Preview Screenshot](https://i.imgur.com/2D3lOfG.png) -![Preview Screenshot](https://i.imgur.com/TghLZWz.jpeg) -![Preview Screenshot](https://i.imgur.com/vtHS9iP.jpeg) -![Preview Screenshot](https://i.imgur.com/tIWGi16.jpeg) -![Preview Screenshot](https://i.imgur.com/I3oQ5wi.jpeg) +![Preview Screenshot](https://i.imgur.com/aqY8o9E.png) +![Preview Screenshot](https://i.imgur.com/6SHy1q5.png) +![Preview Screenshot](https://i.imgur.com/qaO7Nih.png) +![Preview Screenshot](https://i.imgur.com/NxSij99.png) +![Preview Screenshot](https://i.imgur.com/KTSWeCt.png) \ No newline at end of file diff --git a/client/main.lua b/client/main.lua index c41719c..fa99470 100644 --- a/client/main.lua +++ b/client/main.lua @@ -24,7 +24,15 @@ local function axe() end end - ESX.ShowNotification(Config.Alerts["error_axe"]) + if Config.NotificationType == "ESX" then + ESX.ShowNotification(Config.Alerts["error_axe"], "error", 3000) + elseif Config.NotificationType == "ox_lib" then + lib.notify({ + description = Config.Alerts["error_axe"], + type = "error", + duration = 3000, + }) + end end local function ChopLumber(k) @@ -33,56 +41,37 @@ local function ChopLumber(k) local trClassic = PlayerPedId() local choptime = LumberJob.ChoppingTreeTimer chopping = true - FreezeEntityPosition(trClassic, true) - TriggerEvent("mythic_progbar:client:progress", { - name = "Chopping_Tree", + + local success = lib.progressBar({ duration = choptime, label = Config.Alerts["chopping_tree"], useWhileDead = false, canCancel = true, - controlDisables = { - disableMovement = true, - disableCarMovement = true, - disableMouse = false, - disableCombat = true, + disable = { + car = true, + move = true, + mouse = false, + combat = true }, - animation = {}}, function(status) - if not status then - TriggerServerEvent('esx-lumberjack:setLumberStage', "isChopped", true, k) - TriggerServerEvent('esx-lumberjack:setLumberStage', "isOccupied", false, k) - TriggerServerEvent('esx-lumberjack:recivelumber') - TriggerServerEvent('esx-lumberjack:setChoppedTimer') - chopping = false - TaskPlayAnim(trClassic, animDict, "exit", 3.0, 3.0, -1, 2, 0, 0, 0, 0) - FreezeEntityPosition(trClassic, false) - else - ClearPedTasks(trClassic) - TriggerServerEvent('esx-lumberjack:setLumberStage', "isOccupied", false, k) - chopping = false - TaskPlayAnim(trClassic, animDict, "exit", 3.0, 3.0, -1, 2, 0, 0, 0, 0) - FreezeEntityPosition(trClassic, false) - end - end) - -- QBCore.Functions.Progressbar("Chopping_Tree", Config.Alerts["chopping_tree"], choptime, false, true, { - -- disableMovement = true, - -- disableCarMovement = true, - -- disableMouse = false, - -- disableCombat = true, - -- }, {}, {}, {}, function() - -- TriggerServerEvent('esx-lumberjack:setLumberStage', "isChopped", true, k) - -- TriggerServerEvent('esx-lumberjack:setLumberStage', "isOccupied", false, k) - -- TriggerServerEvent('esx-lumberjack:recivelumber') - -- TriggerServerEvent('esx-lumberjack:setChoppedTimer') - -- chopping = false - -- TaskPlayAnim(trClassic, animDict, "exit", 3.0, 3.0, -1, 2, 0, 0, 0, 0) - -- FreezeEntityPosition(trClassic, false) - -- end, function() - -- ClearPedTasks(trClassic) - -- TriggerServerEvent('esx-lumberjack:setLumberStage', "isOccupied", false, k) - -- chopping = false - -- TaskPlayAnim(trClassic, animDict, "exit", 3.0, 3.0, -1, 2, 0, 0, 0, 0) - -- FreezeEntityPosition(trClassic, false) - -- end) + anim = { + dict = 'melee@hatchet@streamed_core', + clip = 'plyr_rear_takedown_b' + }, + }) + + if success then + TriggerServerEvent('esx-lumberjack:setLumberStage', "isChopped", true, k) + TriggerServerEvent('esx-lumberjack:setLumberStage', "isOccupied", false, k) + TriggerServerEvent('esx-lumberjack:recivelumber') + TriggerServerEvent('esx-lumberjack:setChoppedTimer') + chopping = false + return true + else + ClearPedTasks(trClassic) + TriggerServerEvent('esx-lumberjack:setLumberStage', "isOccupied", false, k) + chopping = false + return false + end TriggerServerEvent('esx-lumberjack:setLumberStage', "isOccupied", true, k) CreateThread(function() while chopping do @@ -145,12 +134,12 @@ if Config.Job then maxZ = LumberDepo.maxZ, }, { options = { - { - event = "esx-lumberjack:bossmenu", - icon = "Fas Fa-hands", - label = Config.Alerts["depo_label"], - job = "lumberjack", - }, + { + event = "esx-lumberjack:bossmenu", + icon = "Fas Fa-hands", + label = Config.Alerts["depo_label"], + job = "lumberjack", + }, }, distance = 1.0 }) @@ -162,12 +151,12 @@ if Config.Job then maxZ = LumberProcessor.maxZ, }, { options = { - { - event = "esx-lumberjack:processormenu", - icon = "Fas Fa-hands", - label = Config.Alerts["mill_label"], - job = "lumberjack", - }, + { + event = "esx-lumberjack:processormenu", + icon = "Fas Fa-hands", + label = Config.Alerts["mill_label"], + job = "lumberjack", + }, }, distance = 1.0 }) @@ -179,13 +168,13 @@ if Config.Job then maxZ = LumberSeller.maxZ, }, { options = { - { - type = "server", - event = "esx-lumberjack:sellItems", - icon = "fa fa-usd", - label = Config.Alerts["Lumber_Seller"], - job = "lumberjack", - }, + { + type = "server", + event = "esx-lumberjack:sellItems", + icon = "fa fa-usd", + label = Config.Alerts["Lumber_Seller"], + job = "lumberjack", + }, }, distance = 1.0 }) @@ -296,7 +285,15 @@ RegisterNetEvent('esx-lumberjack:vehicle', function() TaskWarpPedIntoVehicle(TR, JobVehicle, -1) DoScreenFadeIn(1500) else - ESX.ShowNotification(Config.Alerts["depo_blocked"], "error") + if Config.NotificationType == "ESX" then + ESX.ShowNotification(Config.Alerts["depo_blocked"], "error", 3000) + elseif Config.NotificationType == "ox_lib" then + lib.notify({ + description = Config.Alerts["depo_blocked"], + type = "error", + duration = 3000, + }) + end end end) @@ -305,7 +302,15 @@ RegisterNetEvent('esx-lumberjack:removevehicle', function() local vehicle = GetVehiclePedIsIn(TR92,true) SetEntityAsMissionEntity(TR92,true) DeleteVehicle(vehicle) - ESX.ShowNotification(Config.Alerts["depo_stored"]) + if Config.NotificationType == "ESX" then + ESX.ShowNotification(Config.Alerts["depo_stored"], "success", 3000) + elseif Config.NotificationType == "ox_lib" then + lib.notify({ + description = Config.Alerts["depo_stored"], + type = "success", + duration = 3000, + }) + end end) RegisterNetEvent('esx-lumberjack:getaxe', function() @@ -313,105 +318,131 @@ RegisterNetEvent('esx-lumberjack:getaxe', function() end) RegisterNetEvent('esx-lumberjack:bossmenu', function() - ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'boss_menu', { - title = Config.Alerts["vehicle_header"], - align = 'top-left', - elements = { - {label = Config.Alerts["vehicle_text"], event = 'esx-lumberjack:vehicle'}, - {label = Config.Alerts["remove_text"], event = 'esx-lumberjack:removevehicle'}, - {label = Config.Alerts["battleaxe_text"], event = 'esx-lumberjack:getaxe'}, - }}, function(data, menu) - TriggerEvent(data.current.event) - menu.close() - end, function(data, menu) - menu.close() - end) + if Config.UseOxLib then + print('kokot') + lib.registerContext({ + id = 'esx-lumberjack:bossmenu', + title = Config.Alerts["vehicle_header"], + options = { + { + title = Config.Alerts["vehicle_text"], + event = 'esx-lumberjack:vehicle', + }, + { + title = Config.Alerts["remove_text"], + event = 'esx-lumberjack:removevehicle', + }, + { + title = Config.Alerts["battleaxe_text"], + event = 'esx-lumberjack:getaxe', + }, + }, + }) + lib.showContext('esx-lumberjack:bossmenu') + elseif not Config.UseOxLib then + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'boss_menu', { + title = Config.Alerts["vehicle_header"], + align = 'top-left', + elements = { + {label = Config.Alerts["vehicle_text"], event = 'esx-lumberjack:vehicle'}, + {label = Config.Alerts["remove_text"], event = 'esx-lumberjack:removevehicle'}, + {label = Config.Alerts["battleaxe_text"], event = 'esx-lumberjack:getaxe'}, + }}, function(data, menu) + TriggerEvent(data.current.event) + menu.close() + end, function(data, menu) + menu.close() + end) + end end) RegisterNetEvent('esx-lumberjack:processormenu', function() - ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'boss_menu', { - title = Config.Alerts["lumber_mill"], - align = 'top-left', - elements = { - {label = Config.Alerts["lumber_text"], event = 'esx-lumberjack:processor'}, - {label = Config.Alerts["remove_text"], event = 'esx-lumberjack:removevehicle'}, - {label = Config.Alerts["battleaxe_text"], event = 'esx-lumberjack:getaxe'}, - }}, function(data, menu) - TriggerEvent(data.current.event) - menu.close() - end, function(data, menu) - menu.close() - end) + if Config.UseOxLib then + print('Server using Ox Lib') + lib.registerContext({ + id = 'esx-lumberjack:processormenu', + title = Config.Alerts["lumber_mill"], + options = { + { + title = Config.Alerts["lumber_text"], + event = 'esx-lumberjack:processor', + description = Config.Alerts["lumber_text_description"], + metadata = {Config.Alerts["lumber_text_description_meta_data"]}, + }, + { + title = Config.Alerts["remove_text"], + event = 'esx-lumberjack:removevehicle' + }, + { + title = Config.Alerts["battleaxe_text"], + event = 'esx-lumberjack:getaxe' + }, + }, + }) + lib.showContext('esx-lumberjack:processormenu') + elseif not Config.UseOxLib then + print('Server not using Ox Lib') + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'boss_menu', { + title = Config.Alerts["lumber_mill"], + align = 'top-left', + elements = { + {label = Config.Alerts["lumber_text"], event = 'esx-lumberjack:processor'}, + {label = Config.Alerts["remove_text"], event = 'esx-lumberjack:removevehicle'}, + {label = Config.Alerts["battleaxe_text"], event = 'esx-lumberjack:getaxe'}, + }}, function(data, menu) + TriggerEvent(data.current.event) + menu.close() + end, function(data, menu) + menu.close() + end) + end end) RegisterNetEvent('esx-lumberjack:processor', function() ESX.TriggerServerCallback('esx-lumberjack:lumber', function(lumber) - if lumber then - --[[ - TriggerEvent("mythic_progbar:client:progress", { - name = "unique_action_name", - duration = 10000, - label = "Action Label", - useWhileDead = false, - canCancel = true, - controlDisables = { - disableMovement = true, - disableCarMovement = true, - disableMouse = false, - disableCombat = true, - }, - animation = { - animDict = "missheistdockssetup1clipboard@idle_a", - anim = "idle_a", - }, - prop = { - model = "prop_paper_bag_small", - } - }, function(status) - if not status then - -- Do Something If Event Wasn't Cancelled - end - end) - ]] - TriggerEvent("mythic_progbar:client:progress", { - name = "lumber_trader", - duration = LumberJob.ProcessingTime, - label = Config.Alerts['lumber_progressbar'], - useWhileDead = false, - canCancel = true, - controlDisables = { - disableMovement = true, - disableCarMovement = true, - disableMouse = false, - disableCombat = true, - }, - animation = { - animDict = "missheistdockssetup1clipboard@idle_a", - anim = "idle_a", - }, - prop = { - model = "prop_paper_bag_small", - } - }, function(status) - if not status then + if lumber then + local success = lib.progressBar({ + duration = LumberJob.ProcessingTime, + label = Config.Alerts['lumber_progressbar'], + useWhileDead = false, + canCancel = true, + disable = { + car = true, + move = true, + mouse = false, + combat = true + }, + anim = { + dict = 'missheistdockssetup1clipboard@idle_a', + clip = 'idle_a' + }, + }) + + if success then TriggerServerEvent("esx-lumberjack:lumberprocessed") - else - ESX.ShowNotification(Config.Alerts['cancel']) + return true + else + if Config.NotificationType == "ESX" then + ESX.ShowNotification(Config.Alerts['cancel'], "error", 3000) + elseif Config.NotificationType == "ox_lib" then + lib.notify({ + description = Config.Alerts['cancel'], + type = "error", + duration = 3000, + }) + end + return false end - end) - -- QBCore.Functions.Progressbar('lumber_trader', Config.Alerts['lumber_progressbar'], LumberJob.ProcessingTime , false, true, { - -- disableMovement = true, - -- disableCarMovement = true, - -- disableMouse = false, - -- disableCombat = true, - -- }, {}, {}, {}, function() - -- TriggerEvent('animations:client:EmoteCommandStart', {"c"}) - -- TriggerServerEvent("esx-lumberjack:lumberprocessed") - -- end, function() - -- ESX.ShowNotification(Config.Alerts['cancel']) - -- end) - else - ESX.ShowNotification(Config.Alerts['error_lumber']) - end + else + if Config.NotificationType == "ESX" then + ESX.ShowNotification(Config.Alerts['error_lumber'], "error", 3000) + elseif Config.NotificationType == "ox_lib" then + lib.notify({ + description = Config.Alerts['error_lumber'], + type = "error", + duration = 3000, + }) + end + end end) - end) +end) diff --git a/config.lua b/config.lua index 11de82b..7acd66d 100644 --- a/config.lua +++ b/config.lua @@ -1,7 +1,12 @@ Config = Config or {} -Config.Job = true -- False = Job is not required / True = Job is required -Config.UseBlips = true -- True / false option for toggling farm blips -Config.Timeout = 20 * (60 * 1000) -- 20 minutes +Config.Job = true -- False = Job is not required / True = Job is required +Config.UseBlips = true -- True / false option for toggling farm blips +Config.Timeout = 20 * (60 * 1000) -- 20 minutes + +-- Setting of libary +Config.NotificationType = "ESX" -- ESX, ox_lib +Config.UseOxLib = true -- If you use Over Extendet Lib then you change it to true from false +Config.UseOxInventory = true -- if you user ox inventory then you change it to true from false Config.FuelSystem = function(vehicle, level) -- exports['LegacyFuel']:SetFuel(vehicle, level) @@ -10,18 +15,18 @@ end -- Blips Config.Blips = { LumberDepo = { - targetZone = vector3(1167.73, -1347.27, 33.92), -- qb-target vector - targetHeading = 273.47, -- qb-target box zone - coords = vector4(1167.73, -1347.27, 33.92, 273.47), -- Move Location (Ped and blip) - SetBlipSprite = 85, -- Blip Icon (https://docs.fivem.net/docs/game-references/blips/) - SetBlipDisplay = 6, -- Blip Behavior (https://docs.fivem.net/natives/?_0x9029B2F3DA924928) - SetBlipScale = 0.8, -- Blip Size - SetBlipColour = 5, -- Blip Color - BlipLabel = "Lumber Depo", -- Blip Label - minZ = 31.92, -- Max Z - maxZ = 35.92, -- Max Z - Vehicle = 'tiptruck', -- Job Vehicle - VehicleCoords = vector4(1162.27, -1318.55, 34.74, 173.91), -- Job Vehcile Coords + targetZone = vector3(1167.73, -1347.27, 33.92), -- qb-target vector + targetHeading = 273.47, -- qb-target box zone + coords = vector4(1167.73, -1347.27, 33.92, 273.47), -- Move Location (Ped and blip) + SetBlipSprite = 85, -- Blip Icon (https://docs.fivem.net/docs/game-references/blips/) + SetBlipDisplay = 6, -- Blip Behavior (https://docs.fivem.net/natives/?_0x9029B2F3DA924928) + SetBlipScale = 0.8, -- Blip Size + SetBlipColour = 5, -- Blip Color + BlipLabel = "Lumber Depo", -- Blip Label + minZ = 31.92, -- Max Z + maxZ = 35.92, -- Max Z + Vehicle = 'tiptruck', -- Job Vehicle + VehicleCoords = vector4(1162.27, -1318.55, 34.74, 173.91), -- Job Vehcile Coords }, LumberProcessor = { targetZone = vector3(-517.13, 5331.54, 79.26), @@ -257,42 +262,32 @@ Config.Alerts = { lumber_processed_trade = 'You successfully traded ', lumber_processed_lumberamount = ' Amount of Lumber for ', lumber_processed_received = ' Piles of wooden panks', - error_sold = 'You dont have the items to sell here!', - successfully_sold = 'You have sold your items', - no_item = "You dont have anything to sell", - - axe_check = 'You already have a axe', - axe_bought = 'You have bought a axe from the boss for $' ..LumberJob.AxePrice, - - phone_sender = 'Lumber Mill Supervisor', - phone_subject = 'Job task', + error_sold = 'You have no items for sale here!', + successfully_sold = 'You selled a items', + no_item = "You do not have any items from the required items", + axe_check = 'You already have Axe', + axe_bought = 'You just bought an axe for ' ..LumberJob.AxePrice..' $', + phone_sender = 'Administrator of Lumber Factory', + phone_subject = 'Work tasks', phone_message = 'You have been tasked to gather lumber near the paleto bay lumber mill. Once you have finished gathering lumber speak to the mill boss to process the lumber.', - - chopping_tree = 'Chopping Tree', - - Tree_label = 'Start Chopping', + chopping_tree = 'Chopping tree', + Tree_label = 'Start chop down a tree', depo_label = 'Talk to boss', - mill_label = 'Talk to mill boss', - - depo_blocked = 'Vehicle blocking depo', - depo_stored = 'Job Vehicle Stored', - - vehicle_header = 'Lumber Jack Vehicles', - vehicle_get = 'Logger Vehicle', - vehicle_text = 'Job Vehicle', - - battleaxe_label = 'Lumber Axe', - battleaxe_text = 'Axe used for chopping down trees', - - vehicle_remove = 'Remove Vehicle', - remove_text = 'Remove Job Vehicle', - - lumber_mill = 'Lumber Mill', + mill_label = 'Process wood', + depo_blocked = 'Some car blocked a depo', + depo_stored = 'Vehicle was stored', + vehicle_header = '🚛 Lumber Vehicle', + vehicle_get = '🚘 Logger Vehicle', + vehicle_text = '🚘 Vehicle', + battleaxe_label = '🪓 Wooden Axe', + battleaxe_text = '💵 Buy wooden axe', + vehicle_remove = '🗑 Delete vehicle', + remove_text = '🗑 Delete vehicle', + lumber_mill = 'Process of wooden', lumber_header = 'Process Lumber', - lumber_text = 'Trade for wooden planks', - - Lumber_Seller = 'Sell Lumber', - + lumber_text = '🐻 Process on wooden plank', + lumber_text_description = 'Read a description !!! ➡', + lumber_text_description_meta_data = 'You need at least 1x Storm Bark and 1x Tree Lumber', + Lumber_Seller = 'Seller', goback = '< Go Back', - -} +} \ No newline at end of file diff --git a/fxmanifest.lua b/fxmanifest.lua index 45ae0c6..4acf9cc 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -1,9 +1,9 @@ fx_version 'cerulean' game 'gta5' -author 'TRClassic#0001, Mycroft, Benzo' -description 'LumberJack Job For QB-Core, Converted to ESX' -version '2.0.2' +author 'TRClassic#0001, Mycroft, Benzo, Gojan#1450' +description 'LumberJack Job For QB-Core, Converted to ESX, Updated for ox_inventory/ox_lib/esx-legacy' +version '2.1.0' client_scripts { '@PolyZone/client.lua', @@ -12,13 +12,18 @@ client_scripts { 'client/*.lua' } -server_scripts {'server/*.lua'} +server_scripts { + 'server/*.lua', +} + +shared_scripts { + '@ox_lib/init.lua', + 'config.lua', + '@es_extended/imports.lua' +} -shared_scripts {'@es_extended/imports.lua','config.lua'} +lua54 'yes' dependencies { - 'PolyZone', - 'mythic_progbar', - 'es_extended', - 'qtarget' + 'ox_lib', } \ No newline at end of file diff --git a/server/server.lua b/server/server.lua index 12cdec5..3cee33b 100644 --- a/server/server.lua +++ b/server/server.lua @@ -13,9 +13,17 @@ RegisterNetEvent('esx-lumberjack:sellItems', function() end if price > 0 then xPlayer.addMoney(price) - xPlayer.showNotification(Config.Alerts["successfully_sold"], true, false, 140) + if Config.NotificationType == "ESX" then + TriggerClientEvent('esx:showNotification', source, Config.Alerts["successfully_sold"], "success") + elseif Config.NotificationType == "ox_lib" then + TriggerClientEvent('ox_lib:notify', source, { type = 'success', description = Config.Alerts["successfully_sold"] }) + end else - xPlayer.showNotification(Config.Alerts["no_item"]) + if Config.NotificationType == "ESX" then + TriggerClientEvent('esx:showNotification', source, Config.Alerts["no_item"], "error") + elseif Config.NotificationType == "ox_lib" then + TriggerClientEvent('ox_lib:notify', source, { type = 'error', description = Config.Alerts["no_item"] }) + end end end) @@ -23,23 +31,45 @@ RegisterNetEvent('esx-lumberjack:BuyAxe', function() local source = source local xPlayer = ESX.GetPlayerFromId(source) local TRAxeClassicPrice = LumberJob.AxePrice - local axe = xPlayer.hasWeapon('WEAPON_BATTLEAXE') - if not axe then - xPlayer.addWeapon('WEAPON_BATTLEAXE', ammo) - xPlayer.removeMoney("cash", TRAxeClassicPrice) - xPlayer.showNotification(Config.Alerts["axe_bought"], true, false, 140) - elseif axe then - xPlayer.showNotification(Config.Alerts["axe_check"], true, false, 140) + local axe = xPlayer.getInventoryItem('WEAPON_BATTLEAXE') + if axe.count >= 1 then + if Config.NotificationType == "ESX" then + TriggerClientEvent('esx:showNotification', source, Config.Alerts["axe_check"], "error") + elseif Config.NotificationType == "ox_lib" then + TriggerClientEvent('ox_lib:notify', source, { type = 'error', description = Config.Alerts["axe_check"] }) + end + return false + else + if Config.UseOxInventory then + xPlayer.addInventoryItem('WEAPON_BATTLEAXE', 1) + else + xPlayer.addWeapon('WEAPON_BATTLEAXE', 1) + end + xPlayer.removeMoney(LumberJob.AxePrice) + if Config.NotificationType == "ESX" then + TriggerClientEvent('esx:showNotification', source, Config.Alerts["axe_bought"], "success") + elseif Config.NotificationType == "ox_lib" then + TriggerClientEvent('ox_lib:notify', source, { type = 'success', description = Config.Alerts["axe_bought"] }) + end + return true end end) ESX.RegisterServerCallback('esx-lumberjack:axe', function(source, cb) local xPlayer = ESX.GetPlayerFromId(source) if xPlayer then - if xPlayer.hasWeapon('WEAPON_BATTLEAXE') then - cb(true) + if Config.UseOxInventory then + if xPlayer.hasItem('WEAPON_BATTLEAXE') then + cb(true) + else + cb(false) + end else - cb(false) + if xPlayer.hasWeapon('WEAPON_BATTLEAXE') then + cb(true) + else + cb(false) + end end end end) @@ -90,7 +120,11 @@ RegisterServerEvent('esx-lumberjack:lumberprocessed', function() local TradeAmount = math.random(LumberJob.TradeAmount_Min, LumberJob.TradeAmount_Max) local TradeRecevied = math.random(LumberJob.TradeRecevied_Min, LumberJob.TradeRecevied_Max) if lumber.count < 1 then - xPlayer.showNotification(Config.Alerts['error_lumber']) + if Config.NotificationType == "ESX" then + TriggerClientEvent('esx:showNotification', source, Config.Alerts['error_lumber'], "error") + elseif Config.NotificationType == "ox_lib" then + TriggerClientEvent('ox_lib:notify', source, { type = 'error', description = Config.Alerts['error_lumber'] }) + end return false end @@ -102,29 +136,19 @@ RegisterServerEvent('esx-lumberjack:lumberprocessed', function() end if lumber.count >= amount then xPlayer.removeInventoryItem('tree_lumber', amount) - xPlayer.showNotification(Config.Alerts["lumber_processed_trade"] ..TradeAmount.. Config.Alerts["lumber_processed_lumberamount"] ..TradeRecevied.. Config.Alerts["lumber_processed_received"]) + if Config.NotificationType == "ESX" then + TriggerClientEvent('esx:showNotification', source, Config.Alerts["lumber_processed_trade"] ..TradeAmount.. Config.Alerts["lumber_processed_lumberamount"] ..TradeRecevied.. Config.Alerts["lumber_processed_received"], "info") + elseif Config.NotificationType == "ox_lib" then + TriggerClientEvent('ox_lib:notify', source, { type = 'inform', description = Config.Alerts["lumber_processed_trade"] ..TradeAmount.. Config.Alerts["lumber_processed_lumberamount"] ..TradeRecevied.. Config.Alerts["lumber_processed_received"] }) + end Wait(750) xPlayer.addInventoryItem('wood_plank', TradeRecevied) - else - xPlayer.showNotification(Config.Alerts['itemamount']) + else + if Config.NotificationType == "ESX" then + TriggerClientEvent('esx:showNotification', source, Config.Alerts['itemamount'], "info") + elseif Config.NotificationType == "ox_lib" then + TriggerClientEvent('ox_lib:notify', source, { type = 'inform', description = Config.Alerts['itemamount'] }) + end return false end -end) - -AddEventHandler('onResourceStart', function(resourceName) - if (GetCurrentResourceName() ~= resourceName) then - return - end - print("-------------------------------------------------------------------------------------------------------------") - print("███████╗ ██████╗██╗ ██╗ ██╗ ██╗ ██╗███╗ ███╗██████╗ ███████╗██████╗ ██╗ █████╗ █████╗ ██╗ ██╗ ") - print("██╔═══ ██╔════╝╚██╗██╔╝ ██║ ██║ ██║████╗ ████║██╔══██╗██╔════╝██╔══██╗ ██║██╔══██╗██╔══██╗██║██╔╝ ") - print("█████╗ ╚█████╗ ╚███╔╝ ██║ ██║ ██║██╔████╔██║██████╦╝█████╗ ██████╔╝ ██║███████║██║ ╚═╝█████═╝ ") - print("██╔══╝ ╚═══██╗ ██╔██╗ ██║ ██║ ██║██║╚██╔╝██║██╔══██╗██╔══╝ ██╔══██╗██╗ ██║██╔══██║██║ ██╗██╔═██╗ ") - print("███████╗██████╔╝██╔╝╚██╗ ███████╗╚██████╔╝██║ ╚═╝ ██║██████╦╝███████╗██║ ██║╚█████╔╝██║ ██║╚█████╔╝██║ ╚██╗") - print("╚══════╝╚═════╝ ╚═╝ ╚═╝ ╚══════╝ ╚═════╝ ╚═╝ ╚═╝╚═════╝ ╚══════╝╚═╝ ╚═╝ ╚════╝ ╚═╝ ╚═╝ ╚════╝ ╚═╝ ╚═╝ ") - print(" Converted By Mycroft (Manager of ESX-Framework) & Benzo (Head Of ESX-Support)") - print(" Website: https://docs.esx-framework.org") - print(" TRClassic: https://dsc.gg/trclassic") - print(" Original Script: https://github.com/trclassic92/tr-lumberjack") - print("---------------------------------------------------------------------------------------------------------------") - end) +end) \ No newline at end of file