mirror of
https://github.com/jimathy/jim_bridge.git
synced 2026-08-17 14:06:02 +01:00
Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
02c202d075 | ||
|
|
9e9fb14f55 | ||
|
|
61e0d777a8 | ||
|
|
78c3e33d38 | ||
|
|
3be5b5e1ee | ||
|
|
f550479298 | ||
|
|
5fe0ab8815 | ||
|
|
56ccb43c2b | ||
|
|
93d0754935 | ||
|
|
d82366b59f | ||
|
|
35202f7000 | ||
|
|
bc5aadc394 | ||
|
|
181c480ba6 | ||
|
|
b973c71638 | ||
|
|
ede0a44251 | ||
|
|
e4b0f8601a | ||
|
|
d12c615f0b | ||
|
|
e58163d631 | ||
|
|
63c2d5d83d |
@@ -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)
|
||||
@@ -379,7 +380,7 @@ function openStash(data)
|
||||
exports[CodeMInv]:OpenStash(data.stash, 400000, 100)
|
||||
else
|
||||
TriggerEvent("inventory:client:SetCurrentStash", data.stash)
|
||||
TriggerServerEvent("inventory:server:OpenInventory", "stash", data.stash)
|
||||
TriggerServerEvent("inventory:server:OpenInventory", "stash", data.stash, data.stashOptions)
|
||||
end
|
||||
lookEnt(data.coords)
|
||||
end
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
@@ -1,6 +1,6 @@
|
||||
name "Jim_Bridge"
|
||||
author "Jimathy"
|
||||
version "1.0"
|
||||
version "1.0.3"
|
||||
description "Framework Bridge By Jimathy"
|
||||
fx_version "cerulean"
|
||||
game "gta5"
|
||||
|
||||
@@ -1 +1 @@
|
||||
1.0
|
||||
1.0.3
|
||||
|
||||
45
wrapper.lua
45
wrapper.lua
@@ -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 --
|
||||
Reference in New Issue
Block a user