mirror of
https://github.com/jimathy/jim_bridge.git
synced 2026-08-17 05:56:02 +01:00
Compare commits
2 Commits
c040390d1f
...
0bc3c0f9b4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0bc3c0f9b4 | ||
|
|
672dd7684b |
@@ -7,14 +7,22 @@ AuthEvent = nil
|
|||||||
currentToken = nil
|
currentToken = nil
|
||||||
if isServer() then
|
if isServer() then
|
||||||
|
|
||||||
|
local excludeRes = {
|
||||||
|
[Exports.QBExport] = true,
|
||||||
|
[Exports.ESXExport] = true,
|
||||||
|
[Exports.VorpExport] = true,
|
||||||
|
}
|
||||||
|
|
||||||
local AuthEvent = getScript()..":"..keyGen()..keyGen()..keyGen()..keyGen()..":"..keyGen()..keyGen()..keyGen()..keyGen()
|
local AuthEvent = getScript()..":"..keyGen()..keyGen()..keyGen()..keyGen()..":"..keyGen()..keyGen()..keyGen()..keyGen()
|
||||||
validTokens = validTokens or {}
|
validTokens = validTokens or {}
|
||||||
|
|
||||||
createCallback(AuthEvent, function(source)
|
createCallback(AuthEvent, function(source)
|
||||||
local src = source
|
local src = source
|
||||||
local token = keyGen()..keyGen()..keyGen()..keyGen() -- Use a secure random generator here
|
local token = keyGen()..keyGen()..keyGen()..keyGen() -- Use a secure random generator here
|
||||||
--debugPrint(GetInvokingResource())
|
local invokingRes = GetInvokingResource()
|
||||||
if GetInvokingResource() and GetInvokingResource() ~= getScript() and GetInvokingResource() ~= Exports.QBExport and GetInvokingResource() ~= Exports.VorpExport then
|
|
||||||
|
debugPrint(invokingRes)
|
||||||
|
if invokingRes and invokingRes ~= getScript() and not excludeRes[invokingRes] then
|
||||||
debugPrint("^1Error^7: ^1Possible exploit^7, ^1vital function was called from an external resource^7")
|
debugPrint("^1Error^7: ^1Possible exploit^7, ^1vital function was called from an external resource^7")
|
||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
@@ -47,9 +55,9 @@ if isServer() then
|
|||||||
|
|
||||||
createCallback(getScript()..":callback:GetAuthEvent", function(source)
|
createCallback(getScript()..":callback:GetAuthEvent", function(source)
|
||||||
local src = source
|
local src = source
|
||||||
--debugPrint(GetInvokingResource())
|
local invokingRes = GetInvokingResource()
|
||||||
|
|
||||||
if GetInvokingResource() and GetInvokingResource() ~= getScript() and GetInvokingResource() ~= Exports.QBExport and GetInvokingResource() ~= Exports.VorpExport then
|
if invokingRes and invokingRes ~= getScript() and not excludeRes[invokingRes] then
|
||||||
debugPrint("^1Error^7: ^1Possible exploit^7, ^1vital callback was called from an external resource^7")
|
debugPrint("^1Error^7: ^1Possible exploit^7, ^1vital callback was called from an external resource^7")
|
||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1338,10 +1338,12 @@ end
|
|||||||
--- ```
|
--- ```
|
||||||
function getPlayerInv(src)
|
function getPlayerInv(src)
|
||||||
local grabInv = nil
|
local grabInv = nil
|
||||||
|
local foundInv = ""
|
||||||
|
|
||||||
for i = 1, #InvFunc do
|
for i = 1, #InvFunc do
|
||||||
local inv = InvFunc[i]
|
local inv = InvFunc[i]
|
||||||
if isStarted(inv.invName) then
|
if isStarted(inv.invName) then
|
||||||
|
foundInv = inv.invName
|
||||||
grabInv = inv.getPlayerInv(src)
|
grabInv = inv.getPlayerInv(src)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
@@ -1364,6 +1366,7 @@ function getPlayerInv(src)
|
|||||||
grabInv = xPlayer and xPlayer.inventory or {}
|
grabInv = xPlayer and xPlayer.inventory or {}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
--jsonPrint(grabInv)
|
||||||
end
|
end
|
||||||
|
|
||||||
if grabInv == nil then
|
if grabInv == nil then
|
||||||
@@ -1958,7 +1961,7 @@ function getCurrentInvWeight(src)
|
|||||||
if weight == 0 then
|
if weight == 0 then
|
||||||
local itemcheck = getPlayerInv(src)
|
local itemcheck = getPlayerInv(src)
|
||||||
for _, v in pairs(itemcheck) do
|
for _, v in pairs(itemcheck) do
|
||||||
weight += ((v.weight * v.amount) or 0)
|
weight += ((v.weight * (v.amount or v.count)) or 0)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return weight
|
return weight
|
||||||
@@ -2356,6 +2359,8 @@ function stashRemoveItem(stashItems, stashName, items)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Fallback to core functions
|
||||||
if isStarted(QBExport) then
|
if isStarted(QBExport) then
|
||||||
local stashItems = getStash(stashName[1])
|
local stashItems = getStash(stashName[1])
|
||||||
for k, v in pairs(items) do
|
for k, v in pairs(items) do
|
||||||
@@ -2382,6 +2387,10 @@ function stashRemoveItem(stashItems, stashName, items)
|
|||||||
end
|
end
|
||||||
RegisterNetEvent(getScript()..":server:stashRemoveItem", stashRemoveItem)
|
RegisterNetEvent(getScript()..":server:stashRemoveItem", stashRemoveItem)
|
||||||
|
|
||||||
|
function stashAddItem(stashItems, stashName, items)
|
||||||
|
-- wip
|
||||||
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------
|
-------------------------------------------------------------
|
||||||
-- Stash Item Availability Check
|
-- Stash Item Availability Check
|
||||||
-------------------------------------------------------------
|
-------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user