128 lines
4.6 KiB
Lua
128 lines
4.6 KiB
Lua
vRP = nil
|
|
|
|
if Config.Notifications.Enabled and Config.Notifications.Framework.vRP then
|
|
local Tunnel = module("vrp", "lib/Tunnel")
|
|
local Proxy = module("vrp", "lib/Proxy")
|
|
vRP = Proxy.getInterface("vRP")
|
|
end
|
|
|
|
if Config.Notifications.Enabled and Config.Notifications.Framework.ESX then
|
|
ESX = exports["es_extended"]:getSharedObject()
|
|
end
|
|
|
|
if Config.EnablePositioningCommand then
|
|
TriggerEvent('chat:addSuggestion', '/'.."findhosepositioning", "Find positioning of the SCBA offsets on your vehicle")
|
|
|
|
RegisterCommand("findhosepositioning", function(source, args)
|
|
|
|
local ped = PlayerPedId()
|
|
local targetVehicle = GetVehiclePedIsIn(ped, false)
|
|
|
|
if targetVehicle == nil or targetVehicle == 0 then
|
|
Notify("No vehicle found!")
|
|
else
|
|
local model = `prop_poolball_8`
|
|
SetEntityAlpha(targetVehicle, 150, false)
|
|
RequestModel(model)
|
|
while not HasModelLoaded(model) do Wait(0) end
|
|
local ballProp = CreateObject(model, coords, false, false, false)
|
|
|
|
while not DoesEntityExist(ballProp) do Wait(0) end
|
|
|
|
SetModelAsNoLongerNeeded(model)
|
|
local offSet = {0.0, 0.0, 0.0}
|
|
local rotation = {0.0, 0.0, 0.0}
|
|
local offSetComplete = false
|
|
while not offSetComplete do
|
|
if targetVehicle ~= nil and targetVehicle ~= 0 then
|
|
DetachEntity(ballProp, true, false)
|
|
AttachEntityToEntity(ballProp, targetVehicle, -1, offSet[1], offSet[2], offSet[3], rotation[1], rotation[2], rotation[3], true, false, true, false, 1, true)
|
|
if not IsControlReleased(0, Config.PositioningControls.down) then --page down
|
|
offSet = {offSet[1], offSet[2], offSet[3] - 0.01}
|
|
end
|
|
|
|
if not IsControlReleased(0, Config.PositioningControls.up) then --page up
|
|
offSet = {offSet[1], offSet[2], offSet[3] + 0.01}
|
|
end
|
|
|
|
if not IsControlReleased(0, Config.PositioningControls.backwards) then --arrow down
|
|
offSet = {offSet[1], offSet[2] - 0.01, offSet[3]}
|
|
end
|
|
|
|
if not IsControlReleased(0, Config.PositioningControls.forwards) then --arrow up
|
|
offSet = {offSet[1], offSet[2] + 0.01, offSet[3]}
|
|
end
|
|
|
|
if not IsControlReleased(0, Config.PositioningControls.left) then --arrow left
|
|
offSet = {offSet[1] - 0.01, offSet[2], offSet[3]}
|
|
end
|
|
|
|
if not IsControlReleased(0, Config.PositioningControls.right) then --arrow right
|
|
offSet = {offSet[1] + 0.01, offSet[2], offSet[3]}
|
|
end
|
|
|
|
if IsControlJustPressed(0, Config.PositioningControls.enter) then -- enter - finish
|
|
offSetComplete = true
|
|
end
|
|
end
|
|
|
|
Wait(0)
|
|
end
|
|
|
|
Notify("OffSet Values are now printed in your console")
|
|
print("OffSet: {"..offSet[1]..", "..offSet[2]..", "..offSet[3].."}")
|
|
DeleteEntity(ballProp)
|
|
ResetEntityAlpha(targetVehicle)
|
|
end
|
|
|
|
end, false)
|
|
end
|
|
|
|
if Config.Inventory.coreInventory then
|
|
function inventoryUseScba()
|
|
TriggerEvent("scba:client:useScba")
|
|
end
|
|
|
|
exports("inventoryUseScba", inventoryUseScba)
|
|
|
|
function inventoryUseRope()
|
|
TriggerEvent("scba:client:useRope")
|
|
end
|
|
|
|
exports("inventoryUseRope", inventoryUseRope)
|
|
end
|
|
|
|
function Notify(text)
|
|
|
|
if not Config.Notifications.Enabled then
|
|
return
|
|
end
|
|
|
|
if Config.Notifications.Framework.ESX then
|
|
if ESX ~= nil then
|
|
ESX.ShowNotification(text)
|
|
end
|
|
elseif Config.Notifications.Framework.QBCore then
|
|
TriggerEvent('QBCore:Notify', text, 'primary')
|
|
elseif Config.Notifications.Framework.QBX then
|
|
exports.qbx_core:Notify(text, 'primary')
|
|
elseif Config.Notifications.Framework.vRP then
|
|
vRP.notify(source, {text})
|
|
elseif Config.Notifications.Framework.okok then
|
|
exports['okokNotify']:Alert("SCBA", text, 2000, 'info', true)
|
|
else
|
|
showBaseNotification(text)
|
|
end
|
|
end
|
|
|
|
function showBaseNotification(msg)
|
|
BeginTextCommandThefeedPost('STRING')
|
|
AddTextComponentSubstringPlayerName(msg)
|
|
EndTextCommandThefeedPostTicker(false, false)
|
|
end
|
|
|
|
function showHelp(msg)
|
|
BeginTextCommandDisplayHelp('STRING')
|
|
AddTextComponentSubstringPlayerName(msg)
|
|
EndTextCommandDisplayHelp(0, false, false, 1)
|
|
end |