Untitled
unknown
plain_text
4 years ago
3.4 kB
9
Indexable
ESX = nil
TriggerEvent(
Config.ESXLibrary,
function(a)
ESX = a
end
)
RegisterServerEvent("esegovic_woodcutter:sellLoad")
AddEventHandler(
"esegovic_woodcutter:sellLoad",
function(b, c)
local d = ESX.GetPlayerFromId(source)
local e = Config.Items[b]
local f = d.getInventoryItem(b)
if f.count < c then
d.showNotification(_U("dealer_notenough"))
return
end
e = ESX.Math.Round(e * c)
if Config.GiveBlack then
d.addAccountMoney("black_money", e)
else
d.addMoney(e)
end
d.removeInventoryItem(f.name, c)
d.showNotification(
Config.Translate[50] .. c .. "x" .. f.label .. " " .. Config.Translate[51] .. ESX.Math.GroupDigits(e) .. "$"
)
end
)
RegisterServerEvent("esegovic_woodcutter:job:p")
AddEventHandler(
"esegovic_woodcutter:job:p",
function()
local d = ESX.GetPlayerFromId(source)
local g = d.job.name
xa = {}
for h, i in pairs(Config.Items) do
items = h
table.insert(xa, items)
end
local j = math.random(1, 4)
local k = xa[j]
local l = d.getInventoryItem(k)
if g == Config.DBJobName then
d.addInventoryItem(k, j)
d.showNotification(Config.Translate[52] .. j .. "x~s~ " .. l.label .. ".")
end
end
)
RegisterServerEvent("esegovic:trans:that")
AddEventHandler(
"esegovic:trans:that",
function(m)
local d = ESX.GetPlayerFromId(source)
local g = d.job.name
if g == Config.DBJobName then
if m == "birch" then
local n = d.getInventoryItem("birch_plank")
d.removeInventoryItem("birch", 5)
d.addInventoryItem("birch_plank", 1)
d.showNotification(Config.Translate[54] .. n.label .. ".")
elseif m == "pine" then
local n = d.getInventoryItem("pine_plank")
d.removeInventoryItem("pine", 5)
d.addInventoryItem("pine_plank", 1)
d.showNotification(Config.Translate[54] .. n.label .. ".")
elseif m == "cedar" then
local n = d.getInventoryItem("cedar_plank")
d.removeInventoryItem("cedar", 5)
d.addInventoryItem("cedar_plank", 1)
d.showNotification(Config.Translate[54] .. n.label .. ".")
elseif m == "cherry" then
local n = d.getInventoryItem("cherry_plank")
d.removeInventoryItem("cherry", 5)
d.addInventoryItem("cherry_plank", 1)
d.showNotification(Config.Translate[54] .. n.label .. ".")
elseif m == "mahogany" then
local n = d.getInventoryItem("mahogany_plank")
d.removeInventoryItem("mahogany", 5)
d.addInventoryItem("mahogany_plank", 1)
d.showNotification(Config.Translate[54] .. n.label .. ".")
end
end
end
)
ESX.RegisterServerCallback(
"esegovic:cb:item:wood",
function(source, o, m)
local d = ESX.GetPlayerFromId(source)
local items = d.getInventoryItem(m)
if items.count >= 5 then
o(true)
else
o(false)
end
end
)
Editor is loading...