Tweak: ESX Drugs - Optimisations

This commit is contained in:
Mycroft
2022-03-24 20:50:12 +00:00
parent 7329ac43bd
commit abb18fe4a9
2 changed files with 13 additions and 12 deletions
+10 -9
View File
@@ -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)
+3 -3
View File
@@ -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)