Tab indent, code improvements

This commit is contained in:
ElPumpo
2018-08-25 00:43:20 +02:00
parent 3edf02d047
commit ab491550be
15 changed files with 1250 additions and 1269 deletions
+325 -329
View File
@@ -18,7 +18,7 @@ local Blips = {}
local JobBlips = {}
local collectedItem = nil
local collectedQtty = 0
local collectedQtty = 0
local collectedQttyUpToDate = false
local previousCollectedItem = nil
local previousCollectedQtty = 0
@@ -50,229 +50,238 @@ Citizen.CreateThread(function()
Citizen.Wait(0)
end
while ESX.GetPlayerData().job == nil do
Citizen.Wait(10)
end
PlayerData = ESX.GetPlayerData()
end)
RegisterNetEvent('esx:playerLoaded')
AddEventHandler('esx:playerLoaded', function(xPlayer)
PlayerData = xPlayer
TriggerServerEvent('esx_jobs:giveBackCautionInCaseOfDrop')
refreshBlips()
PlayerData = xPlayer
TriggerServerEvent('esx_jobs:giveBackCautionInCaseOfDrop')
refreshBlips()
end)
function OpenMenu()
ESX.UI.Menu.CloseAll()
ESX.UI.Menu.CloseAll()
ESX.UI.Menu.Open(
'default', GetCurrentResourceName(), 'cloakroom',
{
title = _U('cloakroom'),
elements = {
{label = _U('job_wear'), value = 'job_wear'},
{label = _U('citizen_wear'), value = 'citizen_wear'}
}
},
function(data, menu)
if data.current.value == 'citizen_wear' then
onDuty = false
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin)
TriggerEvent('skinchanger:loadSkin', skin)
end)
end
if data.current.value == 'job_wear' then
onDuty = true
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin)
if skin.sex == 0 then
TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_male)
else
TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_female)
end
end)
end
menu.close()
end,
function(data, menu)
menu.close()
end
)
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'cloakroom',
{
title = _U('cloakroom'),
elements = {
{label = _U('job_wear'), value = 'job_wear'},
{label = _U('citizen_wear'), value = 'citizen_wear'}
}
}, function(data, menu)
if data.current.value == 'citizen_wear' then
onDuty = false
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin)
TriggerEvent('skinchanger:loadSkin', skin)
end)
elseif data.current.value == 'job_wear' then
onDuty = true
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin)
if skin.sex == 0 then
TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_male)
else
TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_female)
end
end)
end
menu.close()
end, function(data, menu)
menu.close()
end)
end
AddEventHandler('esx_jobs:action', function(job, zone)
menuIsShowed = true
if zone.Type == "cloakroom" then
OpenMenu()
elseif zone.Type == "work" then
hintToDisplay = "no hint to display"
hintIsShowed = false
local playerPed = GetPlayerPed(-1)
if IsPedInAnyVehicle(playerPed, 0) then
TriggerEvent('esx:showNotification', _U('foot_work'))
else
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 vehicle = nil
menuIsShowed = true
if zone.Type == "cloakroom" then
OpenMenu()
elseif zone.Type == "work" then
hintToDisplay = "no hint to display"
hintIsShowed = false
local playerPed = PlayerPedId()
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
spawner = w.Spawner
end
end
for m,x in pairs(v.Vehicles) do
if (x.Spawner == zone.Spawner) then
vehicle = x
end
end
end
end
if IsPedInAnyVehicle(playerPed, false) then
ESX.ShowNotification(U('foot_work'))
else
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 vehicle = nil
local caution = zone.Caution
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
spawner = w.Spawner
end
end
if deliverypt == nil then
deliverypt = 0
end
for m,x in pairs(v.Vehicles) do
if (x.Spawner == zone.Spawner) then
vehicle = x
end
end
end
end
TriggerServerEvent('esx_jobs:setCautionInCaseOfDrop', caution)
cautionVehicleInCaseofDrop = caution
maxCautionVehicleInCaseofDrop = cautionVehicleInCaseofDrop
local caution = zone.Caution
spawncar(spawnpt, vehicle)
if deliverypt == nil then
deliverypt = 0
end
elseif zone.Type == "vehdelete" then
local looping = true
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 == "vehdelete") and (w.Spawner == zone.Spawner) then
local playerPed = GetPlayerPed(-1)
if IsPedInAnyVehicle(playerPed, 0) then
local vehicle = GetVehiclePedIsIn(playerPed, 0)
local plate = GetVehicleNumberPlateText(vehicle)
plate = string.gsub(plate, " ", "")
local driverPed = GetPedInVehicleSeat(vehicle, -1)
for i=1, #myPlate, 1 do
if (myPlate[i] == plate) and (playerPed == driverPed) then
TriggerServerEvent('esx_jobs:caution', "give_back", cautionVehicleInCaseofDrop, 0, 0)
DeleteVehicle(GetVehiclePedIsIn(playerPed, 0))
TriggerServerEvent('esx_jobs:setCautionInCaseOfDrop', caution)
cautionVehicleInCaseofDrop = caution
maxCautionVehicleInCaseofDrop = cautionVehicleInCaseofDrop
if w.Teleport ~= 0 then
SetEntityCoords(GetPlayerPed(-1), w.Teleport.x, w.Teleport.y, w.Teleport.z)
end
spawncar(spawnpt, vehicle)
table.remove(myPlate, i)
elseif zone.Type == "vehdelete" then
local looping = true
if vehicleObjInCaseofDrop.HasCaution then
cautionVehicleInCaseofDrop = 0
maxCautionVehicleInCaseofDrop = 0
vehicleInCaseofDrop = nil
vehicleHashInCaseofDrop = nil
vehicleMaxHealthInCaseofDrop = nil
vehicleOldHealthInCaseofDrop = nil
vehicleObjInCaseofDrop = nil
TriggerServerEvent('esx_jobs:setCautionInCaseOfDrop', 0)
end
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 == "vehdelete" and w.Spawner == zone.Spawner then
local playerPed = PlayerPedId()
if IsPedInAnyVehicle(playerPed, false) then
local vehicle = GetVehiclePedIsIn(playerPed, 0)
local plate = GetVehicleNumberPlateText(vehicle)
plate = string.gsub(plate, " ", "")
local driverPed = GetPedInVehicleSeat(vehicle, -1)
break
end
end
end
looping = false
break
end
if looping == false then
break
end
end
end
if looping == false then
break
end
end
elseif zone.Type == "delivery" then
if Blips['delivery'] ~= nil then
RemoveBlip(Blips['delivery'])
Blips['delivery'] = nil
end
hintToDisplay = "no hint to display"
hintIsShowed = false
TriggerServerEvent('esx_jobs:startWork', zone.Item)
end
--nextStep(zone.GPS)
for i=1, #myPlate, 1 do
if myPlate[i] == plate and playerPed == driverPed then
TriggerServerEvent('esx_jobs:caution', "give_back", cautionVehicleInCaseofDrop, 0, 0)
DeleteVehicle(GetVehiclePedIsIn(playerPed, 0))
if w.Teleport ~= 0 then
SetEntityCoords(PlayerPedId(), w.Teleport.x, w.Teleport.y, w.Teleport.z)
end
table.remove(myPlate, i)
if vehicleObjInCaseofDrop.HasCaution then
cautionVehicleInCaseofDrop = 0
maxCautionVehicleInCaseofDrop = 0
vehicleInCaseofDrop = nil
vehicleHashInCaseofDrop = nil
vehicleMaxHealthInCaseofDrop = nil
vehicleOldHealthInCaseofDrop = nil
vehicleObjInCaseofDrop = nil
TriggerServerEvent('esx_jobs:setCautionInCaseOfDrop', 0)
end
break
end
end
end
looping = false
break
end
if looping == false then
break
end
end
end
if looping == false then
break
end
end
elseif zone.Type == "delivery" then
if Blips['delivery'] ~= nil then
RemoveBlip(Blips['delivery'])
Blips['delivery'] = nil
end
hintToDisplay = "no hint to display"
hintIsShowed = false
TriggerServerEvent('esx_jobs:startWork', zone.Item)
end
--nextStep(zone.GPS)
end)
function nextStep(gps)
if gps ~= 0 then
if Blips['delivery'] ~= nil then
RemoveBlip(Blips['delivery'])
Blips['delivery'] = nil
end
Blips['delivery'] = AddBlipForCoord(gps.x, gps.y, gps.z)
SetBlipRoute(Blips['delivery'], true)
TriggerEvent('esx:showNotification', _U('next_point'))
end
if gps ~= 0 then
if Blips['delivery'] ~= nil then
RemoveBlip(Blips['delivery'])
Blips['delivery'] = nil
end
Blips['delivery'] = AddBlipForCoord(gps.x, gps.y, gps.z)
SetBlipRoute(Blips['delivery'], true)
ESX.ShowNotification(_U('next_point'))
end
end
AddEventHandler('esx_jobs:hasExitedMarker', function(zone)
TriggerServerEvent('esx_jobs:stopWork')
hintToDisplay = "no hint to display"
menuIsShowed = false
hintIsShowed = false
isInMarker = false
TriggerServerEvent('esx_jobs:stopWork')
hintToDisplay = "no hint to display"
menuIsShowed = false
hintIsShowed = false
isInMarker = false
end)
RegisterNetEvent('esx:setJob')
AddEventHandler('esx:setJob', function(job)
PlayerData.job = job
onDuty = false
myPlate = {} -- loosing vehicle caution in case player changes job.
isJobVehicleDestroyed = false
spawner = 0
deleteBlips()
refreshBlips()
PlayerData.job = job
onDuty = false
myPlate = {} -- loosing vehicle caution in case player changes job.
isJobVehicleDestroyed = false
spawner = 0
deleteBlips()
refreshBlips()
end)
function deleteBlips()
if JobBlips[1] ~= nil then
for i=1, #JobBlips, 1 do
RemoveBlip(JobBlips[i])
JobBlips[i] = nil
end
end
if JobBlips[1] ~= nil then
for i=1, #JobBlips, 1 do
RemoveBlip(JobBlips[i])
JobBlips[i] = nil
end
end
end
function refreshBlips()
local zones = {}
local blipInfo = {}
local zones = {}
local blipInfo = {}
if PlayerData.job ~= nil then
for jobKey,jobValues in pairs(Config.Jobs) do
if PlayerData.job ~= nil then
for jobKey,jobValues in pairs(Config.Jobs) do
if jobKey == PlayerData.job.name then
for zoneKey,zoneValues in pairs(jobValues.Zones) do
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)
SetBlipAsShortRange(blip, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString(zoneValues.Name)
EndTextCommandSetBlipName(blip)
table.insert(JobBlips, blip)
end
end
end
if jobKey == PlayerData.job.name then
for zoneKey,zoneValues in pairs(jobValues.Zones) do
end
end
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)
SetBlipAsShortRange(blip, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString(zoneValues.Name)
EndTextCommandSetBlipName(blip)
table.insert(JobBlips, blip)
end
end
end
end
end
end
function spawncar(spawnPoint, vehicle)
@@ -283,51 +292,36 @@ end
RegisterNetEvent('esx_jobs:spawnJobVehicle')
AddEventHandler('esx_jobs:spawnJobVehicle', function(spawnPoint, vehicle)
local playerPed = GetPlayerPed(-1)
local coords = spawnPoint.Pos
local vehicleModel = GetHashKey(vehicle.Hash)
local playerPed = PlayerPedId()
RequestModel(vehicleModel)
while not HasModelLoaded(vehicleModel) do
Citizen.Wait(0)
end
if not IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then
if not IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then
local veh = CreateVehicle(vehicleModel, coords.x, coords.y, coords.z, spawnPoint.Heading, true, false)
ESX.Game.SpawnVehicle(vehicle.Hash, spawnPoint.Pos, spawnPoint.heading, function(spawnedVehicle)
if vehicle.Trailer ~= "none" then
RequestModel(vehicle.Trailer)
if vehicle.Trailer ~= "none" then
ESX.Game.SpawnVehicle(vehicle.Trailer, spawnPoint.Pos, spawnPoint.heading, function(trailer)
AttachVehicleToTrailer(spawnedVehicle, trailer, 1.1)
end)
end
while not HasModelLoaded(vehicle.Trailer) do
Citizen.Wait(0)
end
-- save & set plate
local plate = 'WORK' .. math.random(100, 900)
SetVehicleNumberPlateText(spawnedVehicle, plate)
table.insert(myPlate, plate)
plate = string.gsub(plate, " ", "")
local trailer = CreateVehicle(vehicle.Trailer, coords.x, coords.y, coords.z, spawnPoint.Heading, true, false)
AttachVehicleToTrailer(veh, trailer, 1.1)
end
TaskWarpPedIntoVehicle(playerPed, spawnedVehicle, -1)
isJobVehicleDestroyed = false
SetVehicleHasBeenOwnedByPlayer(veh, true)
SetEntityAsMissionEntity(veh, true, true)
local id = NetworkGetNetworkIdFromEntity(veh)
SetNetworkIdCanMigrate(id, true)
local plate = 'WORK' .. math.random(100, 900)
SetVehicleNumberPlateText(veh, plate)
table.insert(myPlate, plate)
plate = string.gsub(plate, " ", "")
SetVehRadioStation(veh, "OFF")
TaskWarpPedIntoVehicle(playerPed, veh, -1)
isJobVehicleDestroyed = false
if vehicle.HasCaution then
vehicleInCaseofDrop = veh
vehicleHashInCaseofDrop = vehicle.Hash
vehicleObjInCaseofDrop = vehicle
vehicleMaxHealthInCaseofDrop = GetEntityMaxHealth(veh)
vehicleOldHealthInCaseofDrop = vehicleMaxHealthInCaseofDrop
end
end
if vehicle.HasCaution then
vehicleInCaseofDrop = spawnedVehicle
vehicleHashInCaseofDrop = vehicle.Hash
vehicleObjInCaseofDrop = vehicle
vehicleMaxHealthInCaseofDrop = GetEntityMaxHealth(spawnedVehicle)
vehicleOldHealthInCaseofDrop = vehicleMaxHealthInCaseofDrop
end
end)
end
end)
-- Show top left hint
@@ -335,44 +329,43 @@ Citizen.CreateThread(function()
while true do
Citizen.Wait(10)
if hintIsShowed then
SetTextComponentFormat("STRING")
AddTextComponentString(hintToDisplay)
DisplayHelpTextFromStringLabel(0, 0, 1, -1)
ESX.ShowHelpNotification(hintToDisplay)
else
Citizen.Wait(1000)
Citizen.Wait(500)
end
end
end)
-- Display markers (only if on duty and the player's job ones)
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
local zones = {}
if PlayerData.job ~= nil then
for k,v in pairs(Config.Jobs) do
if PlayerData.job.name == k then
zones = v.Zones
end
end
while true do
Citizen.Wait(1)
local zones = {}
local coords = GetEntityCoords(GetPlayerPed(-1))
for k,v in pairs(zones) do
if onDuty or v.Type == "cloakroom" or PlayerData.job.name == "reporter" then
if(v.Marker ~= -1 and GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.DrawDistance) then
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
if PlayerData.job ~= nil then
for k,v in pairs(Config.Jobs) do
if PlayerData.job.name == k then
zones = v.Zones
end
end
local coords = GetEntityCoords(PlayerPedId())
for k,v in pairs(zones) do
if onDuty or v.Type == "cloakroom" or PlayerData.job.name == "reporter" then
if(v.Marker ~= -1 and GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.DrawDistance) then
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
end)
-- Display public markers
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
local coords = GetEntityCoords(GetPlayerPed(-1))
local coords = GetEntityCoords(PlayerPedId())
for k,v in pairs(Config.PublicZones) do
if(v.Marker ~= -1 and GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.DrawDistance) then
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)
@@ -385,7 +378,7 @@ end)
Citizen.CreateThread(function()
while true do
Citizen.Wait(10)
local coords = GetEntityCoords(GetPlayerPed(-1))
local coords = GetEntityCoords(PlayerPedId())
local position = nil
local zone = nil
@@ -401,7 +394,7 @@ Citizen.CreateThread(function()
end
if IsControlJustReleased(0, Keys['E']) and isInPublicMarker then
ESX.Game.Teleport(GetPlayerPed(-1), position)
ESX.Game.Teleport(PlayerPedId(), position)
isInPublicMarker = false
end
@@ -420,97 +413,100 @@ end)
-- Activate menu when player is inside marker
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
while true do
if PlayerData.job ~= nil and PlayerData.job.name ~= 'unemployed' then
local zones = nil
local job = nil
Citizen.Wait(1)
for k,v in pairs(Config.Jobs) do
if PlayerData.job.name == k then
job = v
zones = v.Zones
end
end
if PlayerData.job ~= nil and PlayerData.job.name ~= 'unemployed' then
local zones = nil
local job = nil
if zones ~= nil then
local coords = GetEntityCoords(GetPlayerPed(-1))
local currentZone = nil
local zone = nil
local lastZone = nil
for k,v in pairs(Config.Jobs) do
if PlayerData.job.name == k then
job = v
zones = v.Zones
end
end
for k,v in pairs(zones) do
if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < v.Size.x) then
isInMarker = true
currentZone = k
zone = v
break
else
isInMarker = false
end
end
if zones ~= nil then
local coords = GetEntityCoords(PlayerPedId())
local currentZone = nil
local zone = nil
local lastZone = nil
if IsControlJustReleased(0, Keys["E"]) and not menuIsShowed and isInMarker then
if onDuty or zone.Type == "cloakroom" or PlayerData.job.name == "reporter" then
TriggerEvent('esx_jobs:action', job, zone)
end
end
for k,v in pairs(zones) do
if GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < v.Size.x then
isInMarker = true
currentZone = k
zone = v
break
else
isInMarker = false
end
end
-- hide or show top left zone hints
if isInMarker and not menuIsShowed then
hintIsShowed = true
if (onDuty or zone.Type == "cloakroom" or PlayerData.job.name == "reporter") and zone.Type ~= "vehdelete" then
hintToDisplay = zone.Hint
hintIsShowed = true
elseif zone.Type == "vehdelete" and (onDuty or PlayerData.job.name == "reporter") then
local playerPed = GetPlayerPed(-1)
if IsPedInAnyVehicle(playerPed, 0) then
local vehicle = GetVehiclePedIsIn(playerPed)
local driverPed = GetPedInVehicleSeat(vehicle, -1)
local isVehicleOwner = false
local plate = GetVehicleNumberPlateText(vehicle)
plate = string.gsub(plate, " ", "")
for i=1, #myPlate, 1 do
Citizen.Trace(myPlate[i])
if (myPlate[i] == plate) and (playerPed == driverPed) then
hintToDisplay = zone.Hint .. "\n" .. _U('security_deposit') .. cautionVehicleInCaseofDrop .. "~s~."
isVehicleOwner = true
break
end
end
if not isVehicleOwner then
hintToDisplay = _U('not_your_vehicle')
end
else
hintToDisplay = _U('in_vehicle')
end
hintIsShowed = true
elseif onDuty and zone.Spawner ~= spawner then
hintToDisplay = _U('wrong_point')
hintIsShowed = true
else
if not isInPublicMarker then
hintToDisplay = "no hint to display"
hintIsShowed = false
end
end
end
if IsControlJustReleased(0, Keys['E']) and not menuIsShowed and isInMarker then
if onDuty or zone.Type == "cloakroom" or PlayerData.job.name == "reporter" then
TriggerEvent('esx_jobs:action', job, zone)
end
end
if isInMarker and not hasAlreadyEnteredMarker then
hasAlreadyEnteredMarker = true
end
-- hide or show top left zone hints
if isInMarker and not menuIsShowed then
hintIsShowed = true
if (onDuty or zone.Type == "cloakroom" or PlayerData.job.name == "reporter") and zone.Type ~= "vehdelete" then
hintToDisplay = zone.Hint
hintIsShowed = true
elseif zone.Type == "vehdelete" and (onDuty or PlayerData.job.name == "reporter") then
local playerPed = PlayerPedId()
if not isInMarker and hasAlreadyEnteredMarker then
hasAlreadyEnteredMarker = false
TriggerEvent('esx_jobs:hasExitedMarker', zone)
end
end
end
end
if IsPedInAnyVehicle(playerPed, false) then
local vehicle = GetVehiclePedIsIn(playerPed)
local driverPed = GetPedInVehicleSeat(vehicle, -1)
local isVehicleOwner = false
local plate = GetVehicleNumberPlateText(vehicle)
plate = string.gsub(plate, " ", "")
for i=1, #myPlate, 1 do
if (myPlate[i] == plate) and (playerPed == driverPed) then
hintToDisplay = zone.Hint .. "\n" .. _U('security_deposit') .. cautionVehicleInCaseofDrop .. "~s~."
isVehicleOwner = true
break
end
end
if not isVehicleOwner then
hintToDisplay = _U('not_your_vehicle')
end
else
hintToDisplay = _U('in_vehicle')
end
hintIsShowed = true
elseif onDuty and zone.Spawner ~= spawner then
hintToDisplay = _U('wrong_point')
hintIsShowed = true
else
if not isInPublicMarker then
hintToDisplay = "no hint to display"
hintIsShowed = false
end
end
end
if isInMarker and not hasAlreadyEnteredMarker then
hasAlreadyEnteredMarker = true
end
if not isInMarker and hasAlreadyEnteredMarker then
hasAlreadyEnteredMarker = false
TriggerEvent('esx_jobs:hasExitedMarker', zone)
end
end
end
end
end)
-- VEHICLE CAUTION
-- Vehicle caution
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
@@ -552,7 +548,7 @@ Citizen.CreateThread(function()
RequestIpl("CS1_02_cf_onmission3")
RequestIpl("CS1_02_cf_onmission4")
-- Textil
-- Tailor
RequestIpl("id2_14_during_door")
RequestIpl("id2_14_during1")
end)