Compare commits

..

16 Commits
v1.0 ... v1.0.2

Author SHA1 Message Date
Jim Shield
61e0d777a8 Attempt to fix ox_lib's setVehicleProperites + 1.0.2 2024-01-18 20:21:22 +00:00
Jim Shield
78c3e33d38 version bump 1.0.1 2024-01-18 17:50:42 +00:00
Jim Shield
3be5b5e1ee Merge pull request #6 from jimathy/1.0.1
1.0.1
2024-01-18 17:49:05 +00:00
Jim Shield
f550479298 Revert "version bump"
This reverts commit d82366b59f.
2024-01-18 17:48:14 +00:00
Jim Shield
5fe0ab8815 Revert "Resolve merge conflict"
This reverts commit 56ccb43c2b.
2024-01-18 17:48:03 +00:00
Jim Shield
56ccb43c2b Resolve merge conflict 2024-01-18 17:44:25 +00:00
Jim Shield
93d0754935 Make qbx use correct export for getCoreObject
This should be fine as qbox takes over the export but just to be sure
2024-01-18 17:41:28 +00:00
Jim Shield
d82366b59f version bump 2024-01-18 15:38:28 +00:00
Jim Shield
35202f7000 add fix for recipes having no final amount added 2024-01-18 15:33:51 +00:00
Jim Shield
bc5aadc394 add export error check to stashRemoveItem 2024-01-18 15:14:38 +00:00
Jim Shield
181c480ba6 return duty check for hasJob 2024-01-18 15:06:20 +00:00
Jim Shield
b973c71638 Update version.txt(?) 2024-01-18 14:45:41 +00:00
Jim Shield
ede0a44251 fix version.txt? 2024-01-18 14:42:23 +00:00
Jim Shield
e4b0f8601a fix bridge version check looking in wrong place 2024-01-18 14:17:01 +00:00
Jim Shield
d12c615f0b Merge pull request #4 from jimathy/duty-fixes
Duty fixes + CheckVersion + better debug
2024-01-18 13:16:45 +00:00
Jim Shield
e58163d631 CheckVersion supports free script checking 2024-01-18 13:08:16 +00:00
5 changed files with 52 additions and 23 deletions

View File

@@ -39,6 +39,7 @@ function craftingMenu(data) local hasjob = false
for i = 1, #Recipes do
for k, v in pairs(Recipes[i]) do
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
for l, b in pairs(Recipes[i].job) do
hasjob = hasJob(l, nil, b)
@@ -456,7 +457,7 @@ function stashRemoveItem(stashItems, stashName, items) local amount = amount and
if Config.System.Debug then
print("^6Bridge^7: ^3saveStash^7: ^2Saving ^3QB^2 stash ^7'^6"..stashName.."^7'")
end
else
elseif GetResourceState(QBInv):find("start") then
for k, v in pairs(items) do
for l in pairs(stashItems) do
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'")
end
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
RegisterNetEvent(GetCurrentResourceName()..":server:stashRemoveItem", stashRemoveItem)

View File

@@ -654,12 +654,21 @@ end
local function CheckVersion()
if IsDuplicityVersion() then
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 print("Currently unable to run a version check.") return end
local currentVersion = "^3"..GetResourceMetadata(GetCurrentResourceName(), 'version'):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(newestVersion == currentVersion and '^6You are running the latest version.^7 ('..currentVersion..')' or "^1You are currently running an outdated version^7, ^1please update^7!")
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"
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!")
end
end)
end
end
@@ -854,4 +863,4 @@ function StopEffects() -- Used to clear up any effects stuck on screen
AnimpostfxStop('RaceTurbo')
AnimpostfxStop('FocusIn')
AnimpostfxStop('Rampage')
end
end

View File

@@ -1,6 +1,6 @@
name "Jim_Bridge"
author "Jimathy"
version "1.0"
version "1.0.2"
description "Framework Bridge By Jimathy"
fx_version "cerulean"
game "gta5"

View File

@@ -1 +1 @@
1.0
1.0.2

View File

@@ -21,7 +21,7 @@ OXTargetExport = Exports and Exports.OXTargetExport or ""
function CheckBridgeVersion()
if IsDuplicityVersion() then
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
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!")
@@ -560,12 +560,7 @@ if not GetResourceState(OXTargetExport):find("start") and not GetResourceState(Q
local pedCoords = GetEntityCoords(PlayerPedId())
for k, v in pairs (TextTargets) do
if #(pedCoords - v.coords) <= v.dist then
DrawText3D(
v.coords.x,
v.coords.y,
v.coords.z + 1.0,
v.buttontext
)
DrawText3D(v.coords.x, v.coords.y, v.coords.z + 1.0, v.buttontext)
for i = 1, #v.options do
if IsControlJustPressed(0, v.options[i].key) then
if v.options[i].onSelect then v.options[i].onSelect() end
@@ -740,7 +735,6 @@ function onPlayerLoaded(func)
end
end
-- INPUT --
function createInput(title, opts)
local dialog = nil
@@ -943,12 +937,30 @@ function setVehicleProperties(vehicle, props)
format(vehicle))
end
if GetResourceState(OXLibExport):find("start") then
lib.setVehicleProperties(vehicle, props)
TriggerServerEvent(GetCurrentResourceName()..":ox:setVehicleProperties", VehToNet(vehicle), props)
elseif GetResourceState(QBExport):find("start") then
Core.Functions.SetVehicleProperties(vehicle, props)
end
end
RegisterNetEvent(GetCurrentResourceName()..":ox:setVehicleProperties", function(netId, props)
local vehicle = NetworkGetEntityFromNetworkId(netId)
local value = props
Entity(vehicle).state[GetCurrentResourceName()..':setVehicleProperties'] = value
end)
AddStateBagChangeHandler(GetCurrentResourceName()..':setVehicleProperties', '', function(bagName, _, value)
if not value or not GetEntityFromStateBagName then return end
local entity = GetEntityFromStateBagName(bagName)
local networked = not bagName:find('localEntity')
if networked and NetworkGetEntityOwner(entity) ~= cache.playerId then return end
if lib.setVehicleProperties(entity, value) then
Entity(entity).state:set('setVehicleProperties', nil, true)
end
end)
RegisterNetEvent(GetCurrentResourceName()..":server:ChargePlayer", function(cost, type) local src = source
if Config.System.Debug then print("^6Bridge^7: ^2Charging ^2Player: '^6"..cost.."^7'", type) end
if type == "cash" then
@@ -990,7 +1002,7 @@ function createUseableItem(item, funct)
end
end
function hasJob(job, source, grade) local hasJob = false
function hasJob(job, source, grade) local hasJob, duty = false, true
if source then
local src = tonumber(source)
if GetResourceState(ESXExport):find("start") then
@@ -1012,16 +1024,19 @@ function hasJob(job, source, grade) local hasJob = false
elseif GetResourceState(QBXExport):find("start") then
local jobinfo = exports[QBXExport]:GetPlayer(src).PlayerData.job
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
end
local ganginfo = exports[QBXExport]:GetPlayer(src).PlayerData.gang
if ganginfo.name == job then hasJob = true
if grade and not (grade <= ganginfo.grade.level) then hasJob = false end
end
elseif GetResourceState(QBExport):find("start") and not GetResourceState(QBXExport):find("start") then
if Core.Functions.GetPlayer then -- support older qb-core functions
local jobinfo = Core.Functions.GetPlayer(src).PlayerData.job
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
end
local ganginfo = Core.Functions.GetPlayer(src).PlayerData.gang
@@ -1031,6 +1046,7 @@ function hasJob(job, source, grade) local hasJob = false
else -- support newer qb-core exports
local jobinfo = exports[QBExport]:GetPlayer(src).PlayerData.job
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
end
local ganginfo = exports[QBExport]:GetPlayer(src).PlayerData.gang
@@ -1059,6 +1075,7 @@ function hasJob(job, source, grade) local hasJob = false
elseif GetResourceState(QBXExport):find("start") then
local jobinfo = QBX.PlayerData.job
if jobinfo.name == job then hasJob = true
duty = QBX.PlayerData.job.onduty
if grade and not (grade <= jobinfo.grade.level) then hasJob = false end
end
local ganginfo = QBX.PlayerData.gang
@@ -1071,8 +1088,8 @@ function hasJob(job, source, grade) local hasJob = false
info = PlayerData
end)
local jobinfo = info.job
if jobinfo.name == job then
hasJob = true
if jobinfo.name == job then hasJob = true
duty = jobinfo.onduty
if grade and not (grade <= jobinfo.grade.level) then hasJob = false end
end
local ganginfo = info.gang
@@ -1084,7 +1101,7 @@ function hasJob(job, source, grade) local hasJob = false
print("^4ERROR^7: ^2No Core detected for hasJob() ^7- ^2Check ^3exports^1.^2lua^7")
end
end
return hasJob
return hasJob, duty
end
function getPlayer(source) local Player = {}
@@ -1214,4 +1231,4 @@ function registerStash(name, label)
exports[QSInv]:RegisterStash(name, 50, 4000000)
end
end
-- IN NO WAY PERFECT --
-- IN NO WAY PERFECT --