Add support for new ESX weight system (#63)

* Added weight support

* Update main.lua

* Removed unused variable
This commit is contained in:
Poggu
2019-11-13 21:46:48 +01:00
committed by Samuel
parent 13da795b09
commit e8f98e03eb
7 changed files with 38 additions and 39 deletions
+1 -1
View File
@@ -112,4 +112,4 @@ for k,v in ipairs(Config.Towables) do
Color = { r = 204, g = 204, b = 0 },
Type = -1
}
end
end
+6 -6
View File
@@ -20,11 +20,11 @@ INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_
('mechanic',4,'boss','Patron',0,'{}','{}')
;
INSERT INTO `items` (name, label, `limit`) VALUES
('gazbottle', 'bouteille de gaz', 11),
('fixtool', 'outils réparation', 6),
('carotool', 'outils carosserie', 4),
('blowpipe', 'Chalumeaux', 10),
('fixkit', 'Kit réparation', 5),
INSERT INTO `items` (name, label, weight) VALUES
('gazbottle', 'bouteille de gaz', 2),
('fixtool', 'outils réparation', 2),
('carotool', 'outils carosserie', 2),
('blowpipe', 'Chalumeaux', 2),
('fixkit', 'Kit réparation', 3),
('carokit', 'Kit carosserie', 3)
;
+6 -6
View File
@@ -20,11 +20,11 @@ INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_
('mechanic',4,'boss','Boss',0,'{}','{}')
;
INSERT INTO `items` (name, label, `limit`) VALUES
('gazbottle', 'Gas Bottle', 11),
('fixtool', 'Repair Tools', 6),
('carotool', 'Tools', 4),
('blowpipe', 'Blowtorch', 10),
('fixkit', 'Repair Kit', 5),
INSERT INTO `items` (name, label, weight) VALUES
('gazbottle', 'Gas Bottle', 2),
('fixtool', 'Repair Tools', 2),
('carotool', 'Tools', 2),
('blowpipe', 'Blowtorch', 2),
('fixkit', 'Repair Kit', 3),
('carokit', 'Body Kit', 3)
;
+6 -6
View File
@@ -20,11 +20,11 @@ INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_
('mechanic',4,'boss','Pomo',0,'{}','{}')
;
INSERT INTO `items` (name, label, `limit`) VALUES
('gazbottle', 'Kaasupullo', 11),
('fixtool', 'Korjaustyökalut', 6),
('carotool', 'Työkalut', 4),
('blowpipe', 'Polttoleikkuri', 10),
('fixkit', 'Korjauskitti', 5),
INSERT INTO `items` (name, label, weight) VALUES
('gazbottle', 'Kaasupullo', 2),
('fixtool', 'Korjaustyökalut', 2),
('carotool', 'Työkalut', 2),
('blowpipe', 'Polttoleikkuri', 2),
('fixkit', 'Korjauskitti', 3),
('carokit', 'Korikitti', 3)
;
+6 -6
View File
@@ -20,11 +20,11 @@ INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_
('mechanic',4,'boss','Szef',0,'{}','{}')
;
INSERT INTO `items` (name, label, `limit`) VALUES
('gazbottle', 'Butelka z gazem', 11),
('fixtool', 'Zestaw do naprawy', 6),
('carotool', 'Częsci naprawcze', 4),
('blowpipe', 'Palnik', 10),
('fixkit', 'Narzedzia naprawcze', 5),
INSERT INTO `items` (name, label, weight) VALUES
('gazbottle', 'Butelka z gazem', 2),
('fixtool', 'Zestaw do naprawy', 2),
('carotool', 'Częsci naprawcze', 2),
('blowpipe', 'Palnik', 2),
('fixkit', 'Narzedzia naprawcze', 3),
('carokit', 'Części blacharskie', 3)
;
+6 -6
View File
@@ -20,11 +20,11 @@ INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_
('mechanic',4,'boss','Ägare',0,'{}','{}')
;
INSERT INTO `items` (name, label, `limit`) VALUES
('gazbottle', 'Gas Flaska', 11),
('fixtool', 'Reparationsverktyg', 6),
('carotool', 'Verktyg', 4),
('blowpipe', 'Blåslampa', 10),
('fixkit', 'Reparationssats', 5),
INSERT INTO `items` (name, label, weight) VALUES
('gazbottle', 'Gas Flaska', 2),
('fixtool', 'Reparationsverktyg', 2),
('carotool', 'Verktyg', 2),
('blowpipe', 'Blåslampa', 2),
('fixkit', 'Reparationssats', 3),
('carokit', 'Karosskit', 3)
;
+7 -8
View File
@@ -262,21 +262,20 @@ AddEventHandler('esx_mechanicjob:getStockItem', function(itemName, count)
TriggerEvent('esx_addoninventory:getSharedInventory', 'society_mechanic', function(inventory)
local item = inventory.getItem(itemName)
local sourceItem = xPlayer.getInventoryItem(itemName)
-- is there enough in the society?
if count > 0 and item.count >= count then
-- can the player carry the said amount of x item?
if sourceItem.limit ~= -1 and (sourceItem.count + count) > sourceItem.limit then
TriggerClientEvent('esx:showNotification', xPlayer.source, _U('player_cannot_hold'))
else
if xPlayer.canCarryItem(itemName, count) then
inventory.removeItem(itemName, count)
xPlayer.addInventoryItem(itemName, count)
TriggerClientEvent('esx:showNotification', xPlayer.source, _U('have_withdrawn', count, item.label))
xPlayer.showNotification(_U('have_withdrawn', count, item.label))
else
xPlayer.showNotification(_U('player_cannot_hold'))
end
else
TriggerClientEvent('esx:showNotification', xPlayer.source, _U('invalid_quantity'))
xPlayer.showNotification(_U('invalid_quantity'))
end
end)
end)
@@ -299,10 +298,10 @@ AddEventHandler('esx_mechanicjob:putStockItems', function(itemName, count)
xPlayer.removeInventoryItem(itemName, count)
inventory.addItem(itemName, count)
else
TriggerClientEvent('esx:showNotification', xPlayer.source, _U('invalid_quantity'))
xPlayer.showNotification(_U('invalid_quantity'))
end
TriggerClientEvent('esx:showNotification', xPlayer.source, _U('have_deposited', count, item.label))
xPlayer.showNotification(_U('have_deposited', count, item.label))
end)
end)