Refactor! (esx_mechanicjob): Breaking - change functions to match legacy

This commit is contained in:
Mycroft
2022-04-14 23:23:30 +01:00
parent aa396444a4
commit 2dacb08f0f
+8 -8
View File
@@ -12,9 +12,9 @@ local function Harvest(source)
if PlayersHarvesting[source] == true then
local xPlayer = ESX.GetPlayerFromId(source)
local GazBottleQuantity = xPlayer.getInventoryItem('gazbottle').count
local GazBottle = xPlayer.hasItem('gazbottle')
if GazBottleQuantity >= 5 then
if GazBottle and GazBottle.count >= 5 then
TriggerClientEvent('esx:showNotification', source, _U('you_do_not_room'))
else
xPlayer.addInventoryItem('gazbottle', 1)
@@ -44,9 +44,9 @@ local function Harvest2(source)
if PlayersHarvesting2[source] == true then
local xPlayer = ESX.GetPlayerFromId(source)
local FixToolQuantity = xPlayer.getInventoryItem('fixtool').count
local FixToolQuantity = xPlayer.hasItem('fixtool')
if FixToolQuantity >= 5 then
if FixToolQuantity and FixToolQuantity.count >= 5 then
TriggerClientEvent('esx:showNotification', source, _U('you_do_not_room'))
else
xPlayer.addInventoryItem('fixtool', 1)
@@ -107,9 +107,9 @@ local function Craft(source)
if PlayersCrafting[source] == true then
local xPlayer = ESX.GetPlayerFromId(source)
local GazBottleQuantity = xPlayer.getInventoryItem('gazbottle').count
local GazBottleQuantity = xPlayer.hasItem('gazbottle')
if GazBottleQuantity <= 0 then
if not GazBottleQuantity then
TriggerClientEvent('esx:showNotification', source, _U('not_enough_gas_can'))
else
xPlayer.removeInventoryItem('gazbottle', 1)
@@ -140,9 +140,9 @@ local function Craft2(source)
if PlayersCrafting2[source] == true then
local xPlayer = ESX.GetPlayerFromId(source)
local FixToolQuantity = xPlayer.getInventoryItem('fixtool').count
local FixToolQuantity = xPlayer.hasItem('fixtool')
if FixToolQuantity <= 0 then
if not FixToolQuantity then
TriggerClientEvent('esx:showNotification', source, _U('not_enough_repair_tools'))
else
xPlayer.removeInventoryItem('fixtool', 1)