mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-30 17:58:54 +00:00
Minor cleanup
This commit is contained in:
+182
-244
@@ -1,15 +1,3 @@
|
||||
local Keys = {
|
||||
["ESC"] = 322, ["F1"] = 288, ["F2"] = 289, ["F3"] = 170, ["F5"] = 166, ["F6"] = 167, ["F7"] = 168, ["F8"] = 169, ["F9"] = 56, ["F10"] = 57,
|
||||
["~"] = 243, ["1"] = 157, ["2"] = 158, ["3"] = 160, ["4"] = 164, ["5"] = 165, ["6"] = 159, ["7"] = 161, ["8"] = 162, ["9"] = 163, ["-"] = 84, ["="] = 83, ["BACKSPACE"] = 177,
|
||||
["TAB"] = 37, ["Q"] = 44, ["W"] = 32, ["E"] = 38, ["R"] = 45, ["T"] = 245, ["Y"] = 246, ["U"] = 303, ["P"] = 199, ["["] = 39, ["]"] = 40, ["ENTER"] = 18,
|
||||
["CAPS"] = 137, ["A"] = 34, ["S"] = 8, ["D"] = 9, ["F"] = 23, ["G"] = 47, ["H"] = 74, ["K"] = 311, ["L"] = 182,
|
||||
["LEFTSHIFT"] = 21, ["Z"] = 20, ["X"] = 73, ["C"] = 26, ["V"] = 0, ["B"] = 29, ["N"] = 249, ["M"] = 244, [","] = 82, ["."] = 81,
|
||||
["LEFTCTRL"] = 36, ["LEFTALT"] = 19, ["SPACE"] = 22, ["RIGHTCTRL"] = 70,
|
||||
["HOME"] = 213, ["PAGEUP"] = 10, ["PAGEDOWN"] = 11, ["DELETE"] = 178,
|
||||
["LEFT"] = 174, ["RIGHT"] = 175, ["TOP"] = 27, ["DOWN"] = 173,
|
||||
["NENTER"] = 201, ["N4"] = 108, ["N5"] = 60, ["N6"] = 107, ["N+"] = 96, ["N-"] = 97, ["N7"] = 117, ["N8"] = 61, ["N9"] = 118
|
||||
}
|
||||
|
||||
local HasAlreadyEnteredMarker, LastZone = false, nil
|
||||
local CurrentAction, CurrentActionMsg, CurrentActionData = nil, '', {}
|
||||
local CurrentlyTowedVehicle, Blips, NPCOnJob, NPCTargetTowable, NPCTargetTowableZone = nil, {}, false, nil, nil
|
||||
@@ -80,7 +68,6 @@ function StopNPCJob(cancel)
|
||||
end
|
||||
|
||||
function OpenMechanicActionsMenu()
|
||||
|
||||
local elements = {
|
||||
{label = _U('vehicle_list'), value = 'vehicle_list'},
|
||||
{label = _U('work_wear'), value = 'cloakroom'},
|
||||
@@ -101,7 +88,6 @@ function OpenMechanicActionsMenu()
|
||||
elements = elements
|
||||
}, function(data, menu)
|
||||
if data.current.value == 'vehicle_list' then
|
||||
|
||||
if Config.EnableSocietyOwnedVehicles then
|
||||
|
||||
local elements = {}
|
||||
@@ -177,9 +163,7 @@ function OpenMechanicActionsMenu()
|
||||
end)
|
||||
|
||||
end
|
||||
|
||||
elseif data.current.value == 'cloakroom' then
|
||||
|
||||
menu.close()
|
||||
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin)
|
||||
if skin.sex == 0 then
|
||||
@@ -188,14 +172,11 @@ function OpenMechanicActionsMenu()
|
||||
TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_female)
|
||||
end
|
||||
end)
|
||||
|
||||
elseif data.current.value == 'cloakroom2' then
|
||||
|
||||
menu.close()
|
||||
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin)
|
||||
TriggerEvent('skinchanger:loadSkin', skin)
|
||||
end)
|
||||
|
||||
elseif data.current.value == 'put_stock' then
|
||||
OpenPutStocksMenu()
|
||||
elseif data.current.value == 'get_stock' then
|
||||
@@ -205,7 +186,6 @@ function OpenMechanicActionsMenu()
|
||||
menu.close()
|
||||
end)
|
||||
end
|
||||
|
||||
end, function(data, menu)
|
||||
menu.close()
|
||||
|
||||
@@ -216,9 +196,7 @@ function OpenMechanicActionsMenu()
|
||||
end
|
||||
|
||||
function OpenMechanicHarvestMenu()
|
||||
|
||||
if Config.EnablePlayerManagement and ESX.PlayerData.job and ESX.PlayerData.job.grade_name ~= 'recrue' then
|
||||
|
||||
local elements = {
|
||||
{label = _U('gas_can'), value = 'gaz_bottle'},
|
||||
{label = _U('repair_tools'), value = 'fix_tool'},
|
||||
@@ -247,7 +225,6 @@ function OpenMechanicHarvestMenu()
|
||||
CurrentActionMsg = _U('harvest_menu')
|
||||
CurrentActionData = {}
|
||||
end)
|
||||
|
||||
else
|
||||
ESX.ShowNotification(_U('not_experienced_enough'))
|
||||
end
|
||||
@@ -255,7 +232,6 @@ end
|
||||
|
||||
function OpenMechanicCraftMenu()
|
||||
if Config.EnablePlayerManagement and ESX.PlayerData.job and ESX.PlayerData.job.grade_name ~= 'recrue' then
|
||||
|
||||
local elements = {
|
||||
{label = _U('blowtorch'), value = 'blow_pipe'},
|
||||
{label = _U('repair_kit'), value = 'fix_kit'},
|
||||
@@ -285,14 +261,12 @@ function OpenMechanicCraftMenu()
|
||||
CurrentActionMsg = _U('craft_menu')
|
||||
CurrentActionData = {}
|
||||
end)
|
||||
|
||||
else
|
||||
ESX.ShowNotification(_U('not_experienced_enough'))
|
||||
end
|
||||
end
|
||||
|
||||
function OpenMobileMechanicActionsMenu()
|
||||
|
||||
ESX.UI.Menu.CloseAll()
|
||||
|
||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'mobile_mechanic_actions', {
|
||||
@@ -306,12 +280,10 @@ function OpenMobileMechanicActionsMenu()
|
||||
{label = _U('imp_veh'), value = 'del_vehicle'},
|
||||
{label = _U('flat_bed'), value = 'dep_vehicle'},
|
||||
{label = _U('place_objects'), value = 'object_spawner'}
|
||||
}
|
||||
}, function(data, menu)
|
||||
}}, function(data, menu)
|
||||
if isBusy then return end
|
||||
|
||||
if data.current.value == 'billing' then
|
||||
|
||||
ESX.UI.Menu.Open('dialog', GetCurrentResourceName(), 'billing', {
|
||||
title = _U('invoice_amount')
|
||||
}, function(data, menu)
|
||||
@@ -331,229 +303,207 @@ function OpenMobileMechanicActionsMenu()
|
||||
end, function(data, menu)
|
||||
menu.close()
|
||||
end)
|
||||
|
||||
elseif data.current.value == 'hijack_vehicle' then
|
||||
local playerPed = PlayerPedId()
|
||||
local vehicle = ESX.Game.GetVehicleInDirection()
|
||||
local coords = GetEntityCoords(playerPed)
|
||||
|
||||
local playerPed = PlayerPedId()
|
||||
local vehicle = ESX.Game.GetVehicleInDirection()
|
||||
local coords = GetEntityCoords(playerPed)
|
||||
|
||||
if IsPedSittingInAnyVehicle(playerPed) then
|
||||
ESX.ShowNotification(_U('inside_vehicle'))
|
||||
return
|
||||
end
|
||||
|
||||
if DoesEntityExist(vehicle) then
|
||||
isBusy = true
|
||||
TaskStartScenarioInPlace(playerPed, 'WORLD_HUMAN_WELDING', 0, true)
|
||||
Citizen.CreateThread(function()
|
||||
Citizen.Wait(10000)
|
||||
|
||||
SetVehicleDoorsLocked(vehicle, 1)
|
||||
SetVehicleDoorsLockedForAllPlayers(vehicle, false)
|
||||
ClearPedTasksImmediately(playerPed)
|
||||
|
||||
ESX.ShowNotification(_U('vehicle_unlocked'))
|
||||
isBusy = false
|
||||
end)
|
||||
else
|
||||
ESX.ShowNotification(_U('no_vehicle_nearby'))
|
||||
end
|
||||
|
||||
elseif data.current.value == 'fix_vehicle' then
|
||||
|
||||
local playerPed = PlayerPedId()
|
||||
local vehicle = ESX.Game.GetVehicleInDirection()
|
||||
local coords = GetEntityCoords(playerPed)
|
||||
|
||||
if IsPedSittingInAnyVehicle(playerPed) then
|
||||
ESX.ShowNotification(_U('inside_vehicle'))
|
||||
return
|
||||
end
|
||||
|
||||
if DoesEntityExist(vehicle) then
|
||||
isBusy = true
|
||||
TaskStartScenarioInPlace(playerPed, 'PROP_HUMAN_BUM_BIN', 0, true)
|
||||
Citizen.CreateThread(function()
|
||||
Citizen.Wait(20000)
|
||||
|
||||
SetVehicleFixed(vehicle)
|
||||
SetVehicleDeformationFixed(vehicle)
|
||||
SetVehicleUndriveable(vehicle, false)
|
||||
SetVehicleEngineOn(vehicle, true, true)
|
||||
ClearPedTasksImmediately(playerPed)
|
||||
|
||||
ESX.ShowNotification(_U('vehicle_repaired'))
|
||||
isBusy = false
|
||||
end)
|
||||
else
|
||||
ESX.ShowNotification(_U('no_vehicle_nearby'))
|
||||
end
|
||||
|
||||
elseif data.current.value == 'clean_vehicle' then
|
||||
|
||||
local playerPed = PlayerPedId()
|
||||
local vehicle = ESX.Game.GetVehicleInDirection()
|
||||
local coords = GetEntityCoords(playerPed)
|
||||
|
||||
if IsPedSittingInAnyVehicle(playerPed) then
|
||||
ESX.ShowNotification(_U('inside_vehicle'))
|
||||
return
|
||||
end
|
||||
|
||||
if DoesEntityExist(vehicle) then
|
||||
isBusy = true
|
||||
TaskStartScenarioInPlace(playerPed, 'WORLD_HUMAN_MAID_CLEAN', 0, true)
|
||||
Citizen.CreateThread(function()
|
||||
Citizen.Wait(10000)
|
||||
|
||||
SetVehicleDirtLevel(vehicle, 0)
|
||||
ClearPedTasksImmediately(playerPed)
|
||||
|
||||
ESX.ShowNotification(_U('vehicle_cleaned'))
|
||||
isBusy = false
|
||||
end)
|
||||
else
|
||||
ESX.ShowNotification(_U('no_vehicle_nearby'))
|
||||
end
|
||||
|
||||
elseif data.current.value == 'del_vehicle' then
|
||||
|
||||
local playerPed = PlayerPedId()
|
||||
|
||||
if IsPedSittingInAnyVehicle(playerPed) then
|
||||
local vehicle = GetVehiclePedIsIn(playerPed, false)
|
||||
|
||||
if GetPedInVehicleSeat(vehicle, -1) == playerPed then
|
||||
ESX.ShowNotification(_U('vehicle_impounded'))
|
||||
ESX.Game.DeleteVehicle(vehicle)
|
||||
else
|
||||
ESX.ShowNotification(_U('must_seat_driver'))
|
||||
if IsPedSittingInAnyVehicle(playerPed) then
|
||||
ESX.ShowNotification(_U('inside_vehicle'))
|
||||
return
|
||||
end
|
||||
else
|
||||
local vehicle = ESX.Game.GetVehicleInDirection()
|
||||
|
||||
if DoesEntityExist(vehicle) then
|
||||
ESX.ShowNotification(_U('vehicle_impounded'))
|
||||
ESX.Game.DeleteVehicle(vehicle)
|
||||
isBusy = true
|
||||
TaskStartScenarioInPlace(playerPed, 'WORLD_HUMAN_WELDING', 0, true)
|
||||
Citizen.CreateThread(function()
|
||||
Citizen.Wait(10000)
|
||||
|
||||
SetVehicleDoorsLocked(vehicle, 1)
|
||||
SetVehicleDoorsLockedForAllPlayers(vehicle, false)
|
||||
ClearPedTasksImmediately(playerPed)
|
||||
|
||||
ESX.ShowNotification(_U('vehicle_unlocked'))
|
||||
isBusy = false
|
||||
end)
|
||||
else
|
||||
ESX.ShowNotification(_U('must_near'))
|
||||
ESX.ShowNotification(_U('no_vehicle_nearby'))
|
||||
end
|
||||
end
|
||||
elseif data.current.value == 'fix_vehicle' then
|
||||
local playerPed = PlayerPedId()
|
||||
local vehicle = ESX.Game.GetVehicleInDirection()
|
||||
local coords = GetEntityCoords(playerPed)
|
||||
|
||||
elseif data.current.value == 'dep_vehicle' then
|
||||
if IsPedSittingInAnyVehicle(playerPed) then
|
||||
ESX.ShowNotification(_U('inside_vehicle'))
|
||||
return
|
||||
end
|
||||
|
||||
local playerPed = PlayerPedId()
|
||||
local vehicle = GetVehiclePedIsIn(playerPed, true)
|
||||
if DoesEntityExist(vehicle) then
|
||||
isBusy = true
|
||||
TaskStartScenarioInPlace(playerPed, 'PROP_HUMAN_BUM_BIN', 0, true)
|
||||
Citizen.CreateThread(function()
|
||||
Citizen.Wait(20000)
|
||||
|
||||
local towmodel = GetHashKey('flatbed')
|
||||
local isVehicleTow = IsVehicleModel(vehicle, towmodel)
|
||||
SetVehicleFixed(vehicle)
|
||||
SetVehicleDeformationFixed(vehicle)
|
||||
SetVehicleUndriveable(vehicle, false)
|
||||
SetVehicleEngineOn(vehicle, true, true)
|
||||
ClearPedTasksImmediately(playerPed)
|
||||
|
||||
if isVehicleTow then
|
||||
local targetVehicle = ESX.Game.GetVehicleInDirection()
|
||||
ESX.ShowNotification(_U('vehicle_repaired'))
|
||||
isBusy = false
|
||||
end)
|
||||
else
|
||||
ESX.ShowNotification(_U('no_vehicle_nearby'))
|
||||
end
|
||||
elseif data.current.value == 'clean_vehicle' then
|
||||
local playerPed = PlayerPedId()
|
||||
local vehicle = ESX.Game.GetVehicleInDirection()
|
||||
local coords = GetEntityCoords(playerPed)
|
||||
|
||||
if CurrentlyTowedVehicle == nil then
|
||||
if targetVehicle ~= 0 then
|
||||
if not IsPedInAnyVehicle(playerPed, true) then
|
||||
if vehicle ~= targetVehicle then
|
||||
AttachEntityToEntity(targetVehicle, vehicle, 20, -0.5, -5.0, 1.0, 0.0, 0.0, 0.0, false, false, false, false, 20, true)
|
||||
CurrentlyTowedVehicle = targetVehicle
|
||||
ESX.ShowNotification(_U('vehicle_success_attached'))
|
||||
if IsPedSittingInAnyVehicle(playerPed) then
|
||||
ESX.ShowNotification(_U('inside_vehicle'))
|
||||
return
|
||||
end
|
||||
|
||||
if NPCOnJob then
|
||||
if NPCTargetTowable == targetVehicle then
|
||||
ESX.ShowNotification(_U('please_drop_off'))
|
||||
Config.Zones.VehicleDelivery.Type = 1
|
||||
if DoesEntityExist(vehicle) then
|
||||
isBusy = true
|
||||
TaskStartScenarioInPlace(playerPed, 'WORLD_HUMAN_MAID_CLEAN', 0, true)
|
||||
Citizen.CreateThread(function()
|
||||
Citizen.Wait(10000)
|
||||
|
||||
if Blips['NPCTargetTowableZone'] then
|
||||
RemoveBlip(Blips['NPCTargetTowableZone'])
|
||||
Blips['NPCTargetTowableZone'] = nil
|
||||
SetVehicleDirtLevel(vehicle, 0)
|
||||
ClearPedTasksImmediately(playerPed)
|
||||
|
||||
ESX.ShowNotification(_U('vehicle_cleaned'))
|
||||
isBusy = false
|
||||
end)
|
||||
else
|
||||
ESX.ShowNotification(_U('no_vehicle_nearby'))
|
||||
end
|
||||
elseif data.current.value == 'del_vehicle' then
|
||||
local playerPed = PlayerPedId()
|
||||
|
||||
if IsPedSittingInAnyVehicle(playerPed) then
|
||||
local vehicle = GetVehiclePedIsIn(playerPed, false)
|
||||
|
||||
if GetPedInVehicleSeat(vehicle, -1) == playerPed then
|
||||
ESX.ShowNotification(_U('vehicle_impounded'))
|
||||
ESX.Game.DeleteVehicle(vehicle)
|
||||
else
|
||||
ESX.ShowNotification(_U('must_seat_driver'))
|
||||
end
|
||||
else
|
||||
local vehicle = ESX.Game.GetVehicleInDirection()
|
||||
|
||||
if DoesEntityExist(vehicle) then
|
||||
ESX.ShowNotification(_U('vehicle_impounded'))
|
||||
ESX.Game.DeleteVehicle(vehicle)
|
||||
else
|
||||
ESX.ShowNotification(_U('must_near'))
|
||||
end
|
||||
end
|
||||
elseif data.current.value == 'dep_vehicle' then
|
||||
local playerPed = PlayerPedId()
|
||||
local vehicle = GetVehiclePedIsIn(playerPed, true)
|
||||
|
||||
local towmodel = GetHashKey('flatbed')
|
||||
local isVehicleTow = IsVehicleModel(vehicle, towmodel)
|
||||
|
||||
if isVehicleTow then
|
||||
local targetVehicle = ESX.Game.GetVehicleInDirection()
|
||||
|
||||
if CurrentlyTowedVehicle == nil then
|
||||
if targetVehicle ~= 0 then
|
||||
if not IsPedInAnyVehicle(playerPed, true) then
|
||||
if vehicle ~= targetVehicle then
|
||||
AttachEntityToEntity(targetVehicle, vehicle, 20, -0.5, -5.0, 1.0, 0.0, 0.0, 0.0, false, false, false, false, 20, true)
|
||||
CurrentlyTowedVehicle = targetVehicle
|
||||
ESX.ShowNotification(_U('vehicle_success_attached'))
|
||||
|
||||
if NPCOnJob then
|
||||
if NPCTargetTowable == targetVehicle then
|
||||
ESX.ShowNotification(_U('please_drop_off'))
|
||||
Config.Zones.VehicleDelivery.Type = 1
|
||||
|
||||
if Blips['NPCTargetTowableZone'] then
|
||||
RemoveBlip(Blips['NPCTargetTowableZone'])
|
||||
Blips['NPCTargetTowableZone'] = nil
|
||||
end
|
||||
|
||||
Blips['NPCDelivery'] = AddBlipForCoord(Config.Zones.VehicleDelivery.Pos.x, Config.Zones.VehicleDelivery.Pos.y, Config.Zones.VehicleDelivery.Pos.z)
|
||||
SetBlipRoute(Blips['NPCDelivery'], true)
|
||||
end
|
||||
|
||||
Blips['NPCDelivery'] = AddBlipForCoord(Config.Zones.VehicleDelivery.Pos.x, Config.Zones.VehicleDelivery.Pos.y, Config.Zones.VehicleDelivery.Pos.z)
|
||||
SetBlipRoute(Blips['NPCDelivery'], true)
|
||||
end
|
||||
else
|
||||
ESX.ShowNotification(_U('cant_attach_own_tt'))
|
||||
end
|
||||
else
|
||||
ESX.ShowNotification(_U('cant_attach_own_tt'))
|
||||
end
|
||||
else
|
||||
ESX.ShowNotification(_U('no_veh_att'))
|
||||
end
|
||||
else
|
||||
ESX.ShowNotification(_U('no_veh_att'))
|
||||
AttachEntityToEntity(CurrentlyTowedVehicle, vehicle, 20, -0.5, -12.0, 1.0, 0.0, 0.0, 0.0, false, false, false, false, 20, true)
|
||||
DetachEntity(CurrentlyTowedVehicle, true, true)
|
||||
|
||||
if NPCOnJob then
|
||||
if NPCTargetDeleterZone then
|
||||
|
||||
if CurrentlyTowedVehicle == NPCTargetTowable then
|
||||
ESX.Game.DeleteVehicle(NPCTargetTowable)
|
||||
TriggerServerEvent('esx_mechanicjob:onNPCJobMissionCompleted')
|
||||
StopNPCJob()
|
||||
NPCTargetDeleterZone = false
|
||||
else
|
||||
ESX.ShowNotification(_U('not_right_veh'))
|
||||
end
|
||||
|
||||
else
|
||||
ESX.ShowNotification(_U('not_right_place'))
|
||||
end
|
||||
end
|
||||
|
||||
CurrentlyTowedVehicle = nil
|
||||
ESX.ShowNotification(_U('veh_det_succ'))
|
||||
end
|
||||
else
|
||||
ESX.ShowNotification(_U('imp_flatbed'))
|
||||
end
|
||||
elseif data.current.value == 'object_spawner' then
|
||||
local playerPed = PlayerPedId()
|
||||
|
||||
AttachEntityToEntity(CurrentlyTowedVehicle, vehicle, 20, -0.5, -12.0, 1.0, 0.0, 0.0, 0.0, false, false, false, false, 20, true)
|
||||
DetachEntity(CurrentlyTowedVehicle, true, true)
|
||||
if IsPedSittingInAnyVehicle(playerPed) then
|
||||
ESX.ShowNotification(_U('inside_vehicle'))
|
||||
return
|
||||
end
|
||||
|
||||
if NPCOnJob then
|
||||
if NPCTargetDeleterZone then
|
||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'mobile_mechanic_actions_spawn', {
|
||||
title = _U('objects'),
|
||||
align = 'top-left',
|
||||
elements = {
|
||||
{label = _U('roadcone'), value = 'prop_roadcone02a'},
|
||||
{label = _U('toolbox'), value = 'prop_toolchest_01'}
|
||||
}}, function(data2, menu2)
|
||||
local model = data2.current.value
|
||||
local coords = GetEntityCoords(playerPed)
|
||||
local forward = GetEntityForwardVector(playerPed)
|
||||
local x, y, z = table.unpack(coords + forward * 1.0)
|
||||
|
||||
if CurrentlyTowedVehicle == NPCTargetTowable then
|
||||
ESX.Game.DeleteVehicle(NPCTargetTowable)
|
||||
TriggerServerEvent('esx_mechanicjob:onNPCJobMissionCompleted')
|
||||
StopNPCJob()
|
||||
NPCTargetDeleterZone = false
|
||||
else
|
||||
ESX.ShowNotification(_U('not_right_veh'))
|
||||
end
|
||||
|
||||
else
|
||||
ESX.ShowNotification(_U('not_right_place'))
|
||||
end
|
||||
if model == 'prop_roadcone02a' then
|
||||
z = z - 2.0
|
||||
elseif model == 'prop_toolchest_01' then
|
||||
z = z - 2.0
|
||||
end
|
||||
|
||||
CurrentlyTowedVehicle = nil
|
||||
ESX.ShowNotification(_U('veh_det_succ'))
|
||||
|
||||
end
|
||||
else
|
||||
ESX.ShowNotification(_U('imp_flatbed'))
|
||||
end
|
||||
|
||||
elseif data.current.value == 'object_spawner' then
|
||||
|
||||
local playerPed = PlayerPedId()
|
||||
|
||||
if IsPedSittingInAnyVehicle(playerPed) then
|
||||
ESX.ShowNotification(_U('inside_vehicle'))
|
||||
return
|
||||
end
|
||||
|
||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'mobile_mechanic_actions_spawn', {
|
||||
title = _U('objects'),
|
||||
align = 'top-left',
|
||||
elements = {
|
||||
{label = _U('roadcone'), value = 'prop_roadcone02a'},
|
||||
{label = _U('toolbox'), value = 'prop_toolchest_01'}
|
||||
}
|
||||
}, function(data2, menu2)
|
||||
local model = data2.current.value
|
||||
local coords = GetEntityCoords(playerPed)
|
||||
local forward = GetEntityForwardVector(playerPed)
|
||||
local x, y, z = table.unpack(coords + forward * 1.0)
|
||||
|
||||
if model == 'prop_roadcone02a' then
|
||||
z = z - 2.0
|
||||
elseif model == 'prop_toolchest_01' then
|
||||
z = z - 2.0
|
||||
end
|
||||
|
||||
ESX.Game.SpawnObject(model, {
|
||||
x = x,
|
||||
y = y,
|
||||
z = z
|
||||
}, function(obj)
|
||||
SetEntityHeading(obj, GetEntityHeading(playerPed))
|
||||
PlaceObjectOnGroundProperly(obj)
|
||||
ESX.Game.SpawnObject(model, {x = x, y = y, z = z}, function(obj)
|
||||
SetEntityHeading(obj, GetEntityHeading(playerPed))
|
||||
PlaceObjectOnGroundProperly(obj)
|
||||
end)
|
||||
end, function(data2, menu2)
|
||||
menu2.close()
|
||||
end)
|
||||
|
||||
end, function(data2, menu2)
|
||||
menu2.close()
|
||||
end)
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end, function(data, menu)
|
||||
menu.close()
|
||||
end)
|
||||
@@ -561,7 +511,6 @@ end
|
||||
|
||||
function OpenGetStocksMenu()
|
||||
ESX.TriggerServerCallback('esx_mechanicjob:getStockItems', function(items)
|
||||
|
||||
local elements = {}
|
||||
|
||||
for i=1, #items, 1 do
|
||||
@@ -571,13 +520,11 @@ function OpenGetStocksMenu()
|
||||
})
|
||||
end
|
||||
|
||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'stocks_menu',
|
||||
{
|
||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'stocks_menu', {
|
||||
title = _U('mechanic_stock'),
|
||||
align = 'top-left',
|
||||
elements = elements
|
||||
}, function(data, menu)
|
||||
|
||||
local itemName = data.current.value
|
||||
|
||||
ESX.UI.Menu.Open('dialog', GetCurrentResourceName(), 'stocks_menu_get_item_count', {
|
||||
@@ -598,17 +545,13 @@ function OpenGetStocksMenu()
|
||||
end, function(data2, menu2)
|
||||
menu2.close()
|
||||
end)
|
||||
|
||||
end, function(data, menu)
|
||||
menu.close()
|
||||
end)
|
||||
|
||||
end)
|
||||
|
||||
end
|
||||
|
||||
function OpenPutStocksMenu()
|
||||
|
||||
ESX.TriggerServerCallback('esx_mechanicjob:getPlayerInventory', function(inventory)
|
||||
local elements = {}
|
||||
|
||||
@@ -629,7 +572,6 @@ function OpenPutStocksMenu()
|
||||
align = 'top-left',
|
||||
elements = elements
|
||||
}, function(data, menu)
|
||||
|
||||
local itemName = data.current.value
|
||||
|
||||
ESX.UI.Menu.Open('dialog', GetCurrentResourceName(), 'stocks_menu_put_item_count', {
|
||||
@@ -653,19 +595,16 @@ function OpenPutStocksMenu()
|
||||
end, function(data, menu)
|
||||
menu.close()
|
||||
end)
|
||||
|
||||
end)
|
||||
|
||||
end
|
||||
|
||||
|
||||
RegisterNetEvent('esx_mechanicjob:onHijack')
|
||||
AddEventHandler('esx_mechanicjob:onHijack', function()
|
||||
local playerPed = PlayerPedId()
|
||||
local coords = GetEntityCoords(playerPed)
|
||||
|
||||
if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then
|
||||
local vehicle = nil
|
||||
local vehicle
|
||||
|
||||
if IsPedInAnyVehicle(playerPed, false) then
|
||||
vehicle = GetVehiclePedIsIn(playerPed, false)
|
||||
@@ -696,7 +635,6 @@ AddEventHandler('esx_mechanicjob:onHijack', function()
|
||||
ClearPedTasksImmediately(playerPed)
|
||||
end
|
||||
end)
|
||||
|
||||
end
|
||||
end
|
||||
end)
|
||||
@@ -707,7 +645,7 @@ AddEventHandler('esx_mechanicjob:onCarokit', function()
|
||||
local coords = GetEntityCoords(playerPed)
|
||||
|
||||
if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then
|
||||
local vehicle = nil
|
||||
local vehicle
|
||||
|
||||
if IsPedInAnyVehicle(playerPed, false) then
|
||||
vehicle = GetVehiclePedIsIn(playerPed, false)
|
||||
@@ -734,7 +672,7 @@ AddEventHandler('esx_mechanicjob:onFixkit', function()
|
||||
local coords = GetEntityCoords(playerPed)
|
||||
|
||||
if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then
|
||||
local vehicle = nil
|
||||
local vehicle
|
||||
|
||||
if IsPedInAnyVehicle(playerPed, false) then
|
||||
vehicle = GetVehiclePedIsIn(playerPed, false)
|
||||
@@ -767,7 +705,7 @@ AddEventHandler('esx:setJob', function(job)
|
||||
end)
|
||||
|
||||
AddEventHandler('esx_mechanicjob:hasEnteredMarker', function(zone)
|
||||
if zone == NPCJobTargetTowable then
|
||||
if zone == 'NPCJobTargetTowable' then
|
||||
|
||||
elseif zone =='VehicleDelivery' then
|
||||
NPCTargetDeleterZone = true
|
||||
@@ -995,7 +933,7 @@ Citizen.CreateThread(function()
|
||||
if CurrentAction then
|
||||
ESX.ShowHelpNotification(CurrentActionMsg)
|
||||
|
||||
if IsControlJustReleased(0, Keys['E']) and ESX.PlayerData.job and ESX.PlayerData.job.name == 'mechanic' then
|
||||
if IsControlJustReleased(0, 38) and ESX.PlayerData.job and ESX.PlayerData.job.name == 'mechanic' then
|
||||
|
||||
if CurrentAction == 'mechanic_actions_menu' then
|
||||
OpenMechanicActionsMenu()
|
||||
@@ -1032,11 +970,11 @@ Citizen.CreateThread(function()
|
||||
end
|
||||
end
|
||||
|
||||
if IsControlJustReleased(0, Keys['F6']) and not isDead and ESX.PlayerData.job and ESX.PlayerData.job.name == 'mechanic' then
|
||||
if IsControlJustReleased(0, 167) and not isDead and ESX.PlayerData.job and ESX.PlayerData.job.name == 'mechanic' then
|
||||
OpenMobileMechanicActionsMenu()
|
||||
end
|
||||
|
||||
if IsControlJustReleased(0, Keys['DELETE']) and not isDead and ESX.PlayerData.job and ESX.PlayerData.job.name == 'mechanic' then
|
||||
if IsControlJustReleased(0, 178) and not isDead and ESX.PlayerData.job and ESX.PlayerData.job.name == 'mechanic' then
|
||||
if NPCOnJob then
|
||||
if GetGameTimer() - NPCLastCancel > 5 * 60000 then
|
||||
StopNPCJob(true)
|
||||
|
||||
+49
-50
@@ -24,91 +24,90 @@ Config.Zones = {
|
||||
Pos = { x = -342.291, y = -133.370, z = 38.009 },
|
||||
Size = { x = 1.5, y = 1.5, z = 1.0 },
|
||||
Color = { r = 204, g = 204, b = 0 },
|
||||
Type = 1,
|
||||
Type = 1
|
||||
},
|
||||
|
||||
Garage = {
|
||||
Pos = { x = -97.5, y = 6496.1, z = 30.4 },
|
||||
Size = { x = 1.5, y = 1.5, z = 1.0 },
|
||||
Color = { r = 204, g = 204, b = 0 },
|
||||
Type = 1,
|
||||
Type = 1
|
||||
},
|
||||
|
||||
Craft = {
|
||||
Pos = { x = -323.140, y = -129.882, z = 37.999 },
|
||||
Size = { x = 1.5, y = 1.5, z = 1.0 },
|
||||
Color = { r = 204, g = 204, b = 0 },
|
||||
Type = 1,
|
||||
Type = 1
|
||||
},
|
||||
|
||||
VehicleSpawnPoint = {
|
||||
Pos = { x = -366.354, y = -110.766, z = 37.696 },
|
||||
Size = { x = 1.5, y = 1.5, z = 1.0 },
|
||||
Type = -1,
|
||||
Type = -1
|
||||
},
|
||||
|
||||
VehicleDeleter = {
|
||||
Pos = { x = -386.899, y = -105.675, z = 37.683 },
|
||||
Size = { x = 3.0, y = 3.0, z = 1.0 },
|
||||
Color = { r = 204, g = 204, b = 0 },
|
||||
Type = 1,
|
||||
Type = 1
|
||||
},
|
||||
|
||||
VehicleDelivery = {
|
||||
Pos = { x = -382.925, y = -133.748, z = 37.685 },
|
||||
Size = { x = 20.0, y = 20.0, z = 3.0 },
|
||||
Color = { r = 204, g = 204, b = 0 },
|
||||
Type = -1,
|
||||
Type = -1
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Config.Towables = {
|
||||
{ ['x'] = -2480.8720703125, ['y'] = -211.96409606934, ['z'] = 17.397672653198 },
|
||||
{ ['x'] = -2723.392578125, ['y'] = 13.207388877869, ['z'] = 15.12806892395 },
|
||||
{ ['x'] = -3169.6235351563, ['y'] = 976.18127441406, ['z'] = 15.038360595703 },
|
||||
{ ['x'] = -3139.7568359375, ['y'] = 1078.7182617188, ['z'] = 20.189767837524 },
|
||||
{ ['x'] = -1656.9357910156, ['y'] = -246.16479492188, ['z'] = 54.510955810547 },
|
||||
{ ['x'] = -1586.6560058594, ['y'] = -647.56115722656, ['z'] = 29.441320419312 },
|
||||
{ ['x'] = -1036.1470947266, ['y'] = -491.05856323242, ['z'] = 36.214912414551 },
|
||||
{ ['x'] = -1029.1884765625, ['y'] = -475.53167724609, ['z'] = 36.416831970215 },
|
||||
{ ['x'] = 75.212287902832, ['y'] = 164.8522644043, ['z'] = 104.69123077393 },
|
||||
{ ['x'] = -534.60491943359, ['y'] = -756.71801757813, ['z'] = 31.599143981934 },
|
||||
{ ['x'] = 487.24212646484, ['y'] = -30.827201843262, ['z'] = 88.856712341309 },
|
||||
{ ['x'] = -772.20111083984, ['y'] = -1281.8114013672, ['z'] = 4.5642876625061 },
|
||||
{ ['x'] = -663.84173583984, ['y'] = -1206.9936523438, ['z'] = 10.171216011047 },
|
||||
{ ['x'] = 719.12451171875, ['y'] = -767.77545166016, ['z'] = 24.892364501953 },
|
||||
{ ['x'] = -970.95465087891, ['y'] = -2410.4453125, ['z'] = 13.344270706177 },
|
||||
{ ['x'] = -1067.5234375, ['y'] = -2571.4064941406, ['z'] = 13.211874008179 },
|
||||
{ ['x'] = -619.23968505859, ['y'] = -2207.2927246094, ['z'] = 5.5659561157227 },
|
||||
{ ['x'] = 1192.0831298828, ['y'] = -1336.9086914063, ['z'] = 35.106426239014 },
|
||||
{ ['x'] = -432.81033325195, ['y'] = -2166.0505371094, ['z'] = 9.8885231018066 },
|
||||
{ ['x'] = -451.82403564453, ['y'] = -2269.34765625, ['z'] = 7.1719741821289 },
|
||||
{ ['x'] = 939.26702880859, ['y'] = -2197.5390625, ['z'] = 30.546691894531 },
|
||||
{ ['x'] = -556.11486816406, ['y'] = -1794.7312011719, ['z'] = 22.043060302734 },
|
||||
{ ['x'] = 591.73504638672, ['y'] = -2628.2197265625, ['z'] = 5.5735430717468 },
|
||||
{ ['x'] = 1654.515625, ['y'] = -2535.8325195313, ['z'] = 74.491394042969 },
|
||||
{ ['x'] = 1642.6146240234, ['y'] = -2413.3159179688, ['z'] = 93.139915466309 },
|
||||
{ ['x'] = 1371.3223876953, ['y'] = -2549.525390625, ['z'] = 47.575256347656 },
|
||||
{ ['x'] = 383.83779907227, ['y'] = -1652.8695068359, ['z'] = 37.278503417969 },
|
||||
{ ['x'] = 27.219129562378, ['y'] = -1030.8818359375, ['z'] = 29.414621353149 },
|
||||
{ ['x'] = 229.26435852051, ['y'] = -365.91101074219, ['z'] = 43.750762939453 },
|
||||
{ ['x'] = -85.809432983398, ['y'] = -51.665500640869, ['z'] = 61.10591506958 },
|
||||
{ ['x'] = -4.5967531204224, ['y'] = -670.27124023438, ['z'] = 31.85863494873 },
|
||||
{ ['x'] = -111.89884185791, ['y'] = 91.96940612793, ['z'] = 71.080169677734 },
|
||||
{ ['x'] = -314.26129150391, ['y'] = -698.23309326172, ['z'] = 32.545776367188 },
|
||||
{ ['x'] = -366.90979003906, ['y'] = 115.53963470459, ['z'] = 65.575706481934 },
|
||||
{ ['x'] = -592.06726074219, ['y'] = 138.20733642578, ['z'] = 60.074813842773 },
|
||||
{ ['x'] = -1613.8572998047, ['y'] = 18.759860992432, ['z'] = 61.799819946289 },
|
||||
{ ['x'] = -1709.7995605469, ['y'] = 55.105819702148, ['z'] = 65.706237792969 },
|
||||
{ ['x'] = -521.88830566406, ['y'] = -266.7805480957, ['z'] = 34.940990447998 },
|
||||
{ ['x'] = -451.08666992188, ['y'] = -333.52026367188, ['z'] = 34.021533966064 },
|
||||
{ ['x'] = 322.36480712891, ['y'] = -1900.4990234375, ['z'] = 25.773607254028 }
|
||||
vector3(-2480.9, -212.0, 17.4),
|
||||
vector3(-2723.4, 13.2, 15.1),
|
||||
vector3(-3169.6, 976.2, 15.0),
|
||||
vector3(-3139.8, 1078.7, 20.2),
|
||||
vector3(-1656.9, -246.2, 54.5),
|
||||
vector3(-1586.7, -647.6, 29.4),
|
||||
vector3(-1036.1, -491.1, 36.2),
|
||||
vector3(-1029.2, -475.5, 36.4),
|
||||
vector3(75.2, 164.9, 104.7),
|
||||
vector3(-534.6, -756.7, 31.6),
|
||||
vector3(487.2, -30.8, 88.9),
|
||||
vector3(-772.2, -1281.8, 4.6),
|
||||
vector3(-663.8, -1207.0, 10.2),
|
||||
vector3(719.1, -767.8, 24.9),
|
||||
vector3(-971.0, -2410.4, 13.3),
|
||||
vector3(-1067.5, -2571.4, 13.2),
|
||||
vector3(-619.2, -2207.3, 5.6),
|
||||
vector3(1192.1, -1336.9, 35.1),
|
||||
vector3(-432.8, -2166.1, 9.9),
|
||||
vector3(-451.8, -2269.3, 7.2),
|
||||
vector3(939.3, -2197.5, 30.5),
|
||||
vector3(-556.1, -1794.7, 22.0),
|
||||
vector3(591.7, -2628.2, 5.6),
|
||||
vector3(1654.5, -2535.8, 74.5),
|
||||
vector3(1642.6, -2413.3, 93.1),
|
||||
vector3(1371.3, -2549.5, 47.6),
|
||||
vector3(383.8, -1652.9, 37.3),
|
||||
vector3(27.2, -1030.9, 29.4),
|
||||
vector3(229.3, -365.9, 43.8),
|
||||
vector3(-85.8, -51.7, 61.1),
|
||||
vector3(-4.6, -670.3, 31.9),
|
||||
vector3(-111.9, 92.0, 71.1),
|
||||
vector3(-314.3, -698.2, 32.5),
|
||||
vector3(-366.9, 115.5, 65.6),
|
||||
vector3(-592.1, 138.2, 60.1),
|
||||
vector3(-1613.9, 18.8, 61.8),
|
||||
vector3(-1709.8, 55.1, 65.7),
|
||||
vector3(-521.9, -266.8, 34.9),
|
||||
vector3(-451.1, -333.5, 34.0),
|
||||
vector3(322.4, -1900.5, 25.8)
|
||||
}
|
||||
|
||||
for i=1, #Config.Towables, 1 do
|
||||
Config.Zones['Towable' .. i] = {
|
||||
Pos = Config.Towables[i],
|
||||
for k,v in ipairs(Config.Towables) do
|
||||
Config.Zones['Towable' .. k] = {
|
||||
Pos = v,
|
||||
Size = { x = 1.5, y = 1.5, z = 1.0 },
|
||||
Color = { r = 204, g = 204, b = 0 },
|
||||
Type = -1
|
||||
|
||||
Reference in New Issue
Block a user