Fix: ESX Jobs

This commit is contained in:
Mycroft
2022-03-24 19:54:45 +00:00
parent 5fe0a660bd
commit 20b6f534c6
2 changed files with 27 additions and 61 deletions
+18 -16
View File
@@ -30,7 +30,6 @@ local vehicleMaxHealth = nil
RegisterNetEvent('esx:playerLoaded')
AddEventHandler('esx:playerLoaded', function(xPlayer)
ESX.PlayerData = xPlayer
refreshBlips()
end)
@@ -230,7 +229,6 @@ function refreshBlips()
if ESX.PlayerData.job ~= nil then
for jobKey,jobValues in pairs(Config.Jobs) do
if jobKey == ESX.PlayerData.job.name then
for zoneKey,zoneValues in pairs(jobValues.Zones) do
@@ -245,11 +243,10 @@ function refreshBlips()
else
_Pos = zoneValues.Pos
end
print(_Pos.x)
local blip = AddBlipForCoord(_Pos.x, _Pos.y, _Pos.z)
SetBlipSprite (blip, jobValues.BlipInfos.Sprite)
SetBlipDisplay (blip, 4)
SetBlipScale (blip, 1.2)
SetBlipScale (blip, 0.0)
SetBlipCategory(blip, 3)
SetBlipColour (blip, jobValues.BlipInfos.Color)
SetBlipAsShortRange(blip, true)
@@ -301,21 +298,16 @@ end)
-- Show top left hint
CreateThread(function()
while true do
while hintIsShowed do
Wait(0)
if hintIsShowed then
ESX.ShowHelpNotification(hintToDisplay)
else
Wait(500)
end
ESX.ShowHelpNotification(hintToDisplay)
end
end)
-- Display markers (only if on duty and the player's job ones)
CreateThread(function()
while true do
Wait(0)
local Sleep = 1500
local zones = {}
if ESX.PlayerData.job ~= nil then
@@ -332,18 +324,22 @@ CreateThread(function()
TriggerEvent("izone:getZoneCenter", v.Zone, function(center)
if (not(center == nil)) then
if(v.Marker ~= -1 and #(coords - center) < Config.DrawDistance) then
Sleep = 0
DrawMarker(v.Marker, center.x, center.y, center.z - 1, 0.0, 0.0, 0.0, 0, 0.0, 0.0, v.Size.x, v.Size.y, v.Size.z, v.Color.r, v.Color.g, v.Color.b, 100, false, true, 2, false, false, false, false)
end
end
end)
else
if(v.Marker ~= -1 and #(coords - v.Pos) < Config.DrawDistance) then
local Pos = vector3(v.Pos.x, v.Pos.y, v.Pos.z)
if(v.Marker ~= -1 and #(coords - Pos) < Config.DrawDistance) then
Sleep = 0
DrawMarker(v.Marker, v.Pos.x, v.Pos.y, v.Pos.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, v.Size.x, v.Size.y, v.Size.z, v.Color.r, v.Color.g, v.Color.b, 100, false, true, 2, false, false, false, false)
end
end
end
end
end
Wait(Sleep)
end
end)
@@ -363,13 +359,14 @@ end)
-- Activate public marker
CreateThread(function()
while true do
Wait(0)
local Sleep = 1500
local coords = GetEntityCoords(PlayerPedId())
local position = nil
local zone = nil
for k,v in pairs(Config.PublicZones) do
if #(coords - v.Pos) < v.Size.x/2 then
Sleep = 0
isInPublicMarker = true
position = v.Teleport
zone = v
@@ -394,6 +391,7 @@ CreateThread(function()
hintIsShowed = false
end
end
Wait(Sleep)
end
end)
@@ -401,7 +399,7 @@ end)
CreateThread(function()
while true do
Wait(0)
local Sleep = 1500
if ESX.PlayerData.job ~= nil and ESX.PlayerData.job.name ~= 'unemployed' then
local zones = nil
@@ -425,6 +423,7 @@ CreateThread(function()
if v.Zone then
TriggerEvent("izone:isPlayerInZone", v.Zone, function(isIn)
if isIn then
Sleep = 0
isInMarker = true
currentZone = k
zone = v
@@ -439,7 +438,9 @@ CreateThread(function()
end
-- Else use radius defined from center
else
if #(coords - v.Pos) < v.Size.x then
local Pos = vector3(v.Pos.x, v.Pos.y, v.Pos.z)
if #(coords - Pos) < v.Size.x then
Sleep = 0
isInMarker = true
currentZone = k
zone = v
@@ -509,6 +510,7 @@ CreateThread(function()
end
end
end
Wait(Sleep)
end
end)
+9 -45
View File
@@ -2,60 +2,24 @@ fx_version 'adamant'
game 'gta5'
description 'ESX Jobs'
description 'ESX Job Listing'
version '1.6.5'
shared_script '@es_extended/imports.lua'
server_scripts {
shared_scripts {
'@es_extended/imports.lua',
'@es_extended/locale.lua',
'locales/br.lua',
'locales/en.lua',
'locales/es.lua',
'locales/fi.lua',
'locales/fr.lua',
'locales/sv.lua',
'locales/cs.lua',
'locales/de.lua',
'config.lua',
'jobs/fisherman.lua',
'jobs/fueler.lua',
'jobs/lumberjack.lua',
'jobs/miner.lua',
'jobs/reporter.lua',
'jobs/slaughterer.lua',
'jobs/tailor.lua',
'jobs/*.lua',
'locales/*.lua',
}
server_scripts {
'@oxmysql/lib/MySQL.lua',
'server/main.lua'
}
client_scripts {
'@es_extended/locale.lua',
'locales/br.lua',
'locales/fi.lua',
'locales/en.lua',
'locales/es.lua',
'locales/fr.lua',
'locales/sv.lua',
'locales/cs.lua',
'config.lua',
'jobs/fisherman.lua',
'jobs/fueler.lua',
'jobs/lumberjack.lua',
'jobs/miner.lua',
'jobs/reporter.lua',
'jobs/slaughterer.lua',
'jobs/tailor.lua',
'client/main.lua'
}
dependencies {
'es_extended',
'esx_addonaccount',
'skinchanger',
'esx_skin'
}
dependency 'es_extended'