mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-09-01 10:48:52 +00:00
Merge branch 'esx-framework:main' into main
This commit is contained in:
@@ -7,7 +7,7 @@ description 'ESX Ambulance Job'
|
||||
version '1.6.5'
|
||||
|
||||
shared_scripts {
|
||||
'@es_extended/imports.lua'
|
||||
'@es_extended/imports.lua',
|
||||
'@es_extended/locale.lua',
|
||||
'locales/*.lua',
|
||||
'config.lua'
|
||||
|
||||
@@ -32,7 +32,9 @@ end)
|
||||
--drawk marker
|
||||
CreateThread(function()
|
||||
while true do
|
||||
local Sleep = 1500
|
||||
if(inRangeMarkerDrugShop) then
|
||||
Sleep = 0
|
||||
local coordsMarker = Config.CircleZones.DrugDealer.coords
|
||||
local color = cfgMarker.Color
|
||||
DrawMarker(cfgMarker.Type, coordsMarker.x, coordsMarker.y,coordsMarker.z - 1.0,
|
||||
@@ -40,23 +42,22 @@ CreateThread(function()
|
||||
cfgMarker.Size, color.r,color.g,color.b,color.a,
|
||||
false, true, 2, false, nil, nil, false)
|
||||
end
|
||||
Wait(0)
|
||||
Wait(Sleep)
|
||||
end
|
||||
end)
|
||||
|
||||
--main loop
|
||||
CreateThread(function ()
|
||||
while true do
|
||||
if inZoneDrugShop then
|
||||
if(not menuOpen) then
|
||||
ESX.ShowHelpNotification(_U('dealer_prompt'),true)
|
||||
if IsControlJustPressed(0, 38) then
|
||||
OpenDrugShop()
|
||||
end
|
||||
local Sleep = 1500
|
||||
if inZoneDrugShop and not menuOpen then
|
||||
Sleep = 0
|
||||
ESX.ShowHelpNotification(_U('dealer_prompt'),true)
|
||||
if IsControlJustPressed(0, 38) then
|
||||
OpenDrugShop()
|
||||
end
|
||||
end
|
||||
|
||||
Wait(15)
|
||||
Wait(Sleep)
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ end
|
||||
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Wait(0)
|
||||
local Sleep = 1500
|
||||
|
||||
local playerPed = PlayerPedId()
|
||||
local coords = GetEntityCoords(playerPed)
|
||||
@@ -86,6 +86,7 @@ CreateThread(function()
|
||||
end
|
||||
|
||||
if nearbyObject and IsPedOnFoot(playerPed) then
|
||||
Sleep = 0
|
||||
if not isPickingUp then
|
||||
ESX.ShowHelpNotification(_U('weed_pickupprompt'))
|
||||
end
|
||||
@@ -114,9 +115,8 @@ CreateThread(function()
|
||||
isPickingUp = false
|
||||
end, 'cannabis')
|
||||
end
|
||||
else
|
||||
Wait(500)
|
||||
end
|
||||
Wait(Sleep)
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
@@ -1,34 +1,11 @@
|
||||
# esx_joblisting
|
||||
|
||||
Simple job listing script, you can specify what jobs you want to be whitelisted in db.
|
||||
Simple job listing/Job Centre script, you can specify what jobs you want to be whitelisted in db.
|
||||
|
||||
## Download & Installation
|
||||
## Legal
|
||||
|
||||
### Using [fvm](https://github.com/qlaffont/fvm-installer)
|
||||
```
|
||||
fvm install --save --folder=esx esx-org/esx_joblisting
|
||||
```
|
||||
|
||||
### Using Git
|
||||
```
|
||||
cd resources
|
||||
git clone https://github.com/ESX-Org/esx_joblisting [esx]/esx_joblisting
|
||||
```
|
||||
|
||||
### Manually
|
||||
- Download https://github.com/ESX-Org/esx_joblisting/archive/master.zip
|
||||
- Put it in the `[esx]` directory
|
||||
|
||||
## Installation
|
||||
- Import `esx_joblisting.sql` in your database
|
||||
- Add this in your `server.cfg`:
|
||||
|
||||
```
|
||||
start esx_joblisting
|
||||
```
|
||||
|
||||
# Legal
|
||||
### License
|
||||
|
||||
esx_joblisting - job listing script
|
||||
|
||||
Copyright (C) 2015-2022 Jérémie N'gadi
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
local menuIsShowed, hasAlreadyEnteredMarker, isInMarker = false, false, false
|
||||
local menuIsShowed = false
|
||||
|
||||
function ShowJobListingMenu()
|
||||
menuIsShowed = true
|
||||
ESX.TriggerServerCallback('esx_joblisting:getJobsList', function(jobs)
|
||||
local elements = {}
|
||||
|
||||
for i=1, #jobs, 1 do
|
||||
for k,v in pairs(jobs) do
|
||||
table.insert(elements, {
|
||||
label = jobs[i].label,
|
||||
job = jobs[i].job
|
||||
label = v.label,
|
||||
job = k
|
||||
})
|
||||
end
|
||||
|
||||
@@ -18,8 +19,10 @@ function ShowJobListingMenu()
|
||||
}, function(data, menu)
|
||||
TriggerServerEvent('esx_joblisting:setJob', data.current.job)
|
||||
ESX.ShowNotification(_U('new_job'))
|
||||
menuIsShowed = false
|
||||
menu.close()
|
||||
end, function(data, menu)
|
||||
menuIsShowed = false
|
||||
menu.close()
|
||||
end)
|
||||
|
||||
@@ -33,7 +36,7 @@ end)
|
||||
-- Activate menu when player is inside marker, and draw markers
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Wait(0)
|
||||
local Sleep = 1500
|
||||
|
||||
local coords = GetEntityCoords(PlayerPedId())
|
||||
isInMarker = false
|
||||
@@ -42,23 +45,24 @@ CreateThread(function()
|
||||
local distance = #(coords - Config.Zones[i])
|
||||
|
||||
if distance < Config.DrawDistance then
|
||||
Sleep = 0
|
||||
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)
|
||||
else
|
||||
if menuIsShowed then
|
||||
ESX.UI.Menu.CloseAll()
|
||||
menuIsShowed = false
|
||||
end
|
||||
end
|
||||
|
||||
if distance < (Config.ZoneSize.x / 2) then
|
||||
isInMarker = true
|
||||
ESX.ShowHelpNotification(_U('access_job_center'))
|
||||
if IsControlJustReleased(0, 38) and not menuIsShowed then
|
||||
ESX.UI.Menu.CloseAll()
|
||||
ShowJobListingMenu()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if isInMarker and not hasAlreadyEnteredMarker then
|
||||
hasAlreadyEnteredMarker = true
|
||||
end
|
||||
|
||||
if not isInMarker and hasAlreadyEnteredMarker then
|
||||
hasAlreadyEnteredMarker = false
|
||||
TriggerEvent('esx_joblisting:hasExitedMarker')
|
||||
end
|
||||
Wait(Sleep)
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -67,26 +71,14 @@ CreateThread(function()
|
||||
for i=1, #Config.Zones, 1 do
|
||||
local blip = AddBlipForCoord(Config.Zones[i])
|
||||
|
||||
SetBlipSprite (blip, 407)
|
||||
SetBlipDisplay(blip, 4)
|
||||
SetBlipScale (blip, 1.2)
|
||||
SetBlipColour (blip, 27)
|
||||
SetBlipAsShortRange(blip, true)
|
||||
SetBlipSprite (blip, Config.Blip.Sprite)
|
||||
SetBlipDisplay(blip, Config.Blip.Display)
|
||||
SetBlipScale (blip, Config.Blip.Scale)
|
||||
SetBlipColour (blip, Config.Blip.Colour)
|
||||
SetBlipAsShortRange(blip, Config.Blip.ShortRange)
|
||||
|
||||
BeginTextCommandSetBlipName("STRING")
|
||||
AddTextComponentSubstringPlayerName(_U('job_center'))
|
||||
EndTextCommandSetBlipName(blip)
|
||||
end
|
||||
end)
|
||||
|
||||
-- Menu Controls
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Wait(0)
|
||||
|
||||
if IsControlJustReleased(0, 38) and isInMarker and not menuIsShowed then
|
||||
ESX.UI.Menu.CloseAll()
|
||||
ShowJobListingMenu()
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -1,12 +1,20 @@
|
||||
Config = {}
|
||||
|
||||
Config.DrawDistance = 10.0
|
||||
Config.ZoneSize = {x = 3.0, y = 3.0, z = 0.5}
|
||||
Config.MarkerColor = {r = 100, g = 100, b = 204}
|
||||
Config.MarkerType = 1
|
||||
Config.ZoneSize = {x = 2.7, y = 2.7, z = 0.5}
|
||||
Config.MarkerColor = {r = 100, g = 200, b = 104}
|
||||
Config.MarkerType = 27
|
||||
|
||||
Config.Locale = 'en'
|
||||
|
||||
Config.Zones = {
|
||||
vector3(-265.0, -963.6, 30.2)
|
||||
vector3(-265.08, -964.1, 30.3)
|
||||
}
|
||||
|
||||
Config.Blip = {
|
||||
Sprite = 407,
|
||||
Display = 4,
|
||||
Scale = 0.9,
|
||||
Colour = 27,
|
||||
ShortRange = true
|
||||
}
|
||||
@@ -6,36 +6,19 @@ description 'ESX Job Listing'
|
||||
|
||||
version '1.6.5'
|
||||
|
||||
shared_script '@es_extended/imports.lua'
|
||||
|
||||
shared_scripts {
|
||||
'@es_extended/imports.lua',
|
||||
'@es_extended/locale.lua',
|
||||
'config.lua'
|
||||
}
|
||||
server_scripts {
|
||||
'@oxmysql/lib/MySQL.lua',
|
||||
'@es_extended/locale.lua',
|
||||
'config.lua',
|
||||
'locales/de.lua',
|
||||
'locales/br.lua',
|
||||
'locales/en.lua',
|
||||
'locales/fi.lua',
|
||||
'locales/fr.lua',
|
||||
'locales/es.lua',
|
||||
'locales/sv.lua',
|
||||
'locales/pl.lua',
|
||||
'locales/cs.lua',
|
||||
'locales/*.lua',
|
||||
'server/main.lua'
|
||||
}
|
||||
|
||||
client_scripts {
|
||||
'@es_extended/locale.lua',
|
||||
'config.lua',
|
||||
'locales/de.lua',
|
||||
'locales/br.lua',
|
||||
'locales/en.lua',
|
||||
'locales/fi.lua',
|
||||
'locales/fr.lua',
|
||||
'locales/es.lua',
|
||||
'locales/sv.lua',
|
||||
'locales/pl.lua',
|
||||
'locales/cs.lua',
|
||||
'locales/*.lua',
|
||||
'client/main.lua'
|
||||
}
|
||||
|
||||
|
||||
@@ -1,32 +1,37 @@
|
||||
local availableJobs = {}
|
||||
|
||||
MySQL.ready(function()
|
||||
MySQL.query('SELECT name, label FROM jobs WHERE whitelisted = @whitelisted', {
|
||||
['@whitelisted'] = false
|
||||
}, function(result)
|
||||
for i=1, #result, 1 do
|
||||
table.insert(availableJobs, {
|
||||
job = result[i].name,
|
||||
label = result[i].label
|
||||
})
|
||||
end
|
||||
end)
|
||||
end)
|
||||
for k,v in pairs(ESX.Jobs) do
|
||||
print(v.whitelisted)
|
||||
if v.whitelisted == false then
|
||||
availableJobs[k] = {label = v.label}
|
||||
end
|
||||
end
|
||||
|
||||
ESX.RegisterServerCallback('esx_joblisting:getJobsList', function(source, cb)
|
||||
cb(availableJobs)
|
||||
end)
|
||||
|
||||
function IsNearCentre(player)
|
||||
local Ped = GetPlayerPed(player)
|
||||
local PedCoords = GetEntityCoords(Ped)
|
||||
local Zones = Config.Zones
|
||||
|
||||
for i=1, #Config.Zones, 1 do
|
||||
local distance = #(PedCoords - Config.Zones[i])
|
||||
|
||||
if distance < Config.DrawDistance then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
RegisterServerEvent('esx_joblisting:setJob')
|
||||
AddEventHandler('esx_joblisting:setJob', function(job)
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
if xPlayer then
|
||||
for k,v in ipairs(availableJobs) do
|
||||
if v.job == job then
|
||||
xPlayer.setJob(job, 0)
|
||||
break
|
||||
end
|
||||
if xPlayer and IsNearCentre(source) then
|
||||
if availableJobs[job] then
|
||||
xPlayer.setJob(job, 0)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -1,34 +1,11 @@
|
||||
# esx_lscustom
|
||||
|
||||
## Requirements
|
||||
|
||||
- [esx_vehicleshop](https://github.com/ESX-Org/esx_vehicleshop)
|
||||
|
||||
## Download & Installation
|
||||
## Legal
|
||||
|
||||
### Using [fvm](https://github.com/qlaffont/fvm-installer)
|
||||
```
|
||||
fvm install --save --folder=esx esx-org/esx_lscustom
|
||||
```
|
||||
|
||||
### Using Git
|
||||
```
|
||||
cd resources
|
||||
git clone https://github.com/ESX-Org/esx_lscustom [esx]/esx_lscustom
|
||||
```
|
||||
|
||||
### Manually
|
||||
- Download https://github.com/ESX-Org/esx_lscustom/archive/master.zip
|
||||
- Put it in the `[esx]` directory
|
||||
|
||||
## Installation
|
||||
- Add this to your `server.cfg`:
|
||||
|
||||
```
|
||||
start esx_lscustom
|
||||
```
|
||||
|
||||
# Legal
|
||||
### License
|
||||
esx_lscustoms - The best LS Custom out there for FX
|
||||
|
||||
Copyright (C) 2015-2022 Jérémie N'gadi
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
local Vehicles = {}
|
||||
local lsMenuIsShowed = false
|
||||
local isInLSMarker = false
|
||||
local myCar = {}
|
||||
|
||||
local Vehicles, myCar = {},{}
|
||||
local lsMenuIsShowed, isInLSMarker = false, false
|
||||
|
||||
RegisterNetEvent('esx:playerLoaded')
|
||||
AddEventHandler('esx:playerLoaded', function(xPlayer)
|
||||
ESX.PlayerData = xPlayer
|
||||
ESX.PlayerLoaded = true
|
||||
|
||||
ESX.TriggerServerCallback('esx_lscustom:getVehiclesPrices', function(vehicles)
|
||||
@@ -14,11 +10,6 @@ AddEventHandler('esx:playerLoaded', function(xPlayer)
|
||||
end)
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:setJob')
|
||||
AddEventHandler('esx:setJob', function(job)
|
||||
ESX.PlayerData.job = job
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx_lscustom:installMod')
|
||||
AddEventHandler('esx_lscustom:installMod', function()
|
||||
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
|
||||
@@ -378,7 +369,7 @@ end)
|
||||
-- Activate menu when player is inside marker
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Wait(0)
|
||||
local Sleep = 1500
|
||||
local playerPed = PlayerPedId()
|
||||
|
||||
if IsPedInAnyVehicle(playerPed, false) then
|
||||
@@ -389,57 +380,36 @@ CreateThread(function()
|
||||
for k,v in pairs(Config.Zones) do
|
||||
local zonePos = vector3(v.Pos.x, v.Pos.y, v.Pos.z)
|
||||
if #(coords - zonePos) < v.Size.x and not lsMenuIsShowed then
|
||||
isInLSMarker = true
|
||||
Sleep = 0
|
||||
ESX.ShowHelpNotification(v.Hint)
|
||||
break
|
||||
else
|
||||
isInLSMarker = false
|
||||
if IsControlJustReleased(0, 38) then
|
||||
lsMenuIsShowed = true
|
||||
|
||||
local vehicle = GetVehiclePedIsIn(playerPed, false)
|
||||
FreezeEntityPosition(vehicle, true)
|
||||
myCar = ESX.Game.GetVehicleProperties(vehicle)
|
||||
|
||||
ESX.UI.Menu.CloseAll()
|
||||
GetAction({value = 'main'})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if IsControlJustReleased(0, 38) and not lsMenuIsShowed and isInLSMarker then
|
||||
if (ESX.PlayerData.job and ESX.PlayerData.job.name == 'mechanic') or not Config.IsMechanicJobOnly then
|
||||
lsMenuIsShowed = true
|
||||
|
||||
local vehicle = GetVehiclePedIsIn(playerPed, false)
|
||||
FreezeEntityPosition(vehicle, true)
|
||||
|
||||
myCar = ESX.Game.GetVehicleProperties(vehicle)
|
||||
|
||||
ESX.UI.Menu.CloseAll()
|
||||
GetAction({value = 'main'})
|
||||
end
|
||||
end
|
||||
|
||||
if isInLSMarker and not hasAlreadyEnteredMarker then
|
||||
hasAlreadyEnteredMarker = true
|
||||
end
|
||||
|
||||
if not isInLSMarker and hasAlreadyEnteredMarker then
|
||||
hasAlreadyEnteredMarker = false
|
||||
end
|
||||
|
||||
end
|
||||
Wait(Sleep)
|
||||
end
|
||||
end)
|
||||
|
||||
-- Prevent Free Tunning Bug
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Wait(0)
|
||||
|
||||
if lsMenuIsShowed then
|
||||
DisableControlAction(2, 288, true)
|
||||
DisableControlAction(2, 289, true)
|
||||
DisableControlAction(2, 170, true)
|
||||
DisableControlAction(2, 167, true)
|
||||
DisableControlAction(2, 168, true)
|
||||
DisableControlAction(2, 23, true)
|
||||
DisableControlAction(0, 75, true) -- Disable exit vehicle
|
||||
DisableControlAction(27, 75, true) -- Disable exit vehicle
|
||||
else
|
||||
Wait(500)
|
||||
end
|
||||
while lsMenuIsShowed do
|
||||
DisableControlAction(2, 288, true)
|
||||
DisableControlAction(2, 289, true)
|
||||
DisableControlAction(2, 170, true)
|
||||
DisableControlAction(2, 167, true)
|
||||
DisableControlAction(2, 168, true)
|
||||
DisableControlAction(2, 23, true)
|
||||
DisableControlAction(0, 75, true) -- Disable exit vehicle
|
||||
DisableControlAction(27, 75, true) -- Disable exit vehicle
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -771,9 +771,10 @@ end)
|
||||
-- Pop NPC mission vehicle when inside area
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Wait(0)
|
||||
local Sleep = 1500
|
||||
|
||||
if NPCTargetTowableZone and not NPCHasSpawnedTowable then
|
||||
Sleep = 0
|
||||
local coords = GetEntityCoords(PlayerPedId())
|
||||
local zone = Config.Zones[NPCTargetTowableZone]
|
||||
|
||||
@@ -789,14 +790,17 @@ CreateThread(function()
|
||||
end
|
||||
|
||||
if NPCTargetTowableZone and NPCHasSpawnedTowable and not NPCHasBeenNextToTowable then
|
||||
Sleep = 500
|
||||
local coords = GetEntityCoords(PlayerPedId())
|
||||
local zone = Config.Zones[NPCTargetTowableZone]
|
||||
|
||||
if #(coords - zone.Pos) < Config.NPCNextToDistance then
|
||||
Sleep = 0
|
||||
ESX.ShowNotification(_U('please_tow'))
|
||||
NPCHasBeenNextToTowable = true
|
||||
end
|
||||
end
|
||||
Wait(Sleep)
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -818,31 +822,28 @@ end)
|
||||
-- Display markers
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Wait(0)
|
||||
local Sleep = 2000
|
||||
|
||||
if ESX.PlayerData.job and ESX.PlayerData.job.name == 'mechanic' then
|
||||
Sleep = 500
|
||||
local coords, letSleep = GetEntityCoords(PlayerPedId()), true
|
||||
|
||||
for k,v in pairs(Config.Zones) do
|
||||
if v.Type ~= -1 and #(coords - v.Pos) < Config.DrawDistance then
|
||||
Sleep = 0
|
||||
DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 0.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, nil, nil, false)
|
||||
letSleep = false
|
||||
end
|
||||
end
|
||||
|
||||
if letSleep then
|
||||
Wait(500)
|
||||
end
|
||||
else
|
||||
Wait(500)
|
||||
end
|
||||
Wait(Sleep)
|
||||
end
|
||||
end)
|
||||
|
||||
-- Enter / Exit marker events
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Wait(0)
|
||||
local Sleep = 500
|
||||
|
||||
if ESX.PlayerData.job and ESX.PlayerData.job.name == 'mechanic' then
|
||||
|
||||
@@ -852,6 +853,7 @@ CreateThread(function()
|
||||
|
||||
for k,v in pairs(Config.Zones) do
|
||||
if(#(coords - v.Pos) < v.Size.x) then
|
||||
Sleep = 0
|
||||
isInMarker = true
|
||||
currentZone = k
|
||||
end
|
||||
@@ -867,8 +869,8 @@ CreateThread(function()
|
||||
HasAlreadyEnteredMarker = false
|
||||
TriggerEvent('esx_mechanicjob:hasExitedMarker', LastZone)
|
||||
end
|
||||
|
||||
end
|
||||
Wait(Sleep)
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -917,10 +919,8 @@ end)
|
||||
|
||||
-- Key Controls
|
||||
CreateThread(function()
|
||||
while true do
|
||||
while CurrentAction do
|
||||
Wait(0)
|
||||
|
||||
if CurrentAction then
|
||||
ESX.ShowHelpNotification(CurrentActionMsg)
|
||||
|
||||
if IsControlJustReleased(0, 38) and ESX.PlayerData.job and ESX.PlayerData.job.name == 'mechanic' then
|
||||
@@ -983,8 +983,6 @@ CreateThread(function()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end)
|
||||
|
||||
AddEventHandler('esx:onPlayerDeath', function(data) isDead = true end)
|
||||
|
||||
@@ -860,17 +860,15 @@ CreateThread(function()
|
||||
end
|
||||
|
||||
if letSleep then
|
||||
Wait(500)
|
||||
Wait(1500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- Key controls
|
||||
CreateThread(function()
|
||||
while true do
|
||||
while CurrentAction do
|
||||
Wait(0)
|
||||
|
||||
if CurrentAction then
|
||||
ESX.ShowHelpNotification(CurrentActionMsg)
|
||||
|
||||
if IsControlJustReleased(0, 38) then
|
||||
@@ -890,8 +888,5 @@ CreateThread(function()
|
||||
|
||||
CurrentAction = nil
|
||||
end
|
||||
else
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Config = {}
|
||||
|
||||
Config.DrawDistance = 100
|
||||
Config.DrawDistance = 10.0
|
||||
Config.MarkerSize = {x = 1.5, y = 1.5, z = 1.0}
|
||||
Config.MarkerColor = {r = 102, g = 102, b = 204}
|
||||
Config.RoomMenuMarkerColor = {r = 102, g = 204, b = 102}
|
||||
|
||||
@@ -225,22 +225,24 @@ end)
|
||||
-- Display markers
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Wait(0)
|
||||
local Sleep = 1500
|
||||
|
||||
local coords = GetEntityCoords(PlayerPedId())
|
||||
|
||||
for k,v in pairs(Config.Zones) do
|
||||
if(v.Type ~= -1 and #(coords - v.Pos) < Config.DrawDistance) then
|
||||
Sleep = 0
|
||||
DrawMarker(v.Type, 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, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false)
|
||||
end
|
||||
end
|
||||
Wait(Sleep)
|
||||
end
|
||||
end)
|
||||
|
||||
-- Enter / Exit marker events
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Wait(0)
|
||||
local Sleep = 500
|
||||
|
||||
local coords = GetEntityCoords(PlayerPedId())
|
||||
local isInMarker = false
|
||||
@@ -248,6 +250,7 @@ CreateThread(function()
|
||||
|
||||
for k,v in pairs(Config.Zones) do
|
||||
if #(coords - v.Pos) < v.Size.x then
|
||||
Sleep = 0
|
||||
isInMarker = true
|
||||
currentZone = k
|
||||
end
|
||||
@@ -263,15 +266,14 @@ CreateThread(function()
|
||||
hasAlreadyEnteredMarker = false
|
||||
TriggerEvent('esx_realestateagentjob:hasExitedMarker', LastZone)
|
||||
end
|
||||
Wait(Sleep)
|
||||
end
|
||||
end)
|
||||
|
||||
-- Key controls
|
||||
CreateThread(function()
|
||||
while true do
|
||||
while CurrentAction do
|
||||
Wait(0)
|
||||
|
||||
if CurrentAction then
|
||||
ESX.ShowHelpNotification(CurrentActionMsg)
|
||||
|
||||
if IsControlJustReleased(0, 38) then
|
||||
@@ -281,9 +283,6 @@ CreateThread(function()
|
||||
|
||||
CurrentAction = nil
|
||||
end
|
||||
else
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
@@ -495,10 +495,9 @@ end)
|
||||
|
||||
-- Enter / Exit marker events, and draw markers
|
||||
CreateThread(function()
|
||||
while true do
|
||||
while ESX.PlayerData.job and ESX.PlayerData.job.name == 'taxi' do
|
||||
Wait(0)
|
||||
|
||||
if ESX.PlayerData.job and ESX.PlayerData.job.name == 'taxi' then
|
||||
local coords = GetEntityCoords(PlayerPedId())
|
||||
local isInMarker, letSleep, currentZone = false, true
|
||||
|
||||
@@ -529,20 +528,14 @@ CreateThread(function()
|
||||
if letSleep then
|
||||
Wait(500)
|
||||
end
|
||||
else
|
||||
Wait(1000)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- Taxi Job
|
||||
CreateThread(function()
|
||||
while true do
|
||||
|
||||
while OnJob do
|
||||
Wait(0)
|
||||
local playerPed = PlayerPedId()
|
||||
|
||||
if OnJob then
|
||||
local playerPed = PlayerPedId()
|
||||
if CurrentCustomer == nil then
|
||||
DrawSub(_U('drive_search_pass'), 5000)
|
||||
|
||||
@@ -695,9 +688,6 @@ CreateThread(function()
|
||||
else
|
||||
DrawSub(_U('return_to_veh'), 5000)
|
||||
end
|
||||
end
|
||||
else
|
||||
Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
@@ -717,10 +707,8 @@ end)
|
||||
|
||||
-- Key Controls
|
||||
CreateThread(function()
|
||||
while true do
|
||||
while CurrentAction and not ESX.PlayerData.dead do
|
||||
Wait(0)
|
||||
|
||||
if CurrentAction and not ESX.GetPlayerData().dead then
|
||||
ESX.ShowHelpNotification(CurrentActionMsg)
|
||||
|
||||
if IsControlJustReleased(0, 38) and ESX.PlayerData.job and ESX.PlayerData.job.name == 'taxi' then
|
||||
@@ -737,7 +725,6 @@ CreateThread(function()
|
||||
CurrentAction = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
RegisterCommand('taximenu', function()
|
||||
if not ESX.GetPlayerData().dead and Config.EnablePlayerManagement and ESX.PlayerData.job and ESX.PlayerData.job.name == 'taxi' then
|
||||
|
||||
Reference in New Issue
Block a user