curatenie si fix target
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
How to setup
|
||||
1 - start ld-target
|
||||
|
||||
|
||||
TARGET:
|
||||
-Target exprots same with qb-target you can directly change the exports name ld-target instead qb-target
|
||||
|
||||
|
||||
DRAWTEXT:
|
||||
- For drawtext go to interaction/interaction.lua
|
||||
- Put your coord inside Coords table that's it.
|
||||
|
||||
DrawUI:
|
||||
|
||||
Without Press UI -> exports['ld-target']:OpenDraw('Garage')
|
||||
With Press UI -> exports['ld-target']:OpenDraw('Garage', 'E')
|
||||
For Close -> exports['ld-target']:CloseDraw()
|
||||
|
||||
|
||||
-- LUNNY DEVELOPMENTS
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,134 @@
|
||||
local Bones = { Options = {}, Vehicle = { 'chassis', 'windscreen', 'seat_pside_r', 'seat_dside_r', 'bodyshell', 'suspension_lm', 'suspension_lr', 'platelight', 'attach_female', 'attach_male', 'bonnet', 'boot', 'chassis_dummy', 'chassis_Control', 'door_dside_f', 'door_dside_r', 'door_pside_f', 'door_pside_r', 'Gun_GripR', 'windscreen_f', 'platelight', 'VFX_Emitter', 'window_lf', 'window_lr', 'window_rf', 'window_rr', 'engine', 'gun_ammo', 'ROPE_ATTATCH', 'wheel_lf', 'wheel_lr', 'wheel_rf', 'wheel_rr', 'exhaust', 'overheat', 'seat_dside_f', 'seat_pside_f', 'Gun_Nuzzle', 'seat_r' } }
|
||||
|
||||
if Config.EnableDefaultOptions then
|
||||
local BackEngineVehicles = {
|
||||
[`ninef`] = true,
|
||||
[`adder`] = true,
|
||||
[`vagner`] = true,
|
||||
[`t20`] = true,
|
||||
[`infernus`] = true,
|
||||
[`zentorno`] = true,
|
||||
[`reaper`] = true,
|
||||
[`comet2`] = true,
|
||||
[`comet3`] = true,
|
||||
[`jester`] = true,
|
||||
[`jester2`] = true,
|
||||
[`cheetah`] = true,
|
||||
[`cheetah2`] = true,
|
||||
[`prototipo`] = true,
|
||||
[`turismor`] = true,
|
||||
[`pfister811`] = true,
|
||||
[`ardent`] = true,
|
||||
[`nero`] = true,
|
||||
[`nero2`] = true,
|
||||
[`tempesta`] = true,
|
||||
[`vacca`] = true,
|
||||
[`bullet`] = true,
|
||||
[`osiris`] = true,
|
||||
[`entityxf`] = true,
|
||||
[`turismo2`] = true,
|
||||
[`fmj`] = true,
|
||||
[`re7b`] = true,
|
||||
[`tyrus`] = true,
|
||||
[`italigtb`] = true,
|
||||
[`penetrator`] = true,
|
||||
[`monroe`] = true,
|
||||
[`ninef2`] = true,
|
||||
[`stingergt`] = true,
|
||||
[`surfer`] = true,
|
||||
[`surfer2`] = true,
|
||||
[`gp1`] = true,
|
||||
[`autarch`] = true,
|
||||
[`tyrant`] = true
|
||||
}
|
||||
|
||||
local function ToggleDoor(vehicle, door)
|
||||
if GetVehicleDoorLockStatus(vehicle) < 2 then
|
||||
if GetVehicleDoorAngleRatio(vehicle, door) > 0.0 then
|
||||
SetVehicleDoorShut(vehicle, door, false)
|
||||
else
|
||||
SetVehicleDoorOpen(vehicle, door, false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Bones.Options['seat_dside_f'] = {
|
||||
['Toggle Front Door'] = {
|
||||
icon = 'fas fa-door-open',
|
||||
label = 'Toggle Front Door',
|
||||
canInteract = function(entity)
|
||||
return GetEntityBoneIndexByName(entity, 'door_dside_f') ~= -1
|
||||
end,
|
||||
action = function(entity)
|
||||
ToggleDoor(entity, 0)
|
||||
end,
|
||||
distance = 1.2
|
||||
},
|
||||
}
|
||||
|
||||
Bones.Options['seat_pside_f'] = {
|
||||
['Toggle Front Door'] = {
|
||||
icon = 'fas fa-door-open',
|
||||
label = 'Toggle Front Door',
|
||||
canInteract = function(entity)
|
||||
return GetEntityBoneIndexByName(entity, 'door_pside_f') ~= -1
|
||||
end,
|
||||
action = function(entity)
|
||||
ToggleDoor(entity, 1)
|
||||
end,
|
||||
distance = 1.2
|
||||
}
|
||||
}
|
||||
|
||||
Bones.Options['seat_dside_r'] = {
|
||||
['Toggle Rear Door'] = {
|
||||
icon = 'fas fa-door-open',
|
||||
label = 'Toggle Rear Door',
|
||||
canInteract = function(entity)
|
||||
return GetEntityBoneIndexByName(entity, 'door_dside_r') ~= -1
|
||||
end,
|
||||
action = function(entity)
|
||||
ToggleDoor(entity, 2)
|
||||
end,
|
||||
distance = 1.2
|
||||
}
|
||||
}
|
||||
|
||||
Bones.Options['seat_pside_r'] = {
|
||||
['Toggle Rear Door'] = {
|
||||
icon = 'fas fa-door-open',
|
||||
label = 'Toggle Rear Door',
|
||||
canInteract = function(entity)
|
||||
return GetEntityBoneIndexByName(entity, 'door_pside_r') ~= -1
|
||||
end,
|
||||
action = function(entity)
|
||||
ToggleDoor(entity, 3)
|
||||
end,
|
||||
distance = 1.2
|
||||
}
|
||||
}
|
||||
|
||||
Bones.Options['bonnet'] = {
|
||||
['Toggle Hood'] = {
|
||||
icon = 'fas fa-door-open',
|
||||
label = 'Toggle Hood',
|
||||
action = function(entity)
|
||||
ToggleDoor(entity, BackEngineVehicles[GetEntityModel(entity)] and 5 or 4)
|
||||
end,
|
||||
distance = 0.9
|
||||
}
|
||||
}
|
||||
|
||||
Bones.Options['boot'] = {
|
||||
['Toggle Trunk'] = {
|
||||
icon = 'fas fa-door-open',
|
||||
label = 'Toggle Trunk',
|
||||
action = function(entity)
|
||||
ToggleDoor(entity, BackEngineVehicles[GetEntityModel(entity)] and 4 or 5)
|
||||
end,
|
||||
distance = 0.9
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
return Bones
|
||||
@@ -0,0 +1,38 @@
|
||||
fx_version 'cerulean'
|
||||
game 'gta5'
|
||||
|
||||
provide 'qtarget'
|
||||
|
||||
name 'qb-target'
|
||||
description 'Red Valley Target System (ld-target based)'
|
||||
version '1.0.0'
|
||||
|
||||
ui_page 'html/index.html'
|
||||
|
||||
files {
|
||||
'stream/*.ytd',
|
||||
'data/*.lua',
|
||||
'html/index.html',
|
||||
'html/style.css',
|
||||
'html/interaction.css',
|
||||
'html/script.js',
|
||||
'html/fonts/*.ttf'
|
||||
}
|
||||
|
||||
client_scripts {
|
||||
'@PolyZone/client.lua',
|
||||
'@PolyZone/BoxZone.lua',
|
||||
'@PolyZone/EntityZone.lua',
|
||||
'@PolyZone/CircleZone.lua',
|
||||
'@PolyZone/ComboZone.lua',
|
||||
'init.lua',
|
||||
'data/bones.lua',
|
||||
'client.lua',
|
||||
'interaction/interaction.lua',
|
||||
}
|
||||
|
||||
lua54 'yes'
|
||||
|
||||
use_fxv2_oal 'yes'
|
||||
|
||||
dependency 'PolyZone'
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,71 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="theme-color" content="#000000">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" />
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
|
||||
<link rel="shortcut icon" type="image/ico" href="/src/assets/favicon.ico">
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
|
||||
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
|
||||
<title>LD-Target</title>
|
||||
<script src="script.js"></script>
|
||||
<link rel="stylesheet" href="interaction.css">
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<style type="text/css">
|
||||
.virtual-container-2r5dwusvajp {
|
||||
position: relative !important;
|
||||
flex-shrink: 0 !important;
|
||||
}
|
||||
.virtual-container-2r5dwusvajp > * {
|
||||
will-change: transform !important;
|
||||
box-sizing: border-box !important;
|
||||
contain: strict !important;
|
||||
position: absolute !important;
|
||||
top: 0 !important;
|
||||
left: 0 !important;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="eye" class="wrapper center-wrapper"">
|
||||
<input class="input-field" tabindex="0"><input class="input-field" tabindex="-1">
|
||||
<div class="container" style="display: none;">
|
||||
<div class="align">
|
||||
<svg class="peak-icon deactive" width="3.07vh" height="3.62vh" viewBox="0 0 44 50" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M20.25 1.58771C21.3329 0.962498 22.6671 0.962498 23.75 1.58771L41.4006 11.7783C42.4835 12.4035 43.1506 13.559 43.1506 14.8094V35.1906C43.1506 36.441 42.4835 37.5965 41.4006 38.2217L23.75 48.4123C22.6671 49.0375 21.3329 49.0375 20.25 48.4123L2.59936 38.2217C1.51646 37.5965 0.849365 36.441 0.849365 35.1906V14.8094C0.849365 13.559 1.51646 12.4035 2.59937 11.7783L20.25 1.58771Z" fill="url(#paint0_radial_0_1)" fill-opacity="0.55" stroke="#5c97f7"></path>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M21.1614 19.0325C18.2465 19.2571 15.3723 20.8021 13.0943 23.3689C12.5358 23.9982 12.1323 24.5152 12.0556 24.6999C11.9811 24.879 11.9815 25.1205 12.0565 25.3009C12.0889 25.3791 12.2794 25.6481 12.4797 25.8988C15.2805 29.4044 18.945 31.2351 22.6423 30.9758C25.3836 30.7835 27.8458 29.6289 30.0965 27.4803C30.7691 26.8381 31.8205 25.5969 31.9444 25.2987C32.0189 25.1196 32.0185 24.8781 31.9435 24.6977C31.8049 24.3641 30.6127 22.9913 29.8779 22.3191C27.231 19.8978 24.2955 18.791 21.1614 19.0325ZM23.0159 20.9069C24.3748 21.269 25.4438 22.2322 25.931 23.5336C26.1194 24.0367 26.1612 24.3082 26.1603 25.0189C26.1596 25.6231 26.1494 25.7235 26.0535 26.0712C25.8444 26.8295 25.5078 27.4089 24.9521 27.9677C24.3965 28.5264 23.8201 28.8648 23.066 29.0751C22.7202 29.1715 22.6204 29.1817 22.0195 29.1825C21.3127 29.1834 21.0427 29.1413 20.5423 28.9519C19.2478 28.462 18.2857 27.3821 17.9309 26.0208C17.8303 25.6348 17.7927 24.8075 17.8558 24.3666C18.0701 22.8685 19.1417 21.5617 20.5927 21.0293C21.1035 20.8418 21.4297 20.7956 22.1172 20.8133C22.5563 20.8246 22.8034 20.8504 23.0159 20.9069ZM21.3553 22.814C20.5753 23.07 19.989 23.6904 19.7929 24.4674C19.4389 25.8697 20.5448 27.278 22 27.278C23.0258 27.278 23.951 26.5457 24.2071 25.5312C24.283 25.2305 24.2827 24.726 24.2065 24.4317C24.0027 23.645 23.3455 22.9864 22.5609 22.7829C22.2053 22.6907 21.6905 22.7039 21.3553 22.814Z" fill="url(#paint1_radial_0_1)"></path>
|
||||
<defs>
|
||||
<radialGradient id="paint0_radial_0_1" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(22 -46.4286) rotate(90) scale(99.8545 68.5454)">
|
||||
<stop stop-color="#06070A"></stop>
|
||||
<stop offset="1" stop-color="#063428"></stop>
|
||||
</radialGradient>
|
||||
<radialGradient id="paint1_radial_0_1" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(22 25) rotate(47.925) scale(14.9231 25.2181)">
|
||||
<stop stop-color="#5c97f7"></stop>
|
||||
<stop offset="1" stop-color="#5c97f7" stop-opacity="0"></stop>
|
||||
</radialGradient>
|
||||
</defs>
|
||||
</svg>
|
||||
<svg class="under-element deactive" width="2.24vh" height="3.25vh" viewBox="0 0 35 46" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M14.6173 1.4737C16.262 0.524127 18.2884 0.524123 19.9331 1.47369L30.9707 7.84622C32.6154 8.7958 33.6286 10.5507 33.6286 12.4498V32.912C33.6286 34.8111 32.6154 36.566 30.9707 37.5156L19.9332 43.8881C18.2885 44.8377 16.2621 44.8377 14.6174 43.8881L3.57986 37.5156C1.93516 36.566 0.921972 34.8111 0.921965 32.912L0.921888 12.4498C0.92188 10.5507 1.93507 8.79579 3.57978 7.84621L14.6173 1.4737Z" fill="url(#paint0_linear_3390_5649)" fill-opacity="0.25" stroke="url(#paint1_linear_3390_5649)"></path>
|
||||
<defs>
|
||||
<linearGradient id="paint0_linear_3390_5649" x1="17.2751" y1="8.64471" x2="5.37654" y2="45.7649" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#06070A" stop-opacity="0"></stop>
|
||||
<stop offset="1" stop-color="#07382C"></stop>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint1_linear_3390_5649" x1="17.2752" y1="20.7237" x2="17.2752" y2="85.592" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#5c97f7" stop-opacity="0"></stop>
|
||||
<stop offset="1" stop-color="#5c97f7"></stop>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="options" style="display: none;"></div>
|
||||
</div>
|
||||
<input class="input-field" tabindex="-1"><input class="input-field" tabindex="0">
|
||||
</div>
|
||||
<div style="display: none;" id="interactions2" class="wrapper"><input class="input-field" tabindex="0"><input class="input-field" tabindex="-1"><div class="interation-wrapper"><div class="interaction-cols"><div class="interaction-alert"><h1 class="interaction-text" style="transform: translateY(0%); opacity: 1;">Parking</h1></div></div></div><input class="input-field" tabindex="-1"><input class="input-field" tabindex="0"></div>
|
||||
|
||||
<div style="display: none;" id="interactions" class="wrapper"><input class="input-field" tabindex="0"><input class="input-field" tabindex="-1"><div class="interation-wrapper"><div class="interaction-cols"><div class="interaction-alert"><div class="interaction-key-container" style="transform: translateY(0%); opacity: 1;"><h1 class="interaction-key-text">E</h1></div><h1 class="interaction-text" style="transform: translateX(0%); opacity: 1;"><div class="yarrak">Get stylish</div> </h1></div></div></div><input class="input-field" tabindex="-1"><input class="input-field" tabindex="0"></div>
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,93 @@
|
||||
window.onload = function(e) {
|
||||
window.addEventListener("message", function(event) {
|
||||
let data = event.data;
|
||||
switch (data.response) {
|
||||
case "openDraw":
|
||||
let x = data.data
|
||||
console.log(x)
|
||||
if (x.press) {
|
||||
$('.interaction-key-text').html(x.press)
|
||||
$('.interaction-text').html(x.text)
|
||||
FadeIn('#interactions', 300)
|
||||
} else {
|
||||
$('#interactions2').css("display", "none");
|
||||
$('.interaction-text').html(x.text)
|
||||
FadeIn('#interactions2', 300)
|
||||
}
|
||||
break;
|
||||
case "closeDraw":
|
||||
FadeOut('#interactions2', 300)
|
||||
FadeOut('#interactions', 300)
|
||||
break;
|
||||
case "foundTarget":
|
||||
document.querySelector(".peak-icon").classList.remove("deactive");
|
||||
document.querySelector(".peak-icon").classList.add("active");
|
||||
document.querySelector(".under-element").classList.remove("deactive");
|
||||
document.querySelector(".under-element").classList.add("active");
|
||||
break;
|
||||
case "openTarget":
|
||||
$('.container').css('display', 'block')
|
||||
break;
|
||||
case "closeTarget":
|
||||
document.querySelector(".peak-icon").classList.remove("active");
|
||||
document.querySelector(".peak-icon").classList.add("deactive");
|
||||
document.querySelector(".under-element").classList.remove("active");
|
||||
document.querySelector(".under-element").classList.add("deactive");
|
||||
$('.container').css('display', 'none')
|
||||
break;
|
||||
case "leftTarget":
|
||||
document.querySelector(".peak-icon").classList.remove("active");
|
||||
document.querySelector(".peak-icon").classList.add("deactive");
|
||||
document.querySelector(".under-element").classList.remove("active");
|
||||
document.querySelector(".under-element").classList.add("deactive");
|
||||
$('.options').css('display', 'none')
|
||||
break;
|
||||
case "validTarget":
|
||||
ValidTarget(data.data);
|
||||
break;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function ValidTarget(item) {
|
||||
$('.options').html('');
|
||||
$('.options').css('display', 'block');
|
||||
for (var k in item) {
|
||||
let html = `
|
||||
<div class="option" id="target-${k}">
|
||||
<i id="target-${k}" style="font-size: .75vw; color: #5c97f7;" class="${item[k].icon}"></i>
|
||||
<h6 id="target-${k}" class="MuiTypography-root MuiTypography-h6 MuiTypography-colorTextPrimary" style="word-break: break-word;">${item[k].label}</h6>
|
||||
</div>
|
||||
`
|
||||
$(".options").append(html);
|
||||
}
|
||||
}
|
||||
|
||||
$(document).on('mousedown', (event) => {
|
||||
let element = event.target;
|
||||
console.log(element.id)
|
||||
if (element.id.split("-")[0] === 'target') {
|
||||
let TargetData = element.id.split("-")[1]
|
||||
|
||||
$.post(`https://qb-target/selectTarget`, JSON.stringify(Number(TargetData)+1));
|
||||
document.querySelector(".peak-icon").classList.remove("active");
|
||||
document.querySelector(".peak-icon").classList.add("deactive");
|
||||
document.querySelector(".under-element").classList.remove("active");
|
||||
document.querySelector(".under-element").classList.add("deactive");
|
||||
$('.container').css('display', 'none')
|
||||
$('.options').css('display', 'none')
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
function FadeIn(Object, Timeout) {
|
||||
$(Object).fadeIn(Timeout).css('display', 'block');
|
||||
}
|
||||
|
||||
function FadeOut(Object, Timeout) {
|
||||
$(Object).fadeOut(Timeout)
|
||||
setTimeout(function(){
|
||||
$(Object).css("display", "none");
|
||||
}, Timeout)
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,191 @@
|
||||
function Load(name)
|
||||
local resourceName = GetCurrentResourceName()
|
||||
local chunk = LoadResourceFile(resourceName, ('data/%s.lua'):format(name))
|
||||
if chunk then
|
||||
local err
|
||||
chunk, err = load(chunk, ('@@%s/data/%s.lua'):format(resourceName, name), 't')
|
||||
if err then
|
||||
error(('\n^1 %s'):format(err), 0)
|
||||
end
|
||||
return chunk()
|
||||
end
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- Settings
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Config = {
|
||||
FrameWork = 'qb', -- ['qb', 'esx']
|
||||
MaxDistance = 7.0,
|
||||
-- Whether to have the target as a toggle or not
|
||||
Toggle = false,
|
||||
DrawSprite = true,
|
||||
DrawDistance = 20.0,
|
||||
-- Enable default options (Toggling vehicle doors)
|
||||
EnableDefaultOptions = true,
|
||||
-- Disable the target eye whilst being in a vehicle
|
||||
DisableInVehicle = false,
|
||||
-- Key to open the target eye, here you can find all the names: https://docs.fivem.net/docs/game-references/input-mapper-parameter-ids/keyboard/
|
||||
OpenKey = 'LMENU', -- Left Alt
|
||||
-- Control for key press detection on the context menu, it's the Right Mouse Button by default, controls are found here https://docs.fivem.net/docs/game-references/controls/
|
||||
MenuControlKey = 237,
|
||||
|
||||
-- These are all empty for you to fill in, refer to the .md files for help in filling these in
|
||||
CircleZones = {},
|
||||
|
||||
BoxZones = {},
|
||||
|
||||
PolyZones = {},
|
||||
|
||||
TargetBones = {},
|
||||
|
||||
TargetModels = {},
|
||||
|
||||
GlobalPedOptions = {},
|
||||
|
||||
GlobalVehicleOptions = {},
|
||||
|
||||
GlobalObjectOptions = {},
|
||||
|
||||
GlobalPlayerOptions = {},
|
||||
|
||||
Peds = {},
|
||||
}
|
||||
|
||||
CreateThread(function()
|
||||
if Config.FrameWork == 'qb' then
|
||||
local state = GetResourceState('qb-core')
|
||||
if state ~= 'missing' then
|
||||
if state ~= 'started' then
|
||||
local timeout = 0
|
||||
repeat
|
||||
timeout += 1
|
||||
Wait(0)
|
||||
until GetResourceState('qb-core') == 'started' or timeout > 100
|
||||
end
|
||||
end
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
local PlayerData = QBCore.Functions.GetPlayerData()
|
||||
|
||||
ItemCount = function(item)
|
||||
for _, v in pairs(PlayerData.items) do
|
||||
if v.name == item then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
JobCheck = function(job)
|
||||
if type(job) == 'table' then
|
||||
job = job[PlayerData.job.name]
|
||||
if job and PlayerData.job.grade.level >= job then
|
||||
return true
|
||||
end
|
||||
elseif job == 'all' or job == PlayerData.job.name then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
GangCheck = function(gang)
|
||||
if type(gang) == 'table' then
|
||||
gang = gang[PlayerData.gang.name]
|
||||
if gang and PlayerData.gang.grade.level >= gang then
|
||||
return true
|
||||
end
|
||||
elseif gang == 'all' or gang == PlayerData.gang.name then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
CitizenCheck = function(citizenid)
|
||||
return citizenid == PlayerData.citizenid or citizenid[PlayerData.citizenid]
|
||||
end
|
||||
|
||||
RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function()
|
||||
PlayerData = QBCore.Functions.GetPlayerData()
|
||||
SpawnPeds()
|
||||
end)
|
||||
|
||||
RegisterNetEvent('QBCore:Client:OnPlayerUnload', function()
|
||||
PlayerData = {}
|
||||
DeletePeds()
|
||||
end)
|
||||
|
||||
RegisterNetEvent('QBCore:Client:OnJobUpdate', function(JobInfo)
|
||||
PlayerData.job = JobInfo
|
||||
end)
|
||||
|
||||
RegisterNetEvent('QBCore:Client:OnGangUpdate', function(GangInfo)
|
||||
PlayerData.gang = GangInfo
|
||||
end)
|
||||
|
||||
RegisterNetEvent('QBCore:Player:SetPlayerData', function(val)
|
||||
PlayerData = val
|
||||
end)
|
||||
else
|
||||
local state = GetResourceState('es_extended')
|
||||
if state ~= 'missing' then
|
||||
if state ~= 'started' then
|
||||
local timeout = 0
|
||||
repeat
|
||||
timeout += 1
|
||||
Wait(0)
|
||||
until GetResourceState('es_extended') == 'started' or timeout > 100
|
||||
end
|
||||
end
|
||||
ESX = exports["es_extended"]:getSharedObject()
|
||||
local PlayerData = ESX.PlayerData
|
||||
|
||||
ItemCount = function(item)
|
||||
for _, v in pairs(PlayerData.inventory) do
|
||||
if v.name == item then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
JobCheck = function(job)
|
||||
if job == 'all' or job == PlayerData.job.name then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
CitizenCheck = function(citizenid)
|
||||
return citizenid == PlayerData.identifier or citizenid[PlayerData.identifier]
|
||||
end
|
||||
|
||||
RegisterNetEvent('esx:playerLoaded', function()
|
||||
PlayerData = ESX.PlayerData
|
||||
SpawnPeds()
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:setJob', function(JobInfo)
|
||||
PlayerData.job = JobInfo
|
||||
end)
|
||||
end
|
||||
end)
|
||||
|
||||
function CheckOptions(data, entity, distance)
|
||||
if Config.FrameWork == 'qb' then
|
||||
if distance and data.distance and distance > data.distance then return false end
|
||||
if data.job and not JobCheck(data.job) then return false end
|
||||
if data.gang and not GangCheck(data.gang) then return false end
|
||||
if data.item and not ItemCount(data.item) then return false end
|
||||
if data.citizenid and not CitizenCheck(data.citizenid) then return false end
|
||||
if data.canInteract and not data.canInteract(entity, distance, data) then return false end
|
||||
return true
|
||||
else
|
||||
if distance and data.distance and distance > data.distance then return false end
|
||||
if data.job and not JobCheck(data.job) then return false end
|
||||
if data.item and not ItemCount(data.item) then return false end
|
||||
if data.citizenid and not CitizenCheck(data.citizenid) then return false end
|
||||
if data.canInteract and not data.canInteract(entity, distance, data) then return false end
|
||||
return true
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,54 @@
|
||||
--drawui (NUI-based interaction prompts)
|
||||
local function OpenDraw(text, press)
|
||||
SendNUIMessage({
|
||||
response = 'openDraw',
|
||||
data = {
|
||||
press = press,
|
||||
text = text
|
||||
}
|
||||
})
|
||||
end exports('OpenDraw', OpenDraw)
|
||||
|
||||
local function CloseDraw()
|
||||
SendNUIMessage({
|
||||
response = 'closeDraw'
|
||||
})
|
||||
end exports('CloseDraw', CloseDraw)
|
||||
|
||||
-- 3-stage proximity interaction (DrawSprite-based)
|
||||
-- Stage 1 (3m): small dot
|
||||
-- Stage 2 (2m): hexagon key prompt
|
||||
-- Stage 3 (1m): hexagon key + label
|
||||
|
||||
Coords = {}
|
||||
|
||||
CreateThread(function()
|
||||
while not HasStreamedTextureDictLoaded("lunny_ui") do Wait(10) RequestStreamedTextureDict("lunny_ui", true) end
|
||||
local sleep
|
||||
while true do
|
||||
local myCoords = GetEntityCoords(PlayerPedId())
|
||||
sleep = 500
|
||||
for _, v in ipairs(Coords) do
|
||||
local distance = #(myCoords - vector3(v.coords.x, v.coords.y, v.coords.z))
|
||||
if distance < 6 then
|
||||
sleep = 0
|
||||
SetDrawOrigin(v.coords.x, v.coords.y, v.coords.z + 1, 0)
|
||||
if distance > 2 and distance < 6 then
|
||||
-- Stage 1: small dot (blue)
|
||||
DrawSprite("lunny_ui", "point", 0, 0, 0.015, 0.025, 0, 92, 151, 247, 200)
|
||||
end
|
||||
if distance < 2 and distance > 1 then
|
||||
-- Stage 2: key hexagon (blue)
|
||||
DrawSprite("lunny_ui", "key", 0, 0, 0.018, 0.030, 0, 92, 151, 247, 255)
|
||||
end
|
||||
if distance < 1 then
|
||||
-- Stage 3: key + label (blue)
|
||||
DrawSprite("lunny_ui", "key", 0, 0, 0.018, 0.030, 0, 92, 151, 247, 255)
|
||||
DrawSprite("lunny_ui", "npc_talk", 0.044, 0, 0.06, 0.028, 0, 92, 151, 247, 255)
|
||||
end
|
||||
ClearDrawOrigin()
|
||||
end
|
||||
end
|
||||
Wait(sleep)
|
||||
end
|
||||
end)
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user