Skip to content

Commit

Permalink
converted the system to use only the weight system from es_extended, …
Browse files Browse the repository at this point in the history
…so now its not needed to change any file, now is just install and run.
  • Loading branch information
diorgesl committed Dec 22, 2019
1 parent ef8e7f1 commit 0a161cf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
16 changes: 6 additions & 10 deletions esx_drugs.sql
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
ALTER TABLE `items`
ADD COLUMN `limit` INT NULL DEFAULT 0 AFTER `label`
;

INSERT INTO `items` (name, label, `limit`) VALUES
('weed', 'Weed (1G)', 420),
('weed_pooch', 'Bag of weed (28G)', 15),
INSERT INTO `items` (name, label, `weight`) VALUES
('weed', 'Weed (1G)', 1),
('weed_pooch', 'Bag of weed (28G)', 1),
('coke', 'Coke (1G)', 420),
('coke_pooch', 'Bag of coke (28G)', 15),
('coke_pooch', 'Bag of coke (28G)', 1),
('meth', 'Meth (1G)', 420),
('meth_pooch', 'Bag of meth (28G)', 15),
('meth_pooch', 'Bag of meth (28G)', 1),
('opium', 'Opium (1G)', 420),
('opium_pooch', 'Bag of opium (28G)', 15)
('opium_pooch', 'Bag of opium (28G)', 1)
;
8 changes: 2 additions & 6 deletions server/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,8 @@ local function Harvest(source, drug)
local item = xPlayer.getInventoryItem(v.Item)
local qtd = math.random(1,10)
if xPlayer.canCarryItem(v.Item, qtd) then
if item.limit ~= -1 and item.count >= item.limit then
TriggerClientEvent('esx:showNotification', source, _U('inv_full'))
else
xPlayer.addInventoryItem(v.Item, qtd)
Harvest(source, drug)
end
xPlayer.addInventoryItem(v.Item, qtd)
Harvest(source, drug)
else
TriggerClientEvent('esx_drugs:hasExitedMarker')
TriggerClientEvent('esx:showNotification', source, _U('inv_full'))
Expand Down

0 comments on commit 0a161cf

Please sign in to comment.