From a2efa9e248a33a06a731e9046ea2a9c830379c23 Mon Sep 17 00:00:00 2001 From: Fredrik Vold Date: Mon, 11 Nov 2019 22:15:13 +0100 Subject: [PATCH] Checking for item validity on startup Also, support for people running newer ESX that does not have a "limt" for items. --- sv_uteknark.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sv_uteknark.lua b/sv_uteknark.lua index 20b3b42..70bda2b 100644 --- a/sv_uteknark.lua +++ b/sv_uteknark.lua @@ -6,7 +6,7 @@ local VERBOSE = false local lastPlant = {} local tickTimes = {} local tickPlantCount = 0 -local VERSION = '1.0.0' +local VERSION = '1.1.0' AddEventHandler('playerDropped',function(why) lastPlant[source] = nil @@ -99,7 +99,7 @@ function GiveItem(who, what, count) end local itemspec = xPlayer.getInventoryItem(what) if itemspec then - if itemspec.limit == -1 or itemspec.count + count <= itemspec.limit then + if not itemspec.limit or itemspec.limit == -1 or itemspec.count + count <= itemspec.limit then xPlayer.addInventoryItem(what, count) return true else @@ -218,6 +218,11 @@ Citizen.CreateThread(function() while ESX == nil and ESXTries > 0 do TriggerEvent('esx:getSharedObject', function(obj) ESX = obj + for forWhat,itemName in pairs(Config.Items) do + if not ESX.Items[itemName] then + log('WARNING:',forWhat,'item in cofiguration ('..itemName..') does not exist!') + end + end ESX.RegisterUsableItem(Config.Items.Seed, function(source) local now = os.time() local last = lastPlant[source] or 0