Refactored files, minor improvementrs & cleanup

This commit is contained in:
ElPumpo
2018-07-03 14:42:28 +02:00
parent 6646124864
commit 446daf5999
15 changed files with 111 additions and 105 deletions
+15 -9
View File
@@ -14,7 +14,7 @@ server_scripts {
'locales/fr.lua',
'locales/sv.lua',
'config.lua',
'server/esx_jobs_sv.lua'
'server/main.lua'
}
client_scripts {
@@ -26,12 +26,18 @@ client_scripts {
'locales/fr.lua',
'locales/sv.lua',
'config.lua',
'jobs/fisherman.lua',
'jobs/fueler.lua',
'jobs/lumberjack.lua',
'jobs/miner.lua',
'jobs/reporter.lua',
'jobs/slaughterer.lua',
'jobs/tailor.lua',
'client/esx_jobs_cl.lua'
'client/jobs/fisherman.lua',
'client/jobs/fueler.lua',
'client/jobs/lumberjack.lua',
'client/jobs/miner.lua',
'client/jobs/reporter.lua',
'client/jobs/slaughterer.lua',
'client/jobs/tailor.lua',
'client/main.lua'
}
dependencies {
'es_extended',
'esx_addonaccount',
'esx_skin'
}
+3 -3
View File
@@ -24,7 +24,7 @@ Config.Jobs.tailor = {
GPS = {x = 740.808776855469, y = -970.066650390625, z = 23.4693908691406}
},
Whool = {
Wool = {
Pos = {x = 1978.92407226563, y = 5171.70166015625, z = 46.6391181945801},
Size = {x = 3.0, y = 3.0, z = 1.0},
Color = {r = 204, g = 204, b = 0},
@@ -35,7 +35,7 @@ Config.Jobs.tailor = {
Item = {
{
name = _U('dd_wool'),
db_name= "whool",
db_name= "wool",
time = 3000,
max = 40,
add = 1,
@@ -65,7 +65,7 @@ Config.Jobs.tailor = {
max = 80,
add = 2,
remove = 1,
requires = "whool",
requires = "wool",
requires_name = _U('dd_wool'),
drop = 100
}
+88 -88
View File
@@ -60,10 +60,6 @@ AddEventHandler('esx:playerLoaded', function(xPlayer)
refreshBlips()
end)
AddEventHandler('esx_jobs:publicTeleports', function(position)
SetEntityCoords(GetPlayerPed(-1), position.x, position.y, position.z)
end)
function OpenMenu()
ESX.UI.Menu.CloseAll()
@@ -336,14 +332,16 @@ end)
-- Show top left hint
Citizen.CreateThread(function()
while true do
Citizen.Wait(10)
if hintIsShowed == true then
SetTextComponentFormat("STRING")
AddTextComponentString(hintToDisplay)
DisplayHelpTextFromStringLabel(0, 0, 1, -1)
end
end
while true do
Citizen.Wait(10)
if hintIsShowed then
SetTextComponentFormat("STRING")
AddTextComponentString(hintToDisplay)
DisplayHelpTextFromStringLabel(0, 0, 1, -1)
else
Citizen.Wait(1000)
end
end
end)
-- Display markers (only if on duty and the player's job ones)
@@ -372,51 +370,52 @@ end)
-- Display public markers
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
local coords = GetEntityCoords(GetPlayerPed(-1))
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)
end
end
end
while true do
Citizen.Wait(0)
local coords = GetEntityCoords(GetPlayerPed(-1))
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)
end
end
end
end)
-- Activate public marker
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
local coords = GetEntityCoords(GetPlayerPed(-1))
local position = nil
local zone = nil
while true do
Citizen.Wait(10)
local coords = GetEntityCoords(GetPlayerPed(-1))
local position = nil
local zone = nil
for k,v in pairs(Config.PublicZones) do
if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < v.Size.x) then
isInPublicMarker = true
position = v.Teleport
zone = v
break
else
isInPublicMarker = false
end
end
for k,v in pairs(Config.PublicZones) do
if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < v.Size.x) then
isInPublicMarker = true
position = v.Teleport
zone = v
break
else
isInPublicMarker = false
end
end
if IsControlJustReleased(0, Keys["E"]) and isInPublicMarker then
TriggerEvent('esx_jobs:publicTeleports', position)
end
if IsControlJustReleased(0, Keys['E']) and isInPublicMarker then
ESX.Game.Teleport(GetPlayerPed(-1), position)
isInPublicMarker = false
end
-- hide or show top left zone hints
if isInPublicMarker then
hintToDisplay = zone.Hint
hintIsShowed = true
else
if not isInMarker then
hintToDisplay = "no hint to display"
hintIsShowed = false
end
end
end
-- hide or show top left zone hints
if isInPublicMarker then
hintToDisplay = zone.Hint
hintIsShowed = true
else
if not isInMarker then
hintToDisplay = "no hint to display"
hintIsShowed = false
end
end
end
end)
-- Activate menu when player is inside marker
@@ -513,46 +512,47 @@ end)
-- VEHICLE CAUTION
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if vehicleInCaseofDrop ~= nil then
if onDuty and IsVehicleModel(vehicleInCaseofDrop, vehicleHashInCaseofDrop) then
local vehicleHealth = GetEntityHealth(vehicleInCaseofDrop)
if vehicleOldHealthInCaseofDrop ~= vehicleHealth then
local cautionValue = 0
vehicleOldHealthInCaseofDrop = vehicleHealth
if vehicleHealth == vehicleMaxHealthInCaseofDrop then
cautionValue = maxCautionVehicleInCaseofDrop
cautionVehicleInCaseofDrop = cautionValue
else
local healthPct = (vehicleHealth * 100) / vehicleMaxHealthInCaseofDrop
local damagePct = 100 - healthPct
cautionValue = math.ceil(cautionVehicleInCaseofDrop - cautionVehicleInCaseofDrop * damagePct * 2.5 / 100)
if cautionValue < 0 then
cautionValue = 0
elseif cautionValue >= cautionVehicleInCaseofDrop then
cautionValue = cautionVehicleInCaseofDrop
end
cautionVehicleInCaseofDrop = cautionValue
end
TriggerServerEvent('esx_jobs:setCautionInCaseOfDrop', cautionValue)
end
end
end
end
while true do
Citizen.Wait(0)
if vehicleInCaseofDrop ~= nil then
if onDuty and IsVehicleModel(vehicleInCaseofDrop, vehicleHashInCaseofDrop) then
local vehicleHealth = GetEntityHealth(vehicleInCaseofDrop)
if vehicleOldHealthInCaseofDrop ~= vehicleHealth then
local cautionValue = 0
vehicleOldHealthInCaseofDrop = vehicleHealth
if vehicleHealth == vehicleMaxHealthInCaseofDrop then
cautionValue = maxCautionVehicleInCaseofDrop
cautionVehicleInCaseofDrop = cautionValue
else
local healthPct = (vehicleHealth * 100) / vehicleMaxHealthInCaseofDrop
local damagePct = 100 - healthPct
cautionValue = math.ceil(cautionVehicleInCaseofDrop - cautionVehicleInCaseofDrop * damagePct * 2.5 / 100)
if cautionValue < 0 then
cautionValue = 0
elseif cautionValue >= cautionVehicleInCaseofDrop then
cautionValue = cautionVehicleInCaseofDrop
end
cautionVehicleInCaseofDrop = cautionValue
end
TriggerServerEvent('esx_jobs:setCautionInCaseOfDrop', cautionValue)
end
end
else
Citizen.Wait(1000)
end
end
end)
Citizen.CreateThread(function()
-- Slaughterer
RemoveIpl("CS1_02_cf_offmission")
RequestIpl("CS1_02_cf_onmission1")
RequestIpl("CS1_02_cf_onmission2")
RequestIpl("CS1_02_cf_onmission3")
RequestIpl("CS1_02_cf_onmission4")
-- Slaughterer
RemoveIpl("CS1_02_cf_offmission")
RequestIpl("CS1_02_cf_onmission1")
RequestIpl("CS1_02_cf_onmission2")
RequestIpl("CS1_02_cf_onmission3")
RequestIpl("CS1_02_cf_onmission4")
-- Textil
RequestIpl("id2_14_during_door")
RequestIpl("id2_14_during1")
-- Textil
RequestIpl("id2_14_during_door")
RequestIpl("id2_14_during1")
end)
+1 -1
View File
@@ -41,7 +41,7 @@ INSERT INTO `items` (`name`, `label`, `limit`) VALUES
('petrol', 'Pétrole', 24),
('petrol_raffin', 'Pétrole Raffiné', 24),
('essence', 'Essence', 24),
('whool', 'Laine', 40),
('wool', 'Laine', 40),
('fabric', 'Tissu', 80),
('clothe', 'Vêtement', 40)
;
+1 -1
View File
@@ -41,7 +41,7 @@ INSERT INTO `items` (`name`, `label`) VALUES
('petrol', 'Petroleo', 24),
('petrol_raffin', 'Petroleo Refinado', 24),
('essence', 'Gasolina', 24),
('whool', '', 40),
('wool', '', 40),
('fabric', 'Tecido', 80),
('clothe', 'Roupa', 40)
;
+1 -1
View File
@@ -41,7 +41,7 @@ INSERT INTO `items` (`name`, `label`, `limit`) VALUES
('petrol', 'oil', 24),
('petrol_raffin', 'processed oil', 24),
('essence', 'gas', 24),
('whool', 'wool', 40),
('wool', 'wool', 40),
('fabric', 'fabric', 80),
('clothe', 'cloth', 40)
;
+1 -1
View File
@@ -41,7 +41,7 @@ INSERT INTO `items` (`name`, `label`, `limit`) VALUES
('petrol', 'Öljy', 24),
('petrol_raffin', 'Prosessoitu Öljy', 24),
('essence', 'Polttoöljy', 24),
('whool', 'Villa', 40),
('wool', 'Villa', 40),
('fabric', 'Kangas', 80),
('clothe', 'Vaate', 40)
;
+1 -1
View File
@@ -41,7 +41,7 @@ INSERT INTO `items` (`name`, `label`, `limit`) VALUES
('petrol', 'olja', 24),
('petrol_raffin', 'bearbetad olja', 24),
('essence', 'gas', 24),
('whool', 'ull', 40),
('wool', 'ull', 40),
('fabric', 'tyg', 80),
('clothe', 'kläde', 40)
;