Fixes #44 and spawning job vehicle, minor cleanup

This commit is contained in:
ElPumpo
2018-08-27 11:20:36 +02:00
parent 195c1bf6e0
commit 71b80da8b9
7 changed files with 74 additions and 78 deletions
+5 -5
View File
@@ -30,8 +30,8 @@ Config.Jobs.fueler = {
GPS = {x = 554.59, y = -2314.43, z = 4.86}
},
ChampPetrol = {
Pos = {x = 609.58, y = 2856.74, z = 39.49},
OilFarm = {
Pos = {x = 609.58, y = 2856.74, z = 38.90},
Size = {x = 20.0, y = 20.0, z = 1.0},
Color = {r = 204, g = 204, b = 0},
Marker = 1,
@@ -55,7 +55,7 @@ Config.Jobs.fueler = {
GPS = {x = 2736.94, y = 1417.99, z = 23.48}
},
Raffinerie = {
OilRefinement = {
Pos = {x = 2736.94, y = 1417.99, z = 23.48},
Size = {x = 10.0, y = 10.0, z = 1.0},
Color = {r = 204, g = 204, b = 0},
@@ -80,7 +80,7 @@ Config.Jobs.fueler = {
GPS = {x = 265.75, y = -3013.39, z = 4.73}
},
Melange = {
OilMix = {
Pos = {x = 265.75, y = -3013.39, z = 4.73},
Size = {x = 10.0, y = 10.0, z = 1.0},
Color = {r = 204, g = 204, b = 0},
@@ -168,7 +168,7 @@ Config.Jobs.fueler = {
}
},
Hint = _U("f_deliver_gas"),
Hint = _U("f_deliver_gas_button"),
GPS = {x = 609.58, y = 2856.74, z = 39.49}
}
+41 -50
View File
@@ -19,13 +19,9 @@ local JobBlips = {}
local collectedItem = nil
local collectedQtty = 0
local collectedQttyUpToDate = false
local previousCollectedItem = nil
local previousCollectedQtty = 0
local isInMarker = false
local isInPublicMarker = false
local newTask = false
local hintToDisplay = "no hint to display"
local jobDone = false
local onDuty = false
@@ -55,6 +51,7 @@ Citizen.CreateThread(function()
end
PlayerData = ESX.GetPlayerData()
refreshBlips()
end)
RegisterNetEvent('esx:playerLoaded')
@@ -113,40 +110,36 @@ AddEventHandler('esx_jobs:action', function(job, zone)
TriggerServerEvent('esx_jobs:startWork', zone.Item)
end
elseif zone.Type == "vehspawner" then
TriggerServerEvent('esx_jobs:requestPlayerData', 'refresh_bank_account')
local spawnpt = nil
local deliverypt = nil
local spawnPoint = nil
local vehicle = nil
for k,v in pairs(Config.Jobs) do
if PlayerData.job.name == k then
for l,w in pairs(v.Zones) do
if w.Type == "vehspawnpt" and w.Spawner == zone.Spawner then
spawnpt = w
spawnPoint = w
spawner = w.Spawner
end
end
for m,x in pairs(v.Vehicles) do
if (x.Spawner == zone.Spawner) then
if x.Spawner == zone.Spawner then
vehicle = x
end
end
end
end
local caution = zone.Caution
if ESX.Game.IsSpawnPointClear(spawnPoint.Pos, 5.0) then
TriggerServerEvent('esx_jobs:setCautionInCaseOfDrop', zone.Caution)
cautionVehicleInCaseofDrop = zone.Caution
maxCautionVehicleInCaseofDrop = cautionVehicleInCaseofDrop
if deliverypt == nil then
deliverypt = 0
spawnVehicle(spawnPoint, vehicle)
else
ESX.ShowNotification(_U('spawn_blocked'))
end
TriggerServerEvent('esx_jobs:setCautionInCaseOfDrop', caution)
cautionVehicleInCaseofDrop = caution
maxCautionVehicleInCaseofDrop = cautionVehicleInCaseofDrop
spawncar(spawnpt, vehicle)
elseif zone.Type == "vehdelete" then
local looping = true
@@ -267,10 +260,11 @@ function refreshBlips()
if zoneValues.Blip then
local blip = AddBlipForCoord(zoneValues.Pos.x, zoneValues.Pos.y, zoneValues.Pos.z)
SetBlipSprite (blip, jobValues.BlipInfos.Sprite)
SetBlipDisplay(blip, 4)
SetBlipScale (blip, 1.2)
SetBlipColour (blip, jobValues.BlipInfos.Color)
SetBlipSprite (blip, jobValues.BlipInfos.Sprite)
SetBlipDisplay (blip, 4)
SetBlipScale (blip, 1.2)
SetBlipCategory(blip, 3)
SetBlipColour (blip, jobValues.BlipInfos.Color)
SetBlipAsShortRange(blip, true)
BeginTextCommandSetBlipName("STRING")
@@ -284,44 +278,41 @@ function refreshBlips()
end
end
function spawncar(spawnPoint, vehicle)
hintToDisplay = "no hint to display"
hintIsShowed = false
TriggerServerEvent('esx_jobs:caution', "take", cautionVehicleInCaseofDrop, spawnPoint, vehicle)
function spawnVehicle(spawnPoint, vehicle)
hintToDisplay = "no hint to display"
hintIsShowed = false
TriggerServerEvent('esx_jobs:caution', "take", cautionVehicleInCaseofDrop, spawnPoint, vehicle)
end
RegisterNetEvent('esx_jobs:spawnJobVehicle')
AddEventHandler('esx_jobs:spawnJobVehicle', function(spawnPoint, vehicle)
local playerPed = PlayerPedId()
if not IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then
ESX.Game.SpawnVehicle(vehicle.Hash, spawnPoint.Pos, spawnPoint.heading, function(spawnedVehicle)
ESX.Game.SpawnVehicle(vehicle.Hash, spawnPoint.Pos, spawnPoint.heading, function(spawnedVehicle)
if vehicle.Trailer ~= "none" then
ESX.Game.SpawnVehicle(vehicle.Trailer, spawnPoint.Pos, spawnPoint.heading, function(trailer)
AttachVehicleToTrailer(spawnedVehicle, trailer, 1.1)
end)
end
if vehicle.Trailer ~= "none" then
ESX.Game.SpawnVehicle(vehicle.Trailer, spawnPoint.Pos, spawnPoint.heading, function(trailer)
AttachVehicleToTrailer(spawnedVehicle, trailer, 1.1)
end)
end
-- save & set plate
local plate = 'WORK' .. math.random(100, 900)
SetVehicleNumberPlateText(spawnedVehicle, plate)
table.insert(myPlate, plate)
plate = string.gsub(plate, " ", "")
-- save & set plate
local plate = 'WORK' .. math.random(100, 900)
SetVehicleNumberPlateText(spawnedVehicle, plate)
table.insert(myPlate, plate)
plate = string.gsub(plate, " ", "")
TaskWarpPedIntoVehicle(playerPed, spawnedVehicle, -1)
isJobVehicleDestroyed = false
TaskWarpPedIntoVehicle(playerPed, spawnedVehicle, -1)
isJobVehicleDestroyed = false
if vehicle.HasCaution then
vehicleInCaseofDrop = spawnedVehicle
vehicleHashInCaseofDrop = vehicle.Hash
vehicleObjInCaseofDrop = vehicle
vehicleMaxHealthInCaseofDrop = GetEntityMaxHealth(spawnedVehicle)
vehicleOldHealthInCaseofDrop = vehicleMaxHealthInCaseofDrop
end
end)
end
if vehicle.HasCaution then
vehicleInCaseofDrop = spawnedVehicle
vehicleHashInCaseofDrop = vehicle.Hash
vehicleObjInCaseofDrop = vehicle
vehicleMaxHealthInCaseofDrop = GetEntityMaxHealth(spawnedVehicle)
vehicleOldHealthInCaseofDrop = vehicleMaxHealthInCaseofDrop
end
end)
end)
-- Show top left hint
+12 -11
View File
@@ -12,11 +12,12 @@ Locales['br'] = {
['not_your_vehicle'] = 'este não é o seu veículo ou você deve ser um motorista.',
['in_vehicle'] = 'você deve estar em um veículo.',
['wrong_point'] = 'você não está no ponto certo de entrega.',
['max_limit'] = 'você tem o máximo: %s',
['not_enough'] = 'você não tem o suficiente %s para continuar esta tarefa.',
['max_limit'] = 'você tem o máximo ~y~%s~s~',
['not_enough'] = 'você não tem o suficiente ~y~%s~s~ para continuar esta tarefa.',
['spawn_veh'] = 'veiculo Spawnado',
['spawn_veh_button'] = 'pressione ~INPUT_PICKUP~ chamar o veículo de entrega.',
['spawn_truck_button'] = 'pressione ~INPUT_PICKUP~ spawnar o caminhão.',
['spawn_blocked'] = 'an vehicle is blocking the spawnpoint!',
['service_vh'] = 'veículo de serviço',
['return_vh'] = 'veiculo devolvido',
['return_vh_button'] = 'pressione ~INPUT_PICKUP~ para devolver o veiculo.',
@@ -30,7 +31,7 @@ Locales['br'] = {
['lj_mapblip'] = 'pilha de madeira',
['lj_wood'] = 'madeira',
['lj_pickup'] = 'pressione ~INPUT_PICKUP~ para recuperar madeira.',
['lj_cutwood'] = 'Corte de Madeira',
['lj_cutwood'] = 'corte de Madeira',
['lj_cutwood_button'] = 'pressione ~INPUT_PICKUP~ para cortar madeira.',
['lj_board'] = 'tábua',
['lj_planks'] = 'tábua embalada',
@@ -45,7 +46,7 @@ Locales['br'] = {
['fm_fish_button'] = 'pressione ~INPUT_PICKUP~ para pescar.',
['fm_spawnboat_title'] = 'Spawnar Barco',
['fm_spawnboat'] = 'pressione ~INPUT_PICKUP~ para chamar um barco.',
['fm_boat_title'] = 'Barco',
['fm_boat_title'] = 'barco',
['fm_boat_return_title'] = 'devolver barco',
['fm_boat_return_button'] = 'Pressione ~INPUT_PICKUP~ para devolver o barco.',
['fm_deliver_fish'] = 'pressione ~INPUT_PICKUP~ para entregar os peixes.',
@@ -57,10 +58,10 @@ Locales['br'] = {
['f_drillbutton'] = 'pressione ~INPUT_PICKUP~ para perfurar.',
['f_fuel_refine'] = 'refinar óleo',
['f_refine_fuel_button'] = 'pressione ~INPUT_PICKUP~ para refinar.',
['f_fuel_mixture'] = 'Misturar o óleo refinado',
['f_fuel_mixture'] = 'misturar o óleo refinado',
['f_gas'] = 'gasolina',
['f_fuel_mixture_button'] = 'pressione ~INPUT_PICKUP~ para misturar.',
['f_deliver_gas'] = 'Entregar Gasolina',
['f_deliver_gas'] = 'entregar Gasolina',
['f_deliver_gas_button'] = 'pressione ~INPUT_PICKUP~ para entregar a gasolina.',
-- Miner
@@ -69,7 +70,7 @@ Locales['br'] = {
['m_pickrocks'] = 'pressione ~INPUT_PICKUP~ para obter pedras.',
['m_washrock'] = 'pedras limpas ',
['m_rock_button'] = 'pressione ~INPUT_PICKUP~ para lavar as pedras.',
['m_rock_smelting'] = 'Fundição',
['m_rock_smelting'] = 'fundição',
['m_copper'] = 'cobre',
['m_sell_copper'] = 'vender cobre',
['m_deliver_copper'] = 'pressione ~INPUT_PICKUP~ para entregar cobre.',
@@ -85,11 +86,11 @@ Locales['br'] = {
['m_melt_button'] = 'pressione ~INPUT_PICKUP~ para derreter as pedras.',
-- Reporter
['reporter_name'] = 'Globo News',
['reporter_garage'] = 'Pressione ~INPUT_PICKUP~ para descer à garagem.',
['reporter_name'] = 'globo News',
['reporter_garage'] = 'pressione ~INPUT_PICKUP~ para descer à garagem.',
-- Slaughterer
['s_slaughter_locker'] = 'Vestiario Abatedor',
['s_slaughter_locker'] = 'vestiario Abatedor',
['s_hen'] = 'galinheiro',
['s_alive_chicken'] = 'galinha viva',
['s_catch_hen'] = 'pressione ~INPUT_PICKUP~ para pegar galinha viva.',
@@ -103,7 +104,7 @@ Locales['br'] = {
['s_deliver'] = 'pressione ~INPUT_PICKUP~ para entregar as bandejas de frango.',
-- Dress Designer
['dd_dress_locker'] = 'Vestiario Costureiro',
['dd_dress_locker'] = 'vestiario Costureiro',
['dd_wool'] = '',
['dd_pickup'] = 'pressione ~INPUT_PICKUP~ para obter lã.',
['dd_fabric'] = 'tecido',
+4 -3
View File
@@ -12,11 +12,12 @@ Locales['en'] = {
['not_your_vehicle'] = 'this is not your vehicle or you must be a driver.',
['in_vehicle'] = 'you must sit in a vehicle.',
['wrong_point'] = 'you are not at the right point of delivery.',
['max_limit'] = 'you have cannot carry more: %s',
['not_enough'] = 'you do not have enough %s to continue this task.',
['max_limit'] = 'you have cannot carry more ~y~%s~s~',
['not_enough'] = 'you do not have enough ~y~%s~s~ to continue this task.',
['spawn_veh'] = 'spawn vehicle',
['spawn_veh_button'] = 'press ~INPUT_PICKUP~ to call the delivery vehicle.',
['spawn_truck_button'] = 'press ~INPUT_PICKUP~ to spawn the truck.',
['spawn_blocked'] = 'an vehicle is blocking the spawnpoint!',
['service_vh'] = 'service vehicle',
['return_vh'] = 'vehicle return',
['return_vh_button'] = 'press ~INPUT_PICKUP~ to return the vehicle.',
@@ -59,7 +60,7 @@ Locales['en'] = {
['f_refine_fuel_button'] = 'press ~INPUT_PICKUP~ to refine.',
['f_fuel_mixture'] = 'mix refined oil',
['f_gas'] = 'gas',
['f_fuel_mixture_button'] = 'press ~INPUT_PICKUP~ to mix.',
['f_fuel_mixture_button'] = 'press ~INPUT_PICKUP~ to mix oil.',
['f_deliver_gas'] = 'deliver Gas',
['f_deliver_gas_button'] = 'press ~INPUT_PICKUP~ to deliver gasoline.',
+3 -2
View File
@@ -12,11 +12,12 @@ Locales['fi'] = {
['not_your_vehicle'] = 'tämä ei ole sinun ajoneuvo tai et ole sen kuski',
['in_vehicle'] = 'sinun täytyy olla ajoneuvossa',
['wrong_point'] = 'et ole oikeassa paikassa',
['max_limit'] = 'sinulla on jo maksimi määrä: %s',
['not_enough'] = 'sinulla ei ole tarpeeksi %s jatkaaksesi täällä.',
['max_limit'] = 'sinulla on jo maksimi määrä ~y~%s~s~',
['not_enough'] = 'sinulla ei ole tarpeeksi ~y~%s~s~ jatkaaksesi täällä.',
['spawn_veh'] = 'spawnaa ajoneuvo',
['spawn_veh_button'] = 'paina ~INPUT_PICKUP~ soittaaksesi kuljetus ajoneuvo',
['spawn_truck_button'] = 'paina ~INPUT_PICKUP~ spawnataksesi rekka.',
['spawn_blocked'] = 'an vehicle is blocking the spawnpoint!',
['service_vh'] = 'huolla ajonevuo',
['return_vh'] = 'palauta ajoneuvo',
['return_vh_button'] = 'paina ~INPUT_PICKUP~ palautaaksesi ajoneuvo.',
+3 -2
View File
@@ -12,11 +12,12 @@ Locales['fr'] = {
['not_your_vehicle'] = 'ce n\'est pas votre véhicule ou vous devez être conducteur.',
['in_vehicle'] = 'vous devez être dans un véhicule.',
['wrong_point'] = 'vous n\'êtes pas au bon point de livraison.',
['max_limit'] = 'vous avez le maximum de: %s',
['not_enough'] = 'vous n\'avez plus assez de %s pour continuer cette tâche.',
['max_limit'] = 'vous avez le maximum de ~y~%s~s~',
['not_enough'] = 'vous n\'avez plus assez de ~y~%s~s~ pour continuer cette tâche.',
['spawn_veh'] = 'spawner véhicule de fonction',
['spawn_veh_button'] = 'appuyez sur ~INPUT_PICKUP~ pour appeler le véhicule de livraison.',
['spawn_truck_button'] = 'appuyez sur ~INPUT_PICKUP~ pour appeler le camion.',
['spawn_blocked'] = 'an vehicle is blocking the spawnpoint!',
['service_vh'] = 'véhicule de fonction',
['return_vh'] = 'supression du véhicule',
['return_vh_button'] = 'appuyez sur ~INPUT_PICKUP~ pour rendre le véhicule.',
+6 -5
View File
@@ -12,11 +12,12 @@ Locales['sv'] = {
['not_your_vehicle'] = 'det här är inte ditt fordon eller så måste du vara föraren.',
['in_vehicle'] = 'du måste sitta i ett fordon!',
['wrong_point'] = 'du är inte på rätt leveranspunkt!',
['max_limit'] = 'du kan inte bära mer: %s',
['not_enough'] = 'du har inte tillräckligt med %s för att fortsätta denna uppgift.',
['max_limit'] = 'du kan inte bära mer ~y~%s~s~',
['not_enough'] = 'du har inte tillräckligt med ~y~%s~s~ för att fortsätta denna uppgift.',
['spawn_veh'] = 'spawna fordon',
['spawn_veh_button'] = 'tryck ~INPUT_PICKUP~ för att ringa leveransfordonet.',
['spawn_truck_button'] = 'tryck ~INPUT_PICKUP~ för att spawna bilen.',
['spawn_blocked'] = 'ett fordon blockerar spawnpointen!',
['service_vh'] = 'service fordon',
['return_vh'] = 'lämna service fordon',
['return_vh_button'] = 'tryck ~INPUT_PICKUP~ för att ge tillbaka fordonet.',
@@ -56,12 +57,12 @@ Locales['sv'] = {
['f_fuel'] = 'olja',
['f_drillbutton'] = 'tryck ~INPUT_PICKUP~ för att borra efter olja.',
['f_fuel_refine'] = 'raffinera oljan',
['f_refine_fuel_button'] = 'tryck ~INPUT_PICKUP~ för att raffinera oljan',
['f_refine_fuel_button'] = 'tryck ~INPUT_PICKUP~ för att raffinera olja.',
['f_fuel_mixture'] = 'blanda raffinerad olja',
['f_gas'] = 'gas',
['f_fuel_mixture_button'] = 'tryck ~INPUT_PICKUP~ för att mixa',
['f_fuel_mixture_button'] = 'tryck ~INPUT_PICKUP~ för att mixa olja.',
['f_deliver_gas'] = 'leverera gas',
['f_deliver_gas_button'] = 'tryck ~INPUT_PICKUP~ för att sälja bensin',
['f_deliver_gas_button'] = 'tryck ~INPUT_PICKUP~ för att sälja bensin.',
-- Miner
['m_miner_locker'] = 'Gruvarbetarnas Omklädningsrum',