Skip to content
This repository was archived by the owner on Apr 19, 2025. It is now read-only.

Commit 7bf7c7d

Browse files
committed
tweak(server/shops): warn when item is grade-restricted, but has no job
If the shop jobs/groups is nil, but grade is defined on a slot, purchasing the item ends up throwing an error. Set the grade to nil but give a warning about the item.
1 parent 6178d9e commit 7bf7c7d

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

fxmanifest.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ game 'gta5'
77
--[[ Resource Information ]]--
88
name 'ox_inventory'
99
author 'Overextended'
10-
version '2.8.4'
10+
version '2.8.5'
1111
repository 'https://github.com/overextended/ox_inventory'
1212
description 'What even is an "ESX.Items" anyway?'
1313

modules/shops/server.lua

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,14 @@ for shopName, shopDetails in pairs(data('shops')) do
2323
}
2424
for j = 1, Shops[shopName][i].slots do
2525
local slot = Shops[shopName][i].items[j]
26+
27+
if slot.grade and not shopDetails.groups then
28+
print(('^1attempted to restrict slot %s (%s) to grade %s, but %s has no job restriction^0'):format(i, slot.name, slot.grade, shopDetails.name))
29+
slot.grade = nil
30+
end
31+
2632
local Item = Items(slot.name)
33+
2734
if Item then
2835
slot = {
2936
name = Item.name,
@@ -51,7 +58,14 @@ for shopName, shopDetails in pairs(data('shops')) do
5158
}
5259
for i = 1, Shops[shopName].slots do
5360
local slot = Shops[shopName].items[i]
61+
62+
if slot.grade and not shopDetails.groups then
63+
print(('^1attempted to restrict slot %s (%s) to grade %s, but %s has no job restriction^0'):format(i, slot.name, slot.grade, shopDetails.name))
64+
slot.grade = nil
65+
end
66+
5467
local Item = Items(slot.name)
68+
5569
if Item then
5670
slot = {
5771
name = Item.name,

0 commit comments

Comments
 (0)