mirror of
https://github.com/jimathy/jim_bridge.git
synced 2026-08-17 05:56:02 +01:00
changes for beta branch
This commit is contained in:
@@ -170,9 +170,4 @@ function waitForLogin()
|
|||||||
debugPrint("^6Bridge^7: ^2Player Login Detected^7.")
|
debugPrint("^6Bridge^7: ^2Player Login Detected^7.")
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--local OxPlayer = Ox.GetPlayer()
|
|
||||||
--jsonPrint(OxPlayer)
|
|
||||||
|
|
||||||
@@ -359,6 +359,10 @@ function makeItem(data)
|
|||||||
craftProp = makeProp({ prop = prop.model, coords = vec4(0, 0, 0, 0), true, true })
|
craftProp = makeProp({ prop = prop.model, coords = vec4(0, 0, 0, 0), true, true })
|
||||||
AttachEntityToEntity(craftProp, PlayerPedId(), GetPedBoneIndex(PlayerPedId(), prop.bone), prop.pos.x, prop.pos.y, prop.pos.z, prop.rot.x, prop.rot.y, prop.rot.z, true, true, false, true, 1, true)
|
AttachEntityToEntity(craftProp, PlayerPedId(), GetPedBoneIndex(PlayerPedId(), prop.bone), prop.pos.x, prop.pos.y, prop.pos.z, prop.rot.x, prop.rot.y, prop.rot.z, true, true, false, true, 1, true)
|
||||||
end
|
end
|
||||||
|
if data.sound then
|
||||||
|
local s = data.sound
|
||||||
|
PlaySoundFromEntity(s.soundId, s.audioName, PlayerPedId(), s.audioRef, true, 0)
|
||||||
|
end
|
||||||
if crafting and progressBar({
|
if crafting and progressBar({
|
||||||
label = bartext..((metadata and metadata.label) or Items[data.item].label),
|
label = bartext..((metadata and metadata.label) or Items[data.item].label),
|
||||||
time = bartime,
|
time = bartime,
|
||||||
@@ -389,6 +393,12 @@ function makeItem(data)
|
|||||||
PlaySoundFromEntity(breakId, "Drill_Pin_Break", PlayerPedId(), "DLC_HEIST_FLEECA_SOUNDSET", 1, 0)
|
PlaySoundFromEntity(breakId, "Drill_Pin_Break", PlayerPedId(), "DLC_HEIST_FLEECA_SOUNDSET", 1, 0)
|
||||||
canReturn = false
|
canReturn = false
|
||||||
end
|
end
|
||||||
|
if data.sound then
|
||||||
|
StopSound(data.sound.soundId)
|
||||||
|
end
|
||||||
|
if data.requiredItemfunc then
|
||||||
|
data.requiredItemfunc()
|
||||||
|
end
|
||||||
else
|
else
|
||||||
crafting = false
|
crafting = false
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -5,8 +5,6 @@
|
|||||||
various frameworks: QB, OX, GTA, and ESX.
|
various frameworks: QB, OX, GTA, and ESX.
|
||||||
]]
|
]]
|
||||||
|
|
||||||
local radarTable = {} -- Table to store image references for drawing text
|
|
||||||
|
|
||||||
--- Displays text on the screen using the configured draw text system.
|
--- Displays text on the screen using the configured draw text system.
|
||||||
---
|
---
|
||||||
--- Depending on Config.System.drawText, this function will use different methods to
|
--- Depending on Config.System.drawText, this function will use different methods to
|
||||||
@@ -23,7 +21,7 @@ local radarTable = {} -- Table to store image references for drawing text
|
|||||||
--- ```
|
--- ```
|
||||||
function drawText(image, input, style, oxStyleTable)
|
function drawText(image, input, style, oxStyleTable)
|
||||||
local text = ""
|
local text = ""
|
||||||
|
if not radarTable then radarTable = {} end
|
||||||
if Config.System.drawText == "qb" then
|
if Config.System.drawText == "qb" then
|
||||||
-- Concatenate lines for QB system with HTML line breaks.
|
-- Concatenate lines for QB system with HTML line breaks.
|
||||||
for i = 1, #input do
|
for i = 1, #input do
|
||||||
|
|||||||
@@ -87,33 +87,51 @@ function getPlayerInv(src)
|
|||||||
|
|
||||||
if isStarted(OXInv) then
|
if isStarted(OXInv) then
|
||||||
foundInv = OXInv
|
foundInv = OXInv
|
||||||
if src then grabInv = exports[OXInv]:GetInventoryItems(src)
|
if src then
|
||||||
else grabInv = exports[OXInv]:GetPlayerItems() end
|
grabInv = exports[OXInv]:GetInventoryItems(src)
|
||||||
|
else
|
||||||
|
grabInv = exports[OXInv]:GetPlayerItems()
|
||||||
|
end
|
||||||
|
|
||||||
elseif isStarted(QSInv) then
|
elseif isStarted(QSInv) then
|
||||||
foundInv = QSInv
|
foundInv = QSInv
|
||||||
if src then grabInv = exports[QSInv]:GetInventory(src)
|
if src then
|
||||||
else grabInv = exports[QSInv]:getUserInventory() end
|
grabInv = exports[QSInv]:GetInventory(src)
|
||||||
|
else
|
||||||
|
grabInv = exports[QSInv]:getUserInventory()
|
||||||
|
end
|
||||||
|
|
||||||
elseif isStarted(OrigenInv) then
|
elseif isStarted(OrigenInv) then
|
||||||
foundInv = OrigenInv
|
foundInv = OrigenInv
|
||||||
if src then grabInv = exports[OrigenInv]:getInventory(src)
|
if src then
|
||||||
else grabInv = exports[OrigenInv]:getInventory() end
|
grabInv = exports[OrigenInv]:getInventory(src)
|
||||||
|
else
|
||||||
|
grabInv = exports[OrigenInv]:getInventory()
|
||||||
|
end
|
||||||
|
|
||||||
elseif isStarted(CoreInv) then
|
elseif isStarted(CoreInv) then
|
||||||
foundInv = CoreInv
|
foundInv = CoreInv
|
||||||
if src then grabInv = exports[CoreInv]:getInventory(src)
|
if src then
|
||||||
else grabInv = exports[CoreInv]:getInventory() end
|
grabInv = exports[CoreInv]:getInventory(src)
|
||||||
|
else
|
||||||
|
grabInv = exports[CoreInv]:getInventory()
|
||||||
|
end
|
||||||
|
|
||||||
elseif isStarted(CodeMInv) then
|
elseif isStarted(CodeMInv) then
|
||||||
foundInv = CodeMInv
|
foundInv = CodeMInv
|
||||||
if src then grabInv = exports[CodeMInv]:GetInventory(src)
|
if src then
|
||||||
else grabInv = exports[CodeMInv]:GetClientPlayerInventory() end
|
grabInv = exports[CodeMInv]:GetInventory(src)
|
||||||
|
else
|
||||||
|
grabInv = exports[CodeMInv]:GetClientPlayerInventory()
|
||||||
|
end
|
||||||
|
|
||||||
elseif isStarted(QBInv) then
|
elseif isStarted(QBInv) then
|
||||||
foundInv = QBInv
|
foundInv = QBInv
|
||||||
if src then grabInv = Core.Functions.GetPlayer(src).PlayerData.items
|
if src then
|
||||||
else grabInv = Core.Functions.GetPlayerData().items end
|
grabInv = Core.Functions.GetPlayer(src).PlayerData.items
|
||||||
|
else
|
||||||
|
grabInv = Core.Functions.GetPlayerData().items
|
||||||
|
end
|
||||||
|
|
||||||
elseif isStarted(PSInv) then
|
elseif isStarted(PSInv) then
|
||||||
foundInv = PSInv
|
foundInv = PSInv
|
||||||
|
|||||||
@@ -19,9 +19,11 @@ local Peds = {}
|
|||||||
-- makeDistPed(pedData, pedCoords, true, false, 'WORLD_HUMAN_STAND_IMPATIENT', nil, true)
|
-- makeDistPed(pedData, pedCoords, true, false, 'WORLD_HUMAN_STAND_IMPATIENT', nil, true)
|
||||||
-- ```
|
-- ```
|
||||||
function makeDistPed(data, coords, freeze, collision, scenario, anim, synced)
|
function makeDistPed(data, coords, freeze, collision, scenario, anim, synced)
|
||||||
|
local zoneCoords = type(data) == "table" and data.coords or coords
|
||||||
|
|
||||||
createCirclePoly({
|
createCirclePoly({
|
||||||
name = keyGen()..keyGen(),
|
name = keyGen()..keyGen(),
|
||||||
coords = vec3(data.coords.x, data.coords.y, data.coords.z - 1.03),
|
coords = vec3(zoneCoords.x, zoneCoords.y, zoneCoords.z - 1.03),
|
||||||
radius = 50.0,
|
radius = 50.0,
|
||||||
onEnter = function()
|
onEnter = function()
|
||||||
Peds[#Peds + 1] = makePed(data, coords, freeze, collision, scenario, anim, synced)
|
Peds[#Peds + 1] = makePed(data, coords, freeze, collision, scenario, anim, synced)
|
||||||
|
|||||||
@@ -51,12 +51,12 @@ end
|
|||||||
--- }
|
--- }
|
||||||
--- makeDistProp(propData, true, false)
|
--- makeDistProp(propData, true, false)
|
||||||
--- ```
|
--- ```
|
||||||
function makeDistProp(data, freeze, synced)
|
function makeDistProp(data, freeze, synced, range)
|
||||||
local prop = nil
|
local prop = nil
|
||||||
createCirclePoly({
|
createCirclePoly({
|
||||||
name = keyGen()..keyGen(),
|
name = keyGen()..keyGen(),
|
||||||
coords = vec3(data.coords.x, data.coords.y, data.coords.z - 1.03),
|
coords = vec3(data.coords.x, data.coords.y, data.coords.z - 1.03),
|
||||||
radius = 50.0,
|
radius = range or 50.0,
|
||||||
onEnter = function()
|
onEnter = function()
|
||||||
prop = makeProp(data, freeze, synced)
|
prop = makeProp(data, freeze, synced)
|
||||||
end,
|
end,
|
||||||
|
|||||||
@@ -94,46 +94,73 @@ function progressBar(data)
|
|||||||
})
|
})
|
||||||
|
|
||||||
elseif Config.System.ProgressBar == "gta" then
|
elseif Config.System.ProgressBar == "gta" then
|
||||||
local wait = debugMode and 1000 or data.time
|
loadTextureDict("timerbars")
|
||||||
|
if inProgress then return false end
|
||||||
inProgress = true
|
inProgress = true
|
||||||
if not (data.dead or false) then
|
local wait = debugMode and 1000 or data.time
|
||||||
lockInv(true)
|
local endTime = GetGameTimer() + wait
|
||||||
displaySpinner(data.label)
|
local ped = PlayerPedId()
|
||||||
if data.dict then
|
|
||||||
playAnim(data.dict, data.anim, -1, (data.flag == 8 and 32 or data.flag) or nil)
|
-- Setup Animation/Task if specified
|
||||||
end
|
if data.dict then
|
||||||
if data.task then
|
playAnim(data.dict, data.anim, -1, data.flag or 32)
|
||||||
TaskStartScenarioInPlace(ped, data.task, -1, true)
|
elseif data.task then
|
||||||
end
|
TaskStartScenarioInPlace(ped, data.task, -1, true)
|
||||||
while inProgress and wait > 0 do
|
end
|
||||||
wait -= 15
|
|
||||||
local waitTimer = 0
|
-- Progress bar rendering loop
|
||||||
|
CreateThread(function()
|
||||||
|
while GetGameTimer() < endTime and inProgress do
|
||||||
|
Wait(0)
|
||||||
|
local elapsed = GetGameTimer()
|
||||||
|
local percentage = ((elapsed - (endTime - wait)) / wait) * 100
|
||||||
|
|
||||||
|
-- Convert to segmented progress (assuming 5 segments here)
|
||||||
|
local segments = 5 -- Number of segments in the bar
|
||||||
|
local segmentProgress = {}
|
||||||
|
local progressPerSegment = 100 / segments
|
||||||
|
|
||||||
|
for i = 1, segments do
|
||||||
|
local segmentStart = (i - 1) * progressPerSegment
|
||||||
|
local segmentEnd = i * progressPerSegment
|
||||||
|
if percentage >= segmentEnd then
|
||||||
|
segmentProgress[i] = 100
|
||||||
|
elseif percentage <= segmentStart then
|
||||||
|
segmentProgress[i] = 0
|
||||||
|
else
|
||||||
|
segmentProgress[i] = ((percentage - segmentStart) / progressPerSegment) * 100
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
percentage = percentage >= 100 and 100 or percentage
|
||||||
|
-- Draw your segmented progress bar
|
||||||
|
ShowGTAProgressBar(segmentProgress, data.label, ("%.0f%%"):format(percentage))
|
||||||
|
|
||||||
|
-- Controls to disable during progress
|
||||||
DisablePlayerFiring(ped, true)
|
DisablePlayerFiring(ped, true)
|
||||||
DisableControlAction(0, 25, true) -- Disable aim
|
DisableControlAction(0, 25, true) -- Disable aim
|
||||||
DisableControlAction(0, 21, true) -- Disable sprint
|
DisableControlAction(0, 21, true) -- Disable sprint
|
||||||
DisableControlAction(0, 30, true) -- Disable move left/right
|
DisableControlAction(0, 30, true) -- Disable move left/right
|
||||||
DisableControlAction(0, 31, true) -- Disable move forward/back
|
DisableControlAction(0, 31, true) -- Disable move forward/back
|
||||||
DisableControlAction(0, 36, true) -- Disable stealth
|
DisableControlAction(0, 36, true) -- Disable stealth
|
||||||
if data.cam ~= nil then
|
|
||||||
DisableControlAction(0, 1, true) -- Disable look left/right
|
if data.cancel and (IsControlJustReleased(0, 202) or IsControlJustReleased(0, 177) or IsControlJustReleased(0, 73)) then
|
||||||
DisableControlAction(0, 2, true) -- Disable look up/down
|
inProgress = false
|
||||||
DisableControlAction(0, 106, true) -- Disable vehicle mouse control
|
|
||||||
end
|
end
|
||||||
if data.cancel then
|
|
||||||
if IsControlJustReleased(0, 202) or IsControlJustReleased(0, 77) then -- Cancel key (Backspace or Delete)
|
|
||||||
inProgress = false
|
|
||||||
waitTimer = 1500
|
|
||||||
displaySpinner(Loc[Config.Lan].error["cancel"])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
Wait(waitTimer)
|
|
||||||
end
|
end
|
||||||
inProgress = false
|
end)
|
||||||
if data.dict then stopAnim(data.dict, data.anim, ped) end
|
|
||||||
ClearPedTasks(ped)
|
-- Wait for completion or cancel
|
||||||
|
while GetGameTimer() < endTime and inProgress do
|
||||||
|
Wait(100)
|
||||||
end
|
end
|
||||||
stopSpinner()
|
|
||||||
result = (wait <= 0)
|
-- Cleanup animations/tasks
|
||||||
|
if data.dict then stopAnim(data.dict, data.anim, ped) end
|
||||||
|
ClearPedTasks(ped)
|
||||||
|
|
||||||
|
result = inProgress
|
||||||
|
inProgress = false
|
||||||
end
|
end
|
||||||
|
|
||||||
while result == nil do Wait(10) end
|
while result == nil do Wait(10) end
|
||||||
@@ -141,26 +168,80 @@ function progressBar(data)
|
|||||||
-- Cleanup
|
-- Cleanup
|
||||||
FreezeEntityPosition(ped, false)
|
FreezeEntityPosition(ped, false)
|
||||||
lockInv(false)
|
lockInv(false)
|
||||||
if data.cam then stopTempCam(data.cam) end
|
if data.cam then
|
||||||
|
stopTempCam(data.cam)
|
||||||
|
end
|
||||||
if result == false and data.shared then
|
if result == false and data.shared then
|
||||||
debugPrint("^6Bridge^7: ^2Sending cancel to ^6"..storedPID.."^7")
|
debugPrint("^6Bridge^7: ^2Sending cancel to ^6"..storedPID.."^7")
|
||||||
TriggerServerEvent(getScript().."server:sharedProg:cancel", storedPID)
|
TriggerServerEvent(getScript().."server:sharedProg:cancel", storedPID)
|
||||||
end
|
end
|
||||||
storedPID = nil
|
storedPID = nil
|
||||||
|
if result == false then
|
||||||
|
currentToken = nil
|
||||||
|
TriggerServerEvent(getScript()..":clearAuthToken")
|
||||||
|
end
|
||||||
|
if result == true and data.request then
|
||||||
|
TriggerServerEvent(getScript()..":clearAuthToken")
|
||||||
|
currentToken = triggerCallback(AuthEvent)
|
||||||
|
end
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function ShowGTAProgressBar(currentProg, title, level)
|
||||||
|
local loc = vec2(0.37, 0.90)
|
||||||
|
local size = vec2(0.3, 0.03)
|
||||||
|
|
||||||
|
-- Draw background box
|
||||||
|
DrawSprite("timerbars", "all_black_bg", loc.x +0.028, loc.y-0.01, 0.15, 0.07, 0.0, 255, 255, 255, 255)
|
||||||
|
DrawSprite("timerbars", "all_black_bg", loc.x +0.170, loc.y-0.01, 0.15, 0.07, 180.0, 255, 255, 255, 255)
|
||||||
|
|
||||||
|
SetTextFont(0)
|
||||||
|
SetTextProportional(1)
|
||||||
|
SetTextScale(0.35, 0.35)
|
||||||
|
SetTextColour(255, 255, 255, 255)
|
||||||
|
SetTextDropshadow(0, 0, 0, 0, 255)
|
||||||
|
SetTextDropShadow()
|
||||||
|
SetTextOutline()
|
||||||
|
SetTextEntry("STRING")
|
||||||
|
AddTextComponentString(title)
|
||||||
|
DrawText(loc.x - size.x / 4 + 0.074, loc.y - 0.034) -- Adjust text position
|
||||||
|
|
||||||
|
SetTextFont(0)
|
||||||
|
SetTextProportional(1)
|
||||||
|
SetTextScale(0.35, 0.25)
|
||||||
|
SetTextColour(255, 255, 255, 255)
|
||||||
|
SetTextEntry("STRING")
|
||||||
|
AddTextComponentString(level)
|
||||||
|
DrawText(loc.x - size.x / 4 + 0.246, loc.y - 0.030) -- Right-aligned additional text
|
||||||
|
|
||||||
|
local segmentWidth = (size.x + 0.05) / (#currentProg * 2) -- Divide the total width by 18 (9 segments * 2 gaps for each)
|
||||||
|
local gap = segmentWidth / #currentProg -- Smaller gap between segments
|
||||||
|
|
||||||
|
for i = 1, #currentProg do
|
||||||
|
local segmentX = (loc.x - size.x / 4 ) + 0.075 + (i - 1) * (segmentWidth + gap)
|
||||||
|
local fillPercentage = currentProg[i]
|
||||||
|
local progressBarWidth = segmentWidth * (fillPercentage / 100)
|
||||||
|
|
||||||
|
-- Semi-transparent background for each segment
|
||||||
|
DrawRect(segmentX + segmentWidth / 2, loc.y, segmentWidth, size.y / 3.4, 100, 100, 100, 255)
|
||||||
|
|
||||||
|
-- Filling progress for each segment
|
||||||
|
if progressBarWidth > 0 then
|
||||||
|
DrawRect(segmentX + progressBarWidth / 2, loc.y, progressBarWidth, size.y / 3.4, 93, 182, 229, 255) -- Blue progress
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
--- Stops the current progress bar.
|
--- Stops the current progress bar.
|
||||||
---
|
---
|
||||||
--- This function cancels the progress bar based on the configured progress bar system, handling any necessary cleanup.
|
--- This function cancels the progress bar based on the configured progress bar system, handling any necessary cleanup.
|
||||||
function stopPropgressBar()
|
function stopProgressBar()
|
||||||
if Config.System.ProgressBar == "ox" then
|
if Config.System.ProgressBar == "ox" then
|
||||||
exports[OXLibExport]:cancelProgress()
|
exports[OXLibExport]:cancelProgress()
|
||||||
elseif Config.System.ProgressBar == "qb" then
|
elseif Config.System.ProgressBar == "qb" then
|
||||||
TriggerEvent("progressbar:client:cancel")
|
TriggerEvent("progressbar:client:cancel")
|
||||||
elseif Config.System.ProgressBar == "gta" then
|
elseif Config.System.ProgressBar == "gta" then
|
||||||
inProgress = false
|
inProgress = false
|
||||||
BusyspinnerOff()
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -201,9 +282,5 @@ end)
|
|||||||
--- This event is triggered when the server wants the client to cancel a shared progress bar.
|
--- This event is triggered when the server wants the client to cancel a shared progress bar.
|
||||||
RegisterNetEvent(getScript()..":client:sharedProg:Cancel", function()
|
RegisterNetEvent(getScript()..":client:sharedProg:Cancel", function()
|
||||||
debugPrint("^6Bridge^7: ^2Receiving cancel progressBar^7")
|
debugPrint("^6Bridge^7: ^2Receiving cancel progressBar^7")
|
||||||
stopPropgressBar()
|
stopProgressBar()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
--- Cleans up when the resource stops.
|
|
||||||
--- This event handler ensures that any active spinners or progress bars are stopped when the resource is stopped.
|
|
||||||
onResourceStop(function() stopSpinner() end, true)
|
|
||||||
@@ -50,10 +50,18 @@ function triggerNotify(title, message, type, src)
|
|||||||
TriggerClientEvent('ox_lib:notify', src, { title = title, description = message, type = type or "success" })
|
TriggerClientEvent('ox_lib:notify', src, { title = title, description = message, type = type or "success" })
|
||||||
end
|
end
|
||||||
elseif Config.System.Notify == "gta" then
|
elseif Config.System.Notify == "gta" then
|
||||||
if not src then
|
if isStarted("jim-gtaui") then
|
||||||
TriggerEvent(getScript()..":DisplayGTANotify", title, message)
|
if not src then
|
||||||
|
TriggerEvent("jim-gtaui:Notify", title, message, type)
|
||||||
|
else
|
||||||
|
TriggerClientEvent("jim-gtaui:Notify", src, title, message, type)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
TriggerClientEvent(getScript()..":DisplayGTANotify", src, title, message)
|
if not src then
|
||||||
|
TriggerEvent(getScript()..":DisplayGTANotify", title, message)
|
||||||
|
else
|
||||||
|
TriggerClientEvent(getScript()..":DisplayGTANotify", src, title, message)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
elseif Config.System.Notify == "esx" then
|
elseif Config.System.Notify == "esx" then
|
||||||
if not src then
|
if not src then
|
||||||
|
|||||||
@@ -154,7 +154,10 @@ end
|
|||||||
function chargePlayer(cost, moneyType, newsrc)
|
function chargePlayer(cost, moneyType, newsrc)
|
||||||
local src = newsrc or source
|
local src = newsrc or source
|
||||||
local fundResource = ""
|
local fundResource = ""
|
||||||
|
if cost < 0 then
|
||||||
|
debugPrint("^1Error^7: ^7SRC: ^3"..src.." ^2Tried to charge a minus value^7", cost)
|
||||||
|
return
|
||||||
|
end
|
||||||
if moneyType == "cash" then
|
if moneyType == "cash" then
|
||||||
if isStarted(OXInv) then fundResource = OXInv
|
if isStarted(OXInv) then fundResource = OXInv
|
||||||
exports[OXInv]:RemoveItem(src, "money", cost)
|
exports[OXInv]:RemoveItem(src, "money", cost)
|
||||||
@@ -177,7 +180,14 @@ function chargePlayer(cost, moneyType, newsrc)
|
|||||||
debugPrint("^6Bridge^7: ^2Charging ^2Player^7: '^6"..cost.."^7'", moneyType, fundResource)
|
debugPrint("^6Bridge^7: ^2Charging ^2Player^7: '^6"..cost.."^7'", moneyType, fundResource)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
RegisterNetEvent(getScript()..":server:ChargePlayer", chargePlayer)
|
RegisterNetEvent(getScript()..":server:ChargePlayer", function(cost, moneyType, newsrc)
|
||||||
|
debugPrint(GetInvokingResource())
|
||||||
|
if GetInvokingResource() and GetInvokingResource() ~= getScript() and GetInvokingResource() ~= "qb-core" then
|
||||||
|
debugPrint("^1Error^7: ^1Possible exploit^7, ^1vital function was called from an external resource^7")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
chargePlayer(cost, moneyType, newsrc)
|
||||||
|
end)
|
||||||
|
|
||||||
--- Funds a player by adding money to their account.
|
--- Funds a player by adding money to their account.
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
|
local activeSkillCheck = false
|
||||||
|
|
||||||
function skillCheck(data)
|
function skillCheck(data)
|
||||||
local result = false
|
local result = false
|
||||||
@@ -29,8 +29,128 @@ function skillCheck(data)
|
|||||||
else
|
else
|
||||||
result = false
|
result = false
|
||||||
end
|
end
|
||||||
|
elseif Config.System.skillCheck == "gta" then
|
||||||
|
loadTextureDict("timerbars")
|
||||||
|
local successes = 0
|
||||||
|
local barsRequired = 3
|
||||||
|
|
||||||
|
for bar = 1, barsRequired do
|
||||||
|
debugPrint("^6Bridge^7: ^2Starting Bar ^3"..bar.."^7/^3"..barsRequired.."^7")
|
||||||
|
activeSkillCheck = true
|
||||||
|
local width, height = 0.2, 0.01
|
||||||
|
local x, y = 0.5, 0.8
|
||||||
|
|
||||||
|
-- Random highlighted zone
|
||||||
|
local highlightSize = math.random(10, 20) / 100
|
||||||
|
local highlightStart = math.random(10, 50) / 100
|
||||||
|
local highlightEnd = highlightStart + highlightSize
|
||||||
|
local highlightAlpha = 0
|
||||||
|
local cursorPos = 0.0
|
||||||
|
local cursorSpeed = 0.025
|
||||||
|
local movingRight = true
|
||||||
|
|
||||||
|
while activeSkillCheck do
|
||||||
|
Wait(0)
|
||||||
|
makeInstructionalButtons({
|
||||||
|
{ keys = { 177 }, text = "Exit" },
|
||||||
|
{ keys = { 38 }, text = "Confirm" },
|
||||||
|
})
|
||||||
|
|
||||||
|
createScaleBars(x, y, width, height)
|
||||||
|
|
||||||
|
local pulse = (math.sin(GetGameTimer() / 250) + 1) / 2 -- Creates a pulsing effect
|
||||||
|
highlightAlpha = math.floor(150 + (pulse * 105)) -- Pulsing between 150 and 255 alpha
|
||||||
|
|
||||||
|
-- Draw highlighted zone (success area) with pulsing effect
|
||||||
|
DrawRect(x - width / 2 + (highlightStart + highlightSize / 2) * width, y, highlightSize * width, height+0.001, 93, 182, 229, highlightAlpha )
|
||||||
|
-- Draw moving cursor
|
||||||
|
DrawRect(x - width / 2 + cursorPos * width, y, 0.002, height + 0.01, 255, 255, 255, 255)
|
||||||
|
|
||||||
|
-- Move cursor
|
||||||
|
if movingRight then
|
||||||
|
cursorPos += cursorSpeed
|
||||||
|
if cursorPos >= 1.0 then movingRight = false end
|
||||||
|
else
|
||||||
|
cursorPos -= cursorSpeed
|
||||||
|
if cursorPos <= 0.0 then movingRight = true end
|
||||||
|
end
|
||||||
|
|
||||||
|
if IsControlJustPressed(0, 177) then -- Backspace to cancel
|
||||||
|
local displayTime = GetGameTimer() + 2000
|
||||||
|
PlaySoundFrontend(-1, 'Highlight_Cancel', 'DLC_HEIST_PLANNING_BOARD_SOUNDS', 1)
|
||||||
|
while GetGameTimer() < displayTime do
|
||||||
|
Wait(0)
|
||||||
|
|
||||||
|
createScaleBars(x, y, width, height)
|
||||||
|
|
||||||
|
DrawRect(x - width / 2 + (highlightStart + highlightSize / 2) * width, y, highlightSize * width, height+0.001, 228, 52, 52, 255)
|
||||||
|
DrawRect(x - width / 2 + cursorPos * width, y, 0.002, height + 0.01, 255, 255, 255, 255)
|
||||||
|
|
||||||
|
drawSuccessText(x, y, "Failed", 228, 52, 52)
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Check for keypress (E)
|
||||||
|
if IsControlJustPressed(0, 38) then
|
||||||
|
activeSkillCheck = false
|
||||||
|
result = cursorPos >= highlightStart and cursorPos <= highlightEnd
|
||||||
|
if result then
|
||||||
|
PlaySoundFrontend(-1, "YES", "HUD_FRONTEND_DEFAULT_SOUNDSET", true)
|
||||||
|
else
|
||||||
|
PlaySoundFrontend(-1, 'Highlight_Cancel', 'DLC_HEIST_PLANNING_BOARD_SOUNDS', 1)
|
||||||
|
end
|
||||||
|
local displayTime = GetGameTimer() + 2000
|
||||||
|
while GetGameTimer() < displayTime do
|
||||||
|
Wait(0)
|
||||||
|
|
||||||
|
createScaleBars(x, y, width, height)
|
||||||
|
|
||||||
|
-- Draw highlighted zone
|
||||||
|
DrawRect(x - width / 2 + (highlightStart + highlightSize / 2) * width, y, highlightSize * width, height+0.001, result and 93 or 228, result and 182 or 52, result and 229 or 52, 180)
|
||||||
|
|
||||||
|
-- Draw stationary cursor at result position
|
||||||
|
DrawRect(x - width / 2 + cursorPos * width, y, 0.002, height + 0.01, 255, 255, 255, 255)
|
||||||
|
-- Display result text
|
||||||
|
drawSuccessText(x, y, result and "Success" or "Failed", result and 114 or 228, result and 204 or 52, result and 144 or 52)
|
||||||
|
end
|
||||||
|
if result then
|
||||||
|
successes += 1
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
activeSkillCheck = false
|
||||||
|
debugPrint("^6Bridge^7: ^2Skill Check Result^7: ^3" .. successes .. "^7/^3" .. barsRequired.."^7")
|
||||||
|
return successes == barsRequired
|
||||||
else
|
else
|
||||||
result = true
|
result = true
|
||||||
end
|
end
|
||||||
return result
|
return result
|
||||||
|
end
|
||||||
|
|
||||||
|
function drawSuccessText(x, y, text, r, g, b)
|
||||||
|
SetTextFont(8)
|
||||||
|
SetTextScale(0.45, 0.45)
|
||||||
|
SetTextColour(r, g, b, 255)
|
||||||
|
SetTextDropshadow(0, 0, 0, 0, 255)
|
||||||
|
SetTextEdge(2, 0, 0, 0, 150)
|
||||||
|
SetTextDropShadow()
|
||||||
|
SetTextOutline()
|
||||||
|
SetTextCentre(true)
|
||||||
|
SetTextEntry("STRING")
|
||||||
|
SetTextCentre(true)
|
||||||
|
SetTextEntry("STRING")
|
||||||
|
AddTextComponentString(text)
|
||||||
|
DrawText(x, y + 0.03)
|
||||||
|
end
|
||||||
|
|
||||||
|
function createScaleBars(x, y, width, height)
|
||||||
|
-- Draw background box
|
||||||
|
DrawSprite("timerbars", "all_black_bg", x - (width / 4) - 0.006, y, (width / 2) + 0.08, height + 0.04, 0.0, 255, 255, 255, 255)
|
||||||
|
DrawSprite("timerbars", "all_black_bg", x + (width / 4) + 0.006, y, (width / 2) + 0.08, height + 0.04, 180.0, 255, 255, 255, 255)
|
||||||
|
-- Draw full bar (dark background)
|
||||||
|
DrawRect(x, y, width, height, 100, 100, 100, 255)
|
||||||
end
|
end
|
||||||
@@ -169,7 +169,7 @@ end
|
|||||||
--- name = 'storageBox',
|
--- name = 'storageBox',
|
||||||
--- heading = 100.0,
|
--- heading = 100.0,
|
||||||
--- debugPoly = true,
|
--- debugPoly = true,
|
||||||
--- minZ = 27.0
|
--- minZ = 27.0,
|
||||||
--- maxZ = 32.0,
|
--- maxZ = 32.0,
|
||||||
--- },
|
--- },
|
||||||
--- },
|
--- },
|
||||||
@@ -388,7 +388,7 @@ function createModelTarget(models, opts, dist)
|
|||||||
end
|
end
|
||||||
exports[OXTargetExport]:addModel(models, options)
|
exports[OXTargetExport]:addModel(models, options)
|
||||||
elseif isStarted(QBTargetExport) then
|
elseif isStarted(QBTargetExport) then
|
||||||
debugPrint("^6Bridge^7: ^2Creating new ^3Entity^2 target with ^6"..QBTargetExport)
|
debugPrint("^6Bridge^7: ^2Creating new ^3Model^2 target with ^6"..QBTargetExport)
|
||||||
local options = { options = opts, distance = dist }
|
local options = { options = opts, distance = dist }
|
||||||
exports[QBTargetExport]:AddTargetModel(models, options)
|
exports[QBTargetExport]:AddTargetModel(models, options)
|
||||||
end
|
end
|
||||||
@@ -439,6 +439,25 @@ function removeZoneTarget(target)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Removes a previously created model target.
|
||||||
|
---
|
||||||
|
--- @param model table The model ID whose target should be removed.
|
||||||
|
---
|
||||||
|
--- @usage
|
||||||
|
--- ```lua
|
||||||
|
--- removeModelTarget(model)
|
||||||
|
--- ```
|
||||||
|
function removeModelTarget(model)
|
||||||
|
if isStarted(QBTargetExport) then
|
||||||
|
exports[QBTargetExport]:RemoveTargetModel(model, "Test")
|
||||||
|
end
|
||||||
|
if isStarted(OXTargetExport) then
|
||||||
|
exports[OXTargetExport]:removeModel(model, nil)
|
||||||
|
end
|
||||||
|
if Config.System.DontUseTarget or (not isStarted(OXTargetExport) and not isStarted(QBTargetExport)) then
|
||||||
|
TextTargets[entity] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
-------------------------------------------------------------
|
-------------------------------------------------------------
|
||||||
-- Fallback: DrawText3D Targets (Experimental)
|
-- Fallback: DrawText3D Targets (Experimental)
|
||||||
-------------------------------------------------------------
|
-------------------------------------------------------------
|
||||||
@@ -455,12 +474,20 @@ if (Config.System.DontUseTarget or (not isStarted(OXTargetExport) and not isStar
|
|||||||
local closestTarget = nil
|
local closestTarget = nil
|
||||||
local closestDist = math.huge
|
local closestDist = math.huge
|
||||||
|
|
||||||
|
-- Create a shallow copy of TextTargets
|
||||||
|
local targetsCopy = {}
|
||||||
|
for k, target in pairs(TextTargets) do
|
||||||
|
targetsCopy[k] = target
|
||||||
|
end
|
||||||
|
|
||||||
-- Identify the closest target in front of the camera.
|
-- Identify the closest target in front of the camera.
|
||||||
for _, target in pairs(TextTargets) do
|
for _, target in pairs(targetsCopy) do
|
||||||
local dist = #(pedCoords - target.coords)
|
local dist = #(pedCoords - target.coords)
|
||||||
local vecToTarget = target.coords - camCoords
|
local vecToTarget = target.coords - camCoords
|
||||||
local vecToTargetNormalized = normalizeVector(vecToTarget)
|
local vecToTargetNormalized = normalizeVector(vecToTarget)
|
||||||
local dot = camForwardVector.x * vecToTargetNormalized.x + camForwardVector.y * vecToTargetNormalized.y + camForwardVector.z * vecToTargetNormalized.z
|
local dot = camForwardVector.x * vecToTargetNormalized.x +
|
||||||
|
camForwardVector.y * vecToTargetNormalized.y +
|
||||||
|
camForwardVector.z * vecToTargetNormalized.z
|
||||||
local isFacingTarget = dot > 0.5 -- Threshold for facing target.
|
local isFacingTarget = dot > 0.5 -- Threshold for facing target.
|
||||||
|
|
||||||
if dist <= target.dist and isFacingTarget then
|
if dist <= target.dist and isFacingTarget then
|
||||||
@@ -472,7 +499,7 @@ if (Config.System.DontUseTarget or (not isStarted(OXTargetExport) and not isStar
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Render the DrawText3D targets and listen for key presses.
|
-- Render the DrawText3D targets and listen for key presses.
|
||||||
for _, target in pairs(TextTargets) do
|
for _, target in pairs(targetsCopy) do
|
||||||
local isClosest = (target == closestTarget)
|
local isClosest = (target == closestTarget)
|
||||||
if #(pedCoords - target.coords) <= target.dist then
|
if #(pedCoords - target.coords) <= target.dist then
|
||||||
for i = 1, #target.options do
|
for i = 1, #target.options do
|
||||||
@@ -481,9 +508,12 @@ if (Config.System.DontUseTarget or (not isStarted(OXTargetExport) and not isStar
|
|||||||
if target.options[i].action then target.options[i].action() end
|
if target.options[i].action then target.options[i].action() end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
DrawText3D(vec3(target.coords.x, target.coords.y, target.coords.z + 0.7), concatenateText(target.buttontext), isClosest)
|
DrawText3D(vec3(target.coords.x, target.coords.y, target.coords.z + 0.7),
|
||||||
|
concatenateText(target.buttontext),
|
||||||
|
isClosest)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Wait(0)
|
Wait(0)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -73,37 +73,6 @@ function registerStash(name, label, slots, weight, owner, coords)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Registers a shop with the active inventory system.
|
|
||||||
--- Supports either OXInv or QBInv (with QBInvNew flag).
|
|
||||||
---
|
|
||||||
--- @param name string Unique shop identifier.
|
|
||||||
--- @param label string Display name for the shop.
|
|
||||||
--- @param items table List of available shop items.
|
|
||||||
--- @param society string|nil (Optional) Society identifier for shared shops.
|
|
||||||
--- @usage
|
|
||||||
--- ```lua
|
|
||||||
--- registerShop("weaponShop", "Weapon Shop", weaponItems, "society_weapons")
|
|
||||||
--- ```
|
|
||||||
function registerShop(name, label, items, society)
|
|
||||||
if isStarted(OXInv) then
|
|
||||||
debugPrint("^6Bridge^7: ^2Registering ^3OX ^2Store^7:", name, label)
|
|
||||||
exports[OXInv]:RegisterShop(name, {
|
|
||||||
name = label,
|
|
||||||
inventory = items,
|
|
||||||
society = society,
|
|
||||||
})
|
|
||||||
elseif isStarted(QBInv) and QBInvNew then
|
|
||||||
debugPrint("^6Bridge^7: ^2Registering ^3QB ^2Store^7:", name, label)
|
|
||||||
exports[QBInv]:CreateShop({
|
|
||||||
name = name,
|
|
||||||
label = label,
|
|
||||||
slots = #items,
|
|
||||||
items = items,
|
|
||||||
society = society,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if isServer() then
|
if isServer() then
|
||||||
--- Registers an event to create an OX stash from the server.
|
--- Registers an event to create an OX stash from the server.
|
||||||
--- When triggered, it calls registerStash with the provided parameters.
|
--- When triggered, it calls registerStash with the provided parameters.
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
2.0
|
1.2
|
||||||
|
|||||||
Reference in New Issue
Block a user