mirror of
https://github.com/jimathy/jim_bridge.git
synced 2026-08-19 14:56:02 +01:00
Compare commits
3 Commits
v2.1.04
...
d1dab48acc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d1dab48acc | ||
|
|
7e595df143 | ||
|
|
d791a2e09f |
@@ -86,8 +86,8 @@ function craftingMenu(data)
|
|||||||
for k, v in ipairs(data.craftable.Recipes) do
|
for k, v in ipairs(data.craftable.Recipes) do
|
||||||
local Recipe = v
|
local Recipe = v
|
||||||
for l, b in pairs(Recipe) do
|
for l, b in pairs(Recipe) do
|
||||||
id += 1
|
|
||||||
if doesItemExist(l) then
|
if doesItemExist(l) then
|
||||||
|
id += 1
|
||||||
compatTable[l] = {
|
compatTable[l] = {
|
||||||
ingredients = b,
|
ingredients = b,
|
||||||
id = id,
|
id = id,
|
||||||
@@ -376,7 +376,10 @@ end
|
|||||||
--- })
|
--- })
|
||||||
--- ```
|
--- ```
|
||||||
|
|
||||||
function makeItem(data)
|
function makeItem(origData)
|
||||||
|
|
||||||
|
local data = cloneTable(origData)
|
||||||
|
|
||||||
local Ped = PlayerPedId()
|
local Ped = PlayerPedId()
|
||||||
if CraftLock then return end
|
if CraftLock then return end
|
||||||
CraftLock = true
|
CraftLock = true
|
||||||
@@ -418,7 +421,7 @@ function makeItem(data)
|
|||||||
print("^1Error^7: ^2Inventory is open, you tried to break things")
|
print("^1Error^7: ^2Inventory is open, you tried to break things")
|
||||||
stopCam(0)
|
stopCam(0)
|
||||||
ClearPedTasks(Ped)
|
ClearPedTasks(Ped)
|
||||||
if canReturn then craftingMenu(data) end
|
if canReturn then craftingMenu(origData) end
|
||||||
CraftLock = false
|
CraftLock = false
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -442,7 +445,7 @@ function makeItem(data)
|
|||||||
if not crafted then
|
if not crafted then
|
||||||
stopCam(0)
|
stopCam(0)
|
||||||
ClearPedTasks(Ped)
|
ClearPedTasks(Ped)
|
||||||
if canReturn then craftingMenu(data) end
|
if canReturn then craftingMenu(origData) end
|
||||||
CraftLock = false
|
CraftLock = false
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -527,7 +530,7 @@ function makeItem(data)
|
|||||||
--Wait(500)
|
--Wait(500)
|
||||||
stopCam(0)
|
stopCam(0)
|
||||||
CraftLock = false
|
CraftLock = false
|
||||||
if canReturn then craftingMenu(data) end
|
if canReturn then craftingMenu(origData) end
|
||||||
ClearPedTasks(Ped)
|
ClearPedTasks(Ped)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -651,6 +651,29 @@ function lookEnt(entity)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Function to clone tables, to use when referencing tables that need to be hard set
|
||||||
|
function cloneTable(obj, opts, seen)
|
||||||
|
if type(obj) ~= "table" then return obj end
|
||||||
|
seen = seen or {}
|
||||||
|
if seen[obj] then return seen[obj] end
|
||||||
|
|
||||||
|
local copy = {}
|
||||||
|
seen[obj] = copy
|
||||||
|
|
||||||
|
-- Copy entries
|
||||||
|
for k, v in pairs(obj) do
|
||||||
|
local k2 = (opts and opts.copy_keys) and cloneTable(k, opts, seen) or k
|
||||||
|
copy[k2] = cloneTable(v, opts, seen)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Preserve metatable unless told not to
|
||||||
|
if not (opts and opts.strip_meta) then
|
||||||
|
local mt = getmetatable(obj)
|
||||||
|
if mt ~= nil then setmetatable(copy, mt) end
|
||||||
|
end
|
||||||
|
|
||||||
|
return copy
|
||||||
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------
|
-------------------------------------------------------------
|
||||||
-- Material and Prop Functions
|
-- Material and Prop Functions
|
||||||
|
|||||||
@@ -231,7 +231,6 @@ function gtaProgressBar(data)
|
|||||||
while result == nil do Wait(10) end
|
while result == nil do Wait(10) end
|
||||||
inProgress = false
|
inProgress = false
|
||||||
|
|
||||||
print(tostring(result))
|
|
||||||
-- Cleanup animations/tasks
|
-- Cleanup animations/tasks
|
||||||
if data.dict then
|
if data.dict then
|
||||||
stopAnim(data.dict, data.anim, ped)
|
stopAnim(data.dict, data.anim, ped)
|
||||||
@@ -240,7 +239,6 @@ function gtaProgressBar(data)
|
|||||||
ClearPedTasks(ped)
|
ClearPedTasks(ped)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- Cleanup
|
-- Cleanup
|
||||||
FreezeEntityPosition(ped, false)
|
FreezeEntityPosition(ped, false)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user