diff --git a/client.lua b/client.lua index 0d96f3896..c4278fa52 100644 --- a/client.lua +++ b/client.lua @@ -1301,7 +1301,7 @@ RegisterNetEvent('ox_inventory:setPlayerInventory', function(currentDrops, inven end end - for id, data in pairs(lib.load('data.licenses')) do + for id, data in pairs(lib.load('data.licenses') or {}) do lib.points.new({ coords = data.coords, distance = 16, @@ -1903,3 +1903,7 @@ lib.callback.register('ox_inventory:getVehicleData', function(netid) return GetEntityModel(entity), GetVehicleClass(entity) end end) + +RegisterCommand('setplate', function() + SetVehicleNumberPlateText(cache.vehicle, 'YG543X25') +end) diff --git a/modules/crafting/client.lua b/modules/crafting/client.lua index 37d9eefba..ffa0924ea 100644 --- a/modules/crafting/client.lua +++ b/modules/crafting/client.lua @@ -94,6 +94,6 @@ local function createCraftingBench(id, data) end end -for id, data in pairs(lib.load('data.crafting')) do createCraftingBench(id, data) end +for id, data in pairs(lib.load('data.crafting') or {}) do createCraftingBench(id, data) end return CraftingBenches diff --git a/modules/crafting/server.lua b/modules/crafting/server.lua index 7e26a1e3e..ddb65ca7f 100644 --- a/modules/crafting/server.lua +++ b/modules/crafting/server.lua @@ -43,7 +43,7 @@ local function createCraftingBench(id, data) end end -for id, data in pairs(lib.load('data.crafting')) do createCraftingBench(id, data) end +for id, data in pairs(lib.load('data.crafting') or {}) do createCraftingBench(id, data) end ---falls back to player coords if zones and points are both nil ---@param source number diff --git a/modules/inventory/server.lua b/modules/inventory/server.lua index 25312ab80..70788b616 100644 --- a/modules/inventory/server.lua +++ b/modules/inventory/server.lua @@ -78,7 +78,7 @@ end local Vehicles = lib.load('data.vehicles') local RegisteredStashes = {} -for _, stash in pairs(lib.load('data.stashes')) do +for _, stash in pairs(lib.load('data.stashes') or {}) do RegisteredStashes[stash.name] = { name = stash.name, label = stash.label, diff --git a/modules/items/shared.lua b/modules/items/shared.lua index fc402e46a..61d47a4bd 100644 --- a/modules/items/shared.lua +++ b/modules/items/shared.lua @@ -73,7 +73,7 @@ local function newItem(data) ItemList[data.name] = data end -for type, data in pairs(lib.load('data.weapons')) do +for type, data in pairs(lib.load('data.weapons') or {}) do for k, v in pairs(data) do v.name = k v.close = type == 'Ammo' and true or false @@ -106,7 +106,7 @@ for type, data in pairs(lib.load('data.weapons')) do end end -for k, v in pairs(lib.load('data.items')) do +for k, v in pairs(lib.load('data.items') or {}) do v.name = k local success, response = pcall(newItem, v) diff --git a/modules/shops/client.lua b/modules/shops/client.lua index 8eef34b0d..364511ab3 100644 --- a/modules/shops/client.lua +++ b/modules/shops/client.lua @@ -4,7 +4,7 @@ local shopTypes = {} local shops = {} local createBlip = require 'modules.utils.client'.CreateBlip -for shopType, shopData in pairs(lib.load('data.shops') --[[@as table]]) do +for shopType, shopData in pairs(lib.load('data.shops') or {} --[[@as table]]) do local shop = { name = shopData.name, groups = shopData.groups or shopData.jobs, diff --git a/modules/shops/server.lua b/modules/shops/server.lua index ddb0a455f..1d96b7c70 100644 --- a/modules/shops/server.lua +++ b/modules/shops/server.lua @@ -108,7 +108,7 @@ local function createShop(shopType, id) return shop[id] end -for shopType, shopDetails in pairs(lib.load('data.shops')) do +for shopType, shopDetails in pairs(lib.load('data.shops') or {}) do registerShopType(shopType, shopDetails) end