mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-09-04 16:23:21 +00:00
vector3, fixes #18
This commit is contained in:
+19
-18
@@ -2,10 +2,9 @@ local Keys = {
|
|||||||
["ESC"] = 322, ["BACKSPACE"] = 177, ["E"] = 38, ["ENTER"] = 18, ["LEFT"] = 174, ["RIGHT"] = 175, ["TOP"] = 27, ["DOWN"] = 173
|
["ESC"] = 322, ["BACKSPACE"] = 177, ["E"] = 38, ["ENTER"] = 18, ["LEFT"] = 174, ["RIGHT"] = 175, ["TOP"] = 27, ["DOWN"] = 173
|
||||||
}
|
}
|
||||||
|
|
||||||
local menuIsShowed = false
|
local menuIsShowed = false
|
||||||
local hasAlreadyEnteredMarker = false
|
local hasAlreadyEnteredMarker = false
|
||||||
local lastZone = nil
|
local isInMarker = false
|
||||||
local isInJoblistingMarker = false
|
|
||||||
|
|
||||||
ESX = nil
|
ESX = nil
|
||||||
|
|
||||||
@@ -17,13 +16,13 @@ Citizen.CreateThread(function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
function ShowJobListingMenu()
|
function ShowJobListingMenu()
|
||||||
ESX.TriggerServerCallback('esx_joblisting:getJobsList', function(data)
|
ESX.TriggerServerCallback('esx_joblisting:getJobsList', function(jobs)
|
||||||
local elements = {}
|
local elements = {}
|
||||||
|
|
||||||
for i = 1, #data, 1 do
|
for i=1, #jobs, 1 do
|
||||||
table.insert(elements, {
|
table.insert(elements, {
|
||||||
label = data[i].label,
|
label = jobs[i].label,
|
||||||
job = data[i].job
|
job = jobs[i].job
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -51,9 +50,10 @@ Citizen.CreateThread(function()
|
|||||||
while true do
|
while true do
|
||||||
Citizen.Wait(1)
|
Citizen.Wait(1)
|
||||||
local coords = GetEntityCoords(PlayerPedId())
|
local coords = GetEntityCoords(PlayerPedId())
|
||||||
|
|
||||||
for i=1, #Config.Zones, 1 do
|
for i=1, #Config.Zones, 1 do
|
||||||
if GetDistanceBetweenCoords(coords, Config.Zones[i].x, Config.Zones[i].y, Config.Zones[i].z, true) < Config.DrawDistance then
|
if GetDistanceBetweenCoords(coords, Config.Zones[i], true) < Config.DrawDistance then
|
||||||
DrawMarker(Config.MarkerType, Config.Zones[i].x, Config.Zones[i].y, Config.Zones[i].z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, Config.ZoneSize.x, Config.ZoneSize.y, Config.ZoneSize.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false)
|
DrawMarker(Config.MarkerType, Config.Zones[i], 0.0, 0.0, 0.0, 0, 0.0, 0.0, Config.ZoneSize.x, Config.ZoneSize.y, Config.ZoneSize.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -64,20 +64,21 @@ Citizen.CreateThread(function()
|
|||||||
while true do
|
while true do
|
||||||
Citizen.Wait(1)
|
Citizen.Wait(1)
|
||||||
|
|
||||||
local coords, currentZone = GetEntityCoords(PlayerPedId()), nil
|
local coords = GetEntityCoords(PlayerPedId())
|
||||||
|
isInMarker = false
|
||||||
|
|
||||||
for i=1, #Config.Zones, 1 do
|
for i=1, #Config.Zones, 1 do
|
||||||
if GetDistanceBetweenCoords(coords, Config.Zones[i].x, Config.Zones[i].y, Config.Zones[i].z, true) < (Config.ZoneSize.x / 2) then
|
if GetDistanceBetweenCoords(coords, Config.Zones[i], true) < (Config.ZoneSize.x / 2) then
|
||||||
isInJoblistingMarker = true
|
isInMarker = true
|
||||||
ESX.ShowHelpNotification(_U('access_job_center'))
|
ESX.ShowHelpNotification(_U('access_job_center'))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if isInJoblistingMarker and not hasAlreadyEnteredMarker then
|
if isInMarker and not hasAlreadyEnteredMarker then
|
||||||
hasAlreadyEnteredMarker = true
|
hasAlreadyEnteredMarker = true
|
||||||
end
|
end
|
||||||
|
|
||||||
if not isInJoblistingMarker and hasAlreadyEnteredMarker then
|
if not isInMarker and hasAlreadyEnteredMarker then
|
||||||
hasAlreadyEnteredMarker = false
|
hasAlreadyEnteredMarker = false
|
||||||
TriggerEvent('esx_joblisting:hasExitedMarker')
|
TriggerEvent('esx_joblisting:hasExitedMarker')
|
||||||
end
|
end
|
||||||
@@ -87,7 +88,7 @@ end)
|
|||||||
-- Create blips
|
-- Create blips
|
||||||
Citizen.CreateThread(function()
|
Citizen.CreateThread(function()
|
||||||
for i=1, #Config.Zones, 1 do
|
for i=1, #Config.Zones, 1 do
|
||||||
local blip = AddBlipForCoord(Config.Zones[i].x, Config.Zones[i].y, Config.Zones[i].z)
|
local blip = AddBlipForCoord(Config.Zones[i])
|
||||||
|
|
||||||
SetBlipSprite (blip, 407)
|
SetBlipSprite (blip, 407)
|
||||||
SetBlipDisplay(blip, 4)
|
SetBlipDisplay(blip, 4)
|
||||||
@@ -96,7 +97,7 @@ Citizen.CreateThread(function()
|
|||||||
SetBlipAsShortRange(blip, true)
|
SetBlipAsShortRange(blip, true)
|
||||||
|
|
||||||
BeginTextCommandSetBlipName("STRING")
|
BeginTextCommandSetBlipName("STRING")
|
||||||
AddTextComponentString(_U('job_center'))
|
AddTextComponentSubstringPlayerName(_U('job_center'))
|
||||||
EndTextCommandSetBlipName(blip)
|
EndTextCommandSetBlipName(blip)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
@@ -106,7 +107,7 @@ Citizen.CreateThread(function()
|
|||||||
while true do
|
while true do
|
||||||
Citizen.Wait(10)
|
Citizen.Wait(10)
|
||||||
|
|
||||||
if IsControlJustReleased(0, Keys['E']) and isInJoblistingMarker and not menuIsShowed then
|
if IsControlJustReleased(0, Keys['E']) and isInMarker and not menuIsShowed then
|
||||||
ESX.UI.Menu.CloseAll()
|
ESX.UI.Menu.CloseAll()
|
||||||
ShowJobListingMenu()
|
ShowJobListingMenu()
|
||||||
end
|
end
|
||||||
|
|||||||
+5
-3
@@ -1,10 +1,12 @@
|
|||||||
Config = {}
|
Config = {}
|
||||||
|
|
||||||
Config.DrawDistance = 100.0
|
Config.DrawDistance = 100.0
|
||||||
Config.ZoneSize = {x = 3.0, y = 3.0, z = 2.0}
|
Config.ZoneSize = {x = 3.0, y = 3.0, z = 0.5}
|
||||||
Config.MarkerColor = {r = 100, g = 100, b = 204}
|
Config.MarkerColor = {r = 100, g = 100, b = 204}
|
||||||
Config.MarkerType = 1
|
Config.MarkerType = 1
|
||||||
Config.Locale = 'en'
|
|
||||||
|
Config.Locale = 'fr'
|
||||||
|
|
||||||
Config.Zones = {
|
Config.Zones = {
|
||||||
{x = -265.036, y = -963.630, z = 30.223}
|
vector3(-265.0, -963.6, 30.2)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user