mirror of
https://github.com/jimathy/jim_bridge.git
synced 2026-08-17 05:56:02 +01:00
Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
78c3e33d38 | ||
|
|
3be5b5e1ee | ||
|
|
f550479298 | ||
|
|
5fe0ab8815 | ||
|
|
56ccb43c2b | ||
|
|
93d0754935 | ||
|
|
d82366b59f | ||
|
|
35202f7000 | ||
|
|
bc5aadc394 | ||
|
|
181c480ba6 | ||
|
|
b973c71638 | ||
|
|
ede0a44251 | ||
|
|
e4b0f8601a | ||
|
|
d12c615f0b | ||
|
|
e58163d631 |
@@ -39,6 +39,7 @@ function craftingMenu(data) local hasjob = false
|
|||||||
for i = 1, #Recipes do
|
for i = 1, #Recipes do
|
||||||
for k, v in pairs(Recipes[i]) do
|
for k, v in pairs(Recipes[i]) do
|
||||||
if k ~= "amount" and k ~= "job" and k ~= "gang" then
|
if k ~= "amount" and k ~= "job" and k ~= "gang" then
|
||||||
|
if not Recipes[i]["amount"] then Recipes[i]["amount"] = 1 end
|
||||||
if Recipes[i].job then hasjob = false
|
if Recipes[i].job then hasjob = false
|
||||||
for l, b in pairs(Recipes[i].job) do
|
for l, b in pairs(Recipes[i].job) do
|
||||||
hasjob = hasJob(l, nil, b)
|
hasjob = hasJob(l, nil, b)
|
||||||
@@ -456,7 +457,7 @@ function stashRemoveItem(stashItems, stashName, items) local amount = amount and
|
|||||||
if Config.System.Debug then
|
if Config.System.Debug then
|
||||||
print("^6Bridge^7: ^3saveStash^7: ^2Saving ^3QB^2 stash ^7'^6"..stashName.."^7'")
|
print("^6Bridge^7: ^3saveStash^7: ^2Saving ^3QB^2 stash ^7'^6"..stashName.."^7'")
|
||||||
end
|
end
|
||||||
else
|
elseif GetResourceState(QBInv):find("start") then
|
||||||
for k, v in pairs(items) do
|
for k, v in pairs(items) do
|
||||||
for l in pairs(stashItems) do
|
for l in pairs(stashItems) do
|
||||||
if stashItems[l].name == k then
|
if stashItems[l].name == k then
|
||||||
@@ -478,6 +479,8 @@ function stashRemoveItem(stashItems, stashName, items) local amount = amount and
|
|||||||
print("^6Bridge^7: ^3saveStash^7: ^2Saving ^3QB^2 stash ^7'^6"..stashName.."^7'")
|
print("^6Bridge^7: ^3saveStash^7: ^2Saving ^3QB^2 stash ^7'^6"..stashName.."^7'")
|
||||||
end
|
end
|
||||||
MySQL.Async.insert('INSERT INTO stashitems (stash, items) VALUES (:stash, :items) ON DUPLICATE KEY UPDATE items = :items', { ['stash'] = stashName, ['items'] = json.encode(stashItems) })
|
MySQL.Async.insert('INSERT INTO stashitems (stash, items) VALUES (:stash, :items) ON DUPLICATE KEY UPDATE items = :items', { ['stash'] = stashName, ['items'] = json.encode(stashItems) })
|
||||||
|
else
|
||||||
|
print("^4ERROR^7: ^2No Inventory detected ^7- ^2Check ^3exports^1.^2lua^7")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
RegisterNetEvent(GetCurrentResourceName()..":server:stashRemoveItem", stashRemoveItem)
|
RegisterNetEvent(GetCurrentResourceName()..":server:stashRemoveItem", stashRemoveItem)
|
||||||
|
|||||||
@@ -654,12 +654,21 @@ end
|
|||||||
|
|
||||||
local function CheckVersion()
|
local function CheckVersion()
|
||||||
if IsDuplicityVersion() then
|
if IsDuplicityVersion() then
|
||||||
PerformHttpRequest('https://raw.githubusercontent.com/jimathy/UpdateVersions/master/'..GetCurrentResourceName()..'.txt', function(err, newestVersion, headers)
|
|
||||||
if not newestVersion then print("Currently unable to run a version check.") return end
|
|
||||||
local currentVersion = "^3"..GetResourceMetadata(GetCurrentResourceName(), 'version'):gsub("%.", "^7.^3").."^7"
|
local currentVersion = "^3"..GetResourceMetadata(GetCurrentResourceName(), 'version'):gsub("%.", "^7.^3").."^7"
|
||||||
|
PerformHttpRequest('https://raw.githubusercontent.com/jimathy/UpdateVersions/master/'..GetCurrentResourceName()..'.txt', function(err, newestVersion, headers)
|
||||||
|
if not newestVersion then
|
||||||
|
PerformHttpRequest('https://raw.githubusercontent.com/jimathy/'..GetCurrentResourceName()..'/master/version.txt', function(err, freeVersion, headers)
|
||||||
|
if not freeVersion then print("^1Currently unable to run a version check for ^7'^3"..GetCurrentResourceName().."^7' ("..currentVersion.."^7)") return end
|
||||||
|
local currentVersion = "^3"..GetResourceMetadata(GetCurrentResourceName(), 'version'):gsub("%.", "^7.^3").."^7"
|
||||||
|
freeVersion = "^3"..freeVersion:sub(1, -2):gsub("%.", "^7.^3").."^7"
|
||||||
|
print("^6Version Check^7: ^2Running^7: "..currentVersion.." ^2Latest^7: "..freeVersion)
|
||||||
|
print(freeVersion == currentVersion and "^7'^3"..GetCurrentResourceName().."^7' - ^6You are running the latest version.^7 ("..currentVersion..")" or "^7'^3"..GetCurrentResourceName().."^7' - ^1You are currently running an outdated version^7, ^1please update^7!")
|
||||||
|
end)
|
||||||
|
else
|
||||||
newestVersion = "^3"..newestVersion:sub(1, -2):gsub("%.", "^7.^3").."^7"
|
newestVersion = "^3"..newestVersion:sub(1, -2):gsub("%.", "^7.^3").."^7"
|
||||||
print("^6Version Check^7: ^2Running^7: "..currentVersion.." ^2Latest^7: "..newestVersion)
|
print("^6Version Check^7: ^2Running^7: "..currentVersion.." ^2Latest^7: "..newestVersion)
|
||||||
print(newestVersion == currentVersion and '^6You are running the latest version.^7 ('..currentVersion..')' or "^1You are currently running an outdated version^7, ^1please update^7!")
|
print(newestVersion == currentVersion and '^6You are running the latest version.^7 ('..currentVersion..')' or "^1You are currently running an outdated version^7, ^1please update^7!")
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
name "Jim_Bridge"
|
name "Jim_Bridge"
|
||||||
author "Jimathy"
|
author "Jimathy"
|
||||||
version "1.0"
|
version "1.0.1"
|
||||||
description "Framework Bridge By Jimathy"
|
description "Framework Bridge By Jimathy"
|
||||||
fx_version "cerulean"
|
fx_version "cerulean"
|
||||||
game "gta5"
|
game "gta5"
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
1.0
|
1.0.1
|
||||||
|
|||||||
25
wrapper.lua
25
wrapper.lua
@@ -21,7 +21,7 @@ OXTargetExport = Exports and Exports.OXTargetExport or ""
|
|||||||
function CheckBridgeVersion()
|
function CheckBridgeVersion()
|
||||||
if IsDuplicityVersion() then
|
if IsDuplicityVersion() then
|
||||||
local currentVersion = "^3"..GetResourceMetadata("jim_bridge", 'version'):gsub("%.", "^7.^3").."^7"
|
local currentVersion = "^3"..GetResourceMetadata("jim_bridge", 'version'):gsub("%.", "^7.^3").."^7"
|
||||||
PerformHttpRequest('https://raw.githubusercontent.com/jimathy/jim_bridge/duty-fixes/version.txt', function(err, newestVersion, headers)
|
PerformHttpRequest('https://raw.githubusercontent.com/jimathy/jim_bridge/master/version.txt', function(err, newestVersion, headers)
|
||||||
if not newestVersion then print("^1Currently unable to run a version check for ^7'^3jim_bridge^7' ("..currentVersion.."^7)") return end
|
if not newestVersion then print("^1Currently unable to run a version check for ^7'^3jim_bridge^7' ("..currentVersion.."^7)") return end
|
||||||
newestVersion = "^3"..newestVersion:sub(1, -2):gsub("%.", "^7.^3").."^7"
|
newestVersion = "^3"..newestVersion:sub(1, -2):gsub("%.", "^7.^3").."^7"
|
||||||
print(newestVersion == currentVersion and "^7'^3jim_bridge^7' - ^6You are running the latest version.^7 ("..currentVersion..")" or "^7'^3jim_bridge^7' - ^1You are currently running an outdated version^7, ^1please update^7!")
|
print(newestVersion == currentVersion and "^7'^3jim_bridge^7' - ^6You are running the latest version.^7 ("..currentVersion..")" or "^7'^3jim_bridge^7' - ^1You are currently running an outdated version^7, ^1please update^7!")
|
||||||
@@ -60,7 +60,7 @@ end
|
|||||||
|
|
||||||
-- Load Vehicles
|
-- Load Vehicles
|
||||||
if GetResourceState(QBXExport):find("start") then
|
if GetResourceState(QBXExport):find("start") then
|
||||||
Core = Core or exports[QBExport]:GetCoreObject()
|
Core = Core or exports[QBXExport]:GetCoreObject()
|
||||||
print("^6Bridge^7: ^2Loading ^3Vehicles^2 from ^7"..QBXExport)
|
print("^6Bridge^7: ^2Loading ^3Vehicles^2 from ^7"..QBXExport)
|
||||||
Vehicles = exports[QBXExport]:GetVehiclesByHash()
|
Vehicles = exports[QBXExport]:GetVehiclesByHash()
|
||||||
elseif GetResourceState(QBExport):find("start") then
|
elseif GetResourceState(QBExport):find("start") then
|
||||||
@@ -560,12 +560,7 @@ if not GetResourceState(OXTargetExport):find("start") and not GetResourceState(Q
|
|||||||
local pedCoords = GetEntityCoords(PlayerPedId())
|
local pedCoords = GetEntityCoords(PlayerPedId())
|
||||||
for k, v in pairs (TextTargets) do
|
for k, v in pairs (TextTargets) do
|
||||||
if #(pedCoords - v.coords) <= v.dist then
|
if #(pedCoords - v.coords) <= v.dist then
|
||||||
DrawText3D(
|
DrawText3D(v.coords.x, v.coords.y, v.coords.z + 1.0, v.buttontext)
|
||||||
v.coords.x,
|
|
||||||
v.coords.y,
|
|
||||||
v.coords.z + 1.0,
|
|
||||||
v.buttontext
|
|
||||||
)
|
|
||||||
for i = 1, #v.options do
|
for i = 1, #v.options do
|
||||||
if IsControlJustPressed(0, v.options[i].key) then
|
if IsControlJustPressed(0, v.options[i].key) then
|
||||||
if v.options[i].onSelect then v.options[i].onSelect() end
|
if v.options[i].onSelect then v.options[i].onSelect() end
|
||||||
@@ -740,7 +735,6 @@ function onPlayerLoaded(func)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- INPUT --
|
-- INPUT --
|
||||||
function createInput(title, opts)
|
function createInput(title, opts)
|
||||||
local dialog = nil
|
local dialog = nil
|
||||||
@@ -990,7 +984,7 @@ function createUseableItem(item, funct)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function hasJob(job, source, grade) local hasJob = false
|
function hasJob(job, source, grade) local hasJob, duty = false, true
|
||||||
if source then
|
if source then
|
||||||
local src = tonumber(source)
|
local src = tonumber(source)
|
||||||
if GetResourceState(ESXExport):find("start") then
|
if GetResourceState(ESXExport):find("start") then
|
||||||
@@ -1012,16 +1006,19 @@ function hasJob(job, source, grade) local hasJob = false
|
|||||||
elseif GetResourceState(QBXExport):find("start") then
|
elseif GetResourceState(QBXExport):find("start") then
|
||||||
local jobinfo = exports[QBXExport]:GetPlayer(src).PlayerData.job
|
local jobinfo = exports[QBXExport]:GetPlayer(src).PlayerData.job
|
||||||
if jobinfo.name == job then hasJob = true
|
if jobinfo.name == job then hasJob = true
|
||||||
|
duty = exports[QBXExport]:GetPlayer(src).PlayerData.job.onduty
|
||||||
if grade and not (grade <= jobinfo.grade.level) then hasJob = false end
|
if grade and not (grade <= jobinfo.grade.level) then hasJob = false end
|
||||||
end
|
end
|
||||||
local ganginfo = exports[QBXExport]:GetPlayer(src).PlayerData.gang
|
local ganginfo = exports[QBXExport]:GetPlayer(src).PlayerData.gang
|
||||||
if ganginfo.name == job then hasJob = true
|
if ganginfo.name == job then hasJob = true
|
||||||
if grade and not (grade <= ganginfo.grade.level) then hasJob = false end
|
if grade and not (grade <= ganginfo.grade.level) then hasJob = false end
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif GetResourceState(QBExport):find("start") and not GetResourceState(QBXExport):find("start") then
|
elseif GetResourceState(QBExport):find("start") and not GetResourceState(QBXExport):find("start") then
|
||||||
if Core.Functions.GetPlayer then -- support older qb-core functions
|
if Core.Functions.GetPlayer then -- support older qb-core functions
|
||||||
local jobinfo = Core.Functions.GetPlayer(src).PlayerData.job
|
local jobinfo = Core.Functions.GetPlayer(src).PlayerData.job
|
||||||
if jobinfo.name == job then hasJob = true
|
if jobinfo.name == job then hasJob = true
|
||||||
|
duty = Core.Functions.GetPlayer(src).PlayerData.job.onduty
|
||||||
if grade and not (grade <= jobinfo.grade.level) then hasJob = false end
|
if grade and not (grade <= jobinfo.grade.level) then hasJob = false end
|
||||||
end
|
end
|
||||||
local ganginfo = Core.Functions.GetPlayer(src).PlayerData.gang
|
local ganginfo = Core.Functions.GetPlayer(src).PlayerData.gang
|
||||||
@@ -1031,6 +1028,7 @@ function hasJob(job, source, grade) local hasJob = false
|
|||||||
else -- support newer qb-core exports
|
else -- support newer qb-core exports
|
||||||
local jobinfo = exports[QBExport]:GetPlayer(src).PlayerData.job
|
local jobinfo = exports[QBExport]:GetPlayer(src).PlayerData.job
|
||||||
if jobinfo.name == job then hasJob = true
|
if jobinfo.name == job then hasJob = true
|
||||||
|
duty = exports[QBExport]:GetPlayer(src).PlayerData.job.onduty
|
||||||
if grade and not (grade <= jobinfo.grade.level) then hasJob = false end
|
if grade and not (grade <= jobinfo.grade.level) then hasJob = false end
|
||||||
end
|
end
|
||||||
local ganginfo = exports[QBExport]:GetPlayer(src).PlayerData.gang
|
local ganginfo = exports[QBExport]:GetPlayer(src).PlayerData.gang
|
||||||
@@ -1059,6 +1057,7 @@ function hasJob(job, source, grade) local hasJob = false
|
|||||||
elseif GetResourceState(QBXExport):find("start") then
|
elseif GetResourceState(QBXExport):find("start") then
|
||||||
local jobinfo = QBX.PlayerData.job
|
local jobinfo = QBX.PlayerData.job
|
||||||
if jobinfo.name == job then hasJob = true
|
if jobinfo.name == job then hasJob = true
|
||||||
|
duty = QBX.PlayerData.job.onduty
|
||||||
if grade and not (grade <= jobinfo.grade.level) then hasJob = false end
|
if grade and not (grade <= jobinfo.grade.level) then hasJob = false end
|
||||||
end
|
end
|
||||||
local ganginfo = QBX.PlayerData.gang
|
local ganginfo = QBX.PlayerData.gang
|
||||||
@@ -1071,8 +1070,8 @@ function hasJob(job, source, grade) local hasJob = false
|
|||||||
info = PlayerData
|
info = PlayerData
|
||||||
end)
|
end)
|
||||||
local jobinfo = info.job
|
local jobinfo = info.job
|
||||||
if jobinfo.name == job then
|
if jobinfo.name == job then hasJob = true
|
||||||
hasJob = true
|
duty = jobinfo.onduty
|
||||||
if grade and not (grade <= jobinfo.grade.level) then hasJob = false end
|
if grade and not (grade <= jobinfo.grade.level) then hasJob = false end
|
||||||
end
|
end
|
||||||
local ganginfo = info.gang
|
local ganginfo = info.gang
|
||||||
@@ -1084,7 +1083,7 @@ function hasJob(job, source, grade) local hasJob = false
|
|||||||
print("^4ERROR^7: ^2No Core detected for hasJob() ^7- ^2Check ^3exports^1.^2lua^7")
|
print("^4ERROR^7: ^2No Core detected for hasJob() ^7- ^2Check ^3exports^1.^2lua^7")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return hasJob
|
return hasJob, duty
|
||||||
end
|
end
|
||||||
|
|
||||||
function getPlayer(source) local Player = {}
|
function getPlayer(source) local Player = {}
|
||||||
|
|||||||
Reference in New Issue
Block a user