curatenie si fix target
This commit is contained in:
@@ -1,165 +0,0 @@
|
||||
|
||||
local targetCache = {}
|
||||
function InitInteraction()
|
||||
if Config.InteractionHandler == 'ox_target' then
|
||||
if targetCache[companyData.company] then return end
|
||||
targetCache[companyData.company] = true
|
||||
exports.ox_target:addBoxZone({
|
||||
name = 'mBoss'..companyData.company,
|
||||
coords = vector3(companyData.location.x, companyData.location.y, companyData.location.z),
|
||||
size = vec3(3.6, 3.6, 3.6),
|
||||
drawSprite = true,
|
||||
options = {
|
||||
{
|
||||
name = 'mBoss'..companyData.company,
|
||||
event = 'mBossmenu:OpenMenu',
|
||||
icon = 'fas fa-gears',
|
||||
label = locales.open_menu,
|
||||
}
|
||||
}
|
||||
})
|
||||
end
|
||||
if Config.InteractionHandler == 'qb_target' then
|
||||
if targetCache[companyData.company] then return end
|
||||
targetCache[companyData.company] = true
|
||||
exports['qb-target']:AddBoxZone('mBoss'..companyData.company, vector3(companyData.location.x, companyData.location.y, companyData.location.z), 1.5, 1.6,
|
||||
{
|
||||
name = 'mBoss'..companyData.company,
|
||||
heading = 12.0,
|
||||
debugPoly = false,
|
||||
minZ = companyData.location.z - 1,
|
||||
maxZ = companyData.location.z + 1,
|
||||
},
|
||||
{
|
||||
options = {
|
||||
{
|
||||
num = 1,
|
||||
type = "client",
|
||||
icon = 'fas fa-gears',
|
||||
label = locales.open_menu,
|
||||
targeticon = 'fas fa-gears',
|
||||
action = function()
|
||||
TriggerEvent("mBossmenu:OpenMenu")
|
||||
end
|
||||
}
|
||||
},
|
||||
distance = 4.5,
|
||||
})
|
||||
end
|
||||
if Config.InteractionHandler == 'qb_textui' then
|
||||
|
||||
if targetCache[companyData.company] then return end
|
||||
targetCache[companyData.company] = true
|
||||
CreateThread(function()
|
||||
while true do
|
||||
local show = false
|
||||
local cd = 1500
|
||||
if companyData.location then
|
||||
local plyCoords = GetEntityCoords(PlayerPedId())
|
||||
local vec = vector3(companyData.location.x, companyData.location.y, companyData.location.z)
|
||||
local dist = #(vec - plyCoords)
|
||||
if dist < 5.0 and CanOpenMenu() then
|
||||
cd = 0
|
||||
if not show then
|
||||
exports["17mov_Hud"]:ShowHelpNotification(locales.press)
|
||||
show = true
|
||||
end
|
||||
if IsControlJustPressed(0, Config.MenuKey) then
|
||||
OpenMenu('main', 'employees')
|
||||
loadPlayerInventory()
|
||||
loadPlayerVault()
|
||||
end
|
||||
else
|
||||
if show then
|
||||
show = false
|
||||
exports["17mov_Hud"]:HideHelpNotification()
|
||||
end
|
||||
end
|
||||
else
|
||||
if show then
|
||||
show = false
|
||||
exports["17mov_Hud"]:HideHelpNotification()
|
||||
|
||||
end
|
||||
end
|
||||
Wait(cd)
|
||||
end
|
||||
end)
|
||||
end
|
||||
if Config.InteractionHandler == 'esx_textui' then
|
||||
if targetCache[companyData.company] then return end
|
||||
targetCache[companyData.company] = true
|
||||
|
||||
CreateThread(function()
|
||||
local show = false
|
||||
while true do
|
||||
|
||||
local cd = 1500
|
||||
if companyData.location then
|
||||
local plyCoords = GetEntityCoords(PlayerPedId())
|
||||
local vec = vector3(companyData.location.x, companyData.location.y, companyData.location.z)
|
||||
local dist = #(vec - plyCoords)
|
||||
if dist < 5.0 and CanOpenMenu() then
|
||||
cd = 0
|
||||
if not show then
|
||||
Core.TextUI(locales.press)
|
||||
show = true
|
||||
end
|
||||
if IsControlJustPressed(0, Config.MenuKey) then
|
||||
OpenMenu('main', 'employees')
|
||||
loadPlayerInventory()
|
||||
loadPlayerVault()
|
||||
end
|
||||
else
|
||||
if show then
|
||||
show = false
|
||||
Core.HideUI()
|
||||
end
|
||||
end
|
||||
else
|
||||
if show then
|
||||
show = false
|
||||
Core.HideUI()
|
||||
|
||||
end
|
||||
end
|
||||
Wait(cd)
|
||||
end
|
||||
end)
|
||||
end
|
||||
if Config.InteractionHandler == 'drawtext' then
|
||||
if targetCache[companyData.company] then return end
|
||||
targetCache[companyData.company] = true
|
||||
CreateThread(function()
|
||||
while true do
|
||||
local cd = 1500
|
||||
if companyData.location then
|
||||
local plyCoords = GetEntityCoords(PlayerPedId())
|
||||
local vec = vector3(companyData.location.x, companyData.location.y, companyData.location.z)
|
||||
local dist = #(vec - plyCoords)
|
||||
if dist < 4.0 and CanOpenMenu() then
|
||||
cd = 0
|
||||
DrawMarker(2, vec, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.3, 0.2, 0.15, 255, 255, 255, 255, false, false, false,
|
||||
true, false, false, false)
|
||||
DrawText3D(vec.x, vec.y, vec.z, "Press E to open Bossmenu")
|
||||
if IsControlJustPressed(0, Config.MenuKey) then
|
||||
OpenMenu('main', 'employees')
|
||||
loadPlayerInventory()
|
||||
loadPlayerVault()
|
||||
end
|
||||
end
|
||||
end
|
||||
Wait(cd)
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
RegisterCommand(Config.AdminMenuCommand, function()
|
||||
local isAdmin = TriggerCallback("mBossmenu:checkIsAdmin")
|
||||
if isAdmin then
|
||||
OpenMenu('admin', 'adminlist')
|
||||
else
|
||||
Config.Notify(locales.no_permission_2)
|
||||
end
|
||||
end)
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,81 +0,0 @@
|
||||
function WaitCore()
|
||||
while Core == nil do
|
||||
Wait(0)
|
||||
end
|
||||
end
|
||||
|
||||
function DrawText3D(x, y, z, text)
|
||||
SetTextScale(0.35, 0.35)
|
||||
SetTextFont(4)
|
||||
SetTextProportional(1)
|
||||
SetTextColour(255, 255, 255, 215)
|
||||
SetTextEntry('STRING')
|
||||
SetTextCentre(true)
|
||||
AddTextComponentString(text)
|
||||
SetDrawOrigin(x, y, z, 0)
|
||||
DrawText(0.0, 0.0)
|
||||
local factor = (string.len(text)) / 370
|
||||
DrawRect(0.0, 0.0 + 0.0125, 0.017 + factor, 0.03, 0, 0, 0, 75)
|
||||
ClearDrawOrigin()
|
||||
end
|
||||
|
||||
|
||||
function TriggerCallback(name, data)
|
||||
local incomingData = false
|
||||
local status = 'UNKOWN'
|
||||
local counter = 0
|
||||
WaitCore()
|
||||
if Config.Framework == 'esx' or Config.Framework == 'oldesx' then
|
||||
Core.TriggerServerCallback(name, function(payload)
|
||||
status = 'SUCCESS'
|
||||
incomingData = payload
|
||||
end, data)
|
||||
else
|
||||
Core.Functions.TriggerCallback(name, function(payload)
|
||||
status = 'SUCCESS'
|
||||
incomingData = payload
|
||||
end, data)
|
||||
end
|
||||
CreateThread(function()
|
||||
while incomingData == 'UNKOWN' do
|
||||
Wait(1000)
|
||||
if counter == 4 then
|
||||
status = 'FAILED'
|
||||
incomingData = false
|
||||
break
|
||||
end
|
||||
counter = counter + 1
|
||||
end
|
||||
end)
|
||||
|
||||
while status == 'UNKOWN' do
|
||||
Wait(0)
|
||||
end
|
||||
return incomingData
|
||||
end
|
||||
|
||||
function WaitPlayer()
|
||||
if Config.Framework == "esx" or Config.Framework == 'oldesx' then
|
||||
WaitCore()
|
||||
while Core.GetPlayerData() == nil do
|
||||
Wait(0)
|
||||
end
|
||||
while Core.GetPlayerData().job == nil do
|
||||
Wait(0)
|
||||
end
|
||||
else
|
||||
WaitCore()
|
||||
while Core.Functions.GetPlayerData() == nil do
|
||||
Wait(0)
|
||||
end
|
||||
while Core.Functions.GetPlayerData().metadata == nil do
|
||||
Wait(0)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function WaitNui()
|
||||
while not nuiLoaded do
|
||||
Wait(0)
|
||||
end
|
||||
end
|
||||
Binary file not shown.
Reference in New Issue
Block a user