Removed freezing in zones

This commit is contained in:
ElPumpo
2018-10-01 20:08:15 +02:00
parent ed62ba70d4
commit 83a031ff88
8 changed files with 13 additions and 49 deletions
+13 -42
View File
@@ -22,7 +22,6 @@ local opium_poochQTE = 0
local myJob = nil
local HasAlreadyEnteredMarker = false
local LastZone = nil
local isInZone = false
local CurrentAction = nil
local CurrentActionMsg = ''
local CurrentActionData = {}
@@ -41,12 +40,6 @@ AddEventHandler('esx_drugs:hasEnteredMarker', function(zone)
ESX.UI.Menu.CloseAll()
if zone == 'exitMarker' then
CurrentAction = zone
CurrentActionMsg = _U('exit_marker')
CurrentActionData = {}
end
if zone == 'CokeField' then
CurrentAction = zone
CurrentActionMsg = _U('press_collect_coke')
@@ -191,7 +184,7 @@ Citizen.CreateThread(function()
local coords = GetEntityCoords(GetPlayerPed(-1))
for k,v in pairs(Config.Zones) do
if(GetDistanceBetweenCoords(coords, v.x, v.y, v.z, true) < Config.DrawDistance) then
if GetDistanceBetweenCoords(coords, v.x, v.y, v.z, true) < Config.DrawDistance then
DrawMarker(Config.MarkerType, v.x, v.y, v.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)
end
end
@@ -222,15 +215,15 @@ end
-- RETURN NUMBER OF ITEMS FROM SERVER
RegisterNetEvent('esx_drugs:ReturnInventory')
AddEventHandler('esx_drugs:ReturnInventory', function(cokeNbr, cokepNbr, methNbr, methpNbr, weedNbr, weedpNbr, opiumNbr, opiumpNbr, jobName, currentZone)
cokeQTE = cokeNbr
coke_poochQTE = cokepNbr
methQTE = methNbr
meth_poochQTE = methpNbr
weedQTE = weedNbr
weed_poochQTE = weedpNbr
opiumQTE = opiumNbr
opium_poochQTE = opiumpNbr
myJob = jobName
cokeQTE = cokeNbr
coke_poochQTE = cokepNbr
methQTE = methNbr
meth_poochQTE = methpNbr
weedQTE = weedNbr
weed_poochQTE = weedpNbr
opiumQTE = opiumNbr
opium_poochQTE = opiumpNbr
myJob = jobName
TriggerEvent('esx_drugs:hasEnteredMarker', currentZone)
end)
@@ -261,10 +254,6 @@ Citizen.CreateThread(function()
hasAlreadyEnteredMarker = false
TriggerEvent('esx_drugs:hasExitedMarker', lastZone)
end
if isInMarker and isInZone then
TriggerEvent('esx_drugs:hasEnteredMarker', 'exitMarker')
end
end
end)
@@ -273,17 +262,10 @@ Citizen.CreateThread(function()
while true do
Citizen.Wait(10)
if CurrentAction ~= nil then
SetTextComponentFormat('STRING')
AddTextComponentString(CurrentActionMsg)
DisplayHelpTextFromStringLabel(0, 0, 1, -1)
ESX.ShowHelpNotification(CurrentActionMsg)
if IsControlJustReleased(0, Keys['E']) then
isInZone = true -- unless we set this boolean to false, we will always freeze the user
if CurrentAction == 'exitMarker' then
isInZone = false -- do not freeze user
TriggerEvent('esx_drugs:freezePlayer', false)
TriggerEvent('esx_drugs:hasExitedMarker', lastZone)
Citizen.Wait(15000)
elseif CurrentAction == 'CokeField' then
if CurrentAction == 'CokeField' then
TriggerServerEvent('esx_drugs:startHarvestCoke')
elseif CurrentAction == 'CokeProcessing' then
TriggerServerEvent('esx_drugs:startTransformCoke')
@@ -307,12 +289,6 @@ Citizen.CreateThread(function()
TriggerServerEvent('esx_drugs:startTransformOpium')
elseif CurrentAction == 'OpiumDealer' then
TriggerServerEvent('esx_drugs:startSellOpium')
else
isInZone = false -- not a esx_drugs zone
end
if isInZone then
TriggerEvent('esx_drugs:freezePlayer', true)
end
CurrentAction = nil
@@ -320,8 +296,3 @@ Citizen.CreateThread(function()
end
end
end)
RegisterNetEvent('esx_drugs:freezePlayer')
AddEventHandler('esx_drugs:freezePlayer', function(freeze)
FreezeEntityPosition(GetPlayerPed(-1), freeze)
end)
-1
View File
@@ -31,7 +31,6 @@ Locales['br'] = {
['not_enough_opium'] = 'Você não tem ópio suficiente para ~r~embalar~s~',
['sold_one_opium'] = 'Você vendeu ~g~x1 Trouxinha de ópio~s~',
['used_one_opium'] = 'Você usou 1 trouxinha de ~b~ópio',
['exit_marker'] = 'press ~INPUT_CONTEXT~ to cancel the ~y~process~s~',
-- Blips
['coke_field'] = 'cocaine Field',
['coke_processing'] = 'cocaine Processing',
-1
View File
@@ -31,7 +31,6 @@ Locales['de'] = {
['not_enough_opium'] = 'du hast nicht genug Opium zum ~r~verarbeiten~s~',
['sold_one_opium'] = 'du verkaufst ~g~x1 Portion Opium~s~',
['used_one_opium'] = 'du benutzt 1x ~b~Opium',
['exit_marker'] = 'press ~INPUT_CONTEXT~ to cancel the ~y~process~s~',
-- Blips
['coke_field'] = 'cocaine Field',
['coke_processing'] = 'cocaine Processing',
-1
View File
@@ -31,7 +31,6 @@ Locales['en'] = {
['not_enough_opium'] = 'you do not have enough opium to ~r~pack~s~',
['sold_one_opium'] = 'you\'ve sold ~g~x1 opium Pouch~s~',
['used_one_opium'] = 'you used 1 pouch of ~b~opium',
['exit_marker'] = 'press ~INPUT_CONTEXT~ to cancel the ~y~process~s~',
-- Blips
['coke_field'] = 'cocaine Field',
['coke_processing'] = 'cocaine Processing',
-1
View File
@@ -31,7 +31,6 @@ Locales['es'] = {
['not_enough_opium'] = 'No tienes sufiente Opio para ~r~fabricar~s~',
['sold_one_opium'] = 'Has vendido ~g~1 Bolsa de Opio~s~',
['used_one_opium'] = 'Has gastado una bolsa de ~b~Opio',
['exit_marker'] = 'press ~INPUT_CONTEXT~ to cancel the ~y~process~s~',
-- Blips
['coke_field'] = 'cocaine Field',
['coke_processing'] = 'cocaine Processing',
-1
View File
@@ -31,7 +31,6 @@ Locales['fr'] = {
['not_enough_opium'] = 'vous n\'avez pas assez de opium à ~r~conditionner~s~',
['sold_one_opium'] = 'vous avez vendu ~g~x1 Pochon de opium~s~',
['used_one_opium'] = 'Vous avez utilisé 1 Pochon de ~b~opium',
['exit_marker'] = 'press ~INPUT_CONTEXT~ to cancel the ~y~process~s~',
-- Blips
['coke_field'] = 'cocaine Field',
['coke_processing'] = 'cocaine Processing',
-1
View File
@@ -31,7 +31,6 @@ Locales['pl'] = {
['not_enough_opium'] = 'nie masz wystarczająco opium aby je ~r~spakować~s~',
['sold_one_opium'] = 'sprzedajesz ~g~x1 torebeczka opium~s~',
['used_one_opium'] = 'wciągasz 1x torebeczka ~b~opium',
['exit_marker'] = 'naciśnij ~INPUT_CONTEXT~ aby ~y~przerwać~s~ akcje',
-- Blips
['coke_field'] = 'plantacja kokainy',
['coke_processing'] = 'przeróbka liści kokainy',
-1
View File
@@ -31,7 +31,6 @@ Locales['sv'] = {
['not_enough_opium'] = 'Du har inte tillräckligt med opium för att ~r~bearbeta~s~',
['sold_one_opium'] = 'du har sålt ~y~1x~s~ ~b~väska med opium~s~',
['used_one_opium'] = 'Du använde 1 väska ~b~opium',
['exit_marker'] = 'tryck ~INPUT_CONTEXT~ för att avbryta pågående process',
-- Blips
['coke_field'] = 'coke field',
['coke_processing'] = 'coke processing',