Adding files

This commit is contained in:
renaiku
2017-08-08 18:22:35 +02:00
parent d2a10ee4bf
commit 592612497b
20 changed files with 2165 additions and 0 deletions
+12
View File
@@ -1,2 +1,14 @@
# fxserver-esx_jobs
[KNOWN BUGS]
The bail is not given back when the player disconnect or timeout.
[FEATURES]
- Bails
- Easy system to create jobs (samples in jobs folder)
- Item farming jobs
- On Duty system
This addon is an easy way to have farming jobs on your server.
There is no player management.
Just take exemple on the files in the jobs folder.
+29
View File
@@ -0,0 +1,29 @@
server_scripts {
'@mysql-async/lib/MySQL.lua',
'server/esx_jobs_sv.lua'
}
client_scripts {
'config.lua',
'jobs/fisherman.lua',
'jobs/fuel.lua',
'jobs/lumberjack.lua',
'jobs/miner.lua',
'jobs/reporter.lua',
'jobs/slaughterer.lua',
'jobs/textil.lua',
'client/esx_jobs_cl.lua'
}
ui_page 'html/ui.html'
files {
'html/ui.html',
'html/bankgothic.ttf',
'html/pdown.ttf',
'html/css/app.css',
'html/scripts/mustache.min.js',
'html/scripts/app.js',
'html/img/keys/enter.png',
'html/img/keys/return.png'
}
+561
View File
@@ -0,0 +1,561 @@
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 PlayerData = {}
local menuIsShowed = false
local hintIsShowed = false
local hasAlreadyEnteredMarker = false
local Blips = {}
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
local moneyInBank = 0
local spawner = 0
local myPlate = {}
local isJobVehicleDestroyed = false
local cautionVehicleInCaseofDrop = 0
local maxCautionVehicleInCaseofDrop = 0
local vehicleObjInCaseofDrop = nil
local vehicleInCaseofDrop = nil
local vehicleHashInCaseofDrop = nil
local vehicleMaxHealthInCaseofDrop = nil
local vehicleOldHealthInCaseofDrop = nil
ESX = nil
Citizen.CreateThread(function()
while ESX == nil do
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
Citizen.Wait(0)
end
end)
RegisterNetEvent('esx:playerLoaded')
AddEventHandler('esx:playerLoaded', function(xPlayer)
PlayerData = xPlayer
TriggerServerEvent('esx_jobs:giveBackCautionInCaseOfDrop')
refreshBlips()
end)
AddEventHandler('esx_jobs:publicTeleports', function(position)
SetEntityCoords(GetPlayerPed(-1), position.x, position.y, position.z)
end)
AddEventHandler('esx_jobs:action', function(job, zone)
menuIsShowed = true
if zone.Type == "cloakroom" then
SendNUIMessage({
showMenu = true,
menu = 'cloakroom'
})
elseif zone.Type == "work" then
hintToDisplay = "no hint to display"
hintIsShowed = false
local playerPed = GetPlayerPed(-1)
if IsPedInAnyVehicle(playerPed, 0) then
TriggerEvent('esx:showNotification', 'Vous devez être à pied pour pouvoir travailler.')
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
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
local caution = zone.Caution
if deliverypt == nil then
deliverypt = 0
end
TriggerServerEvent('esx_jobs:setCautionInCaseOfDrop', caution)
cautionVehicleInCaseofDrop = caution
maxCautionVehicleInCaseofDrop = cautionVehicleInCaseofDrop
spawncar(spawnpt, vehicle)
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))
if w.Teleport ~= 0 then
SetEntityCoords(GetPlayerPed(-1), w.Teleport.x, w.Teleport.y, w.Teleport.z)
end
TriggerEvent('esx_vehiclelock:updatePlayerCars', "remove", myPlate[i])
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', 'Rendez-vous à la prochaine étape après avoir complété celle-ci.')
end
end
-- #########################
AddEventHandler('esx_jobs:hasExitedMarker', function(zone)
TriggerServerEvent('esx_jobs:stopWork')
hintToDisplay = "no hint to display"
menuIsShowed = false
hintIsShowed = false
isInMarker = false
SendNUIMessage({
showControls = false,
showMenu = 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()
end)
function deleteBlips()
if JobBlips[1] ~= nil then
for i=1, #JobBlips, 1 do
RemoveBlip(JobBlips[i])
table.remove(JobBlips, i)
end
end
end
function refreshBlips()
local zones = {}
local blipInfo = {}
if PlayerData.job ~= nil then
for jobKey,jobValues in pairs(Config.Jobs) do
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
end
end
-- #########################
RegisterNUICallback('select', function(data, cb)
if data.menu == 'cloakroom' then
if data.val == 'citizen_wear' then
onDuty = false
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin)
TriggerEvent('skinchanger:loadSkin', skin)
end)
end
if data.val == '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
end
cb('ok')
end)
function spawncar(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 = GetPlayerPed(-1)
local coords = spawnPoint.Pos
local vehicleModel = GetHashKey(vehicle.Hash)
RequestModel(vehicleModel)
while not HasModelLoaded(vehicleModel) do
Citizen.Wait(0)
end
local plate = math.random(100, 900)
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)
if vehicle.Trailer ~= "none" then
RequestModel(vehicle.Trailer)
while not HasModelLoaded(vehicle.Trailer) do
Citizen.Wait(0)
end
local trailer = CreateVehicle(vehicle.Trailer, coords.x, coords.y, coords.z, spawnPoint.Heading, true, false)
AttachVehicleToTrailer(veh, trailer, 1.1)
end
SetVehicleHasBeenOwnedByPlayer(veh, true)
SetEntityAsMissionEntity(veh, true, true)
local id = NetworkGetNetworkIdFromEntity(veh)
SetNetworkIdCanMigrate(id, true)
local platePrefix = "WORK"
for k,v in pairs(Config.Plates) do
if PlayerData.job.name == k then
platePrefix = v
end
end
plate = platePrefix .. plate
SetVehicleNumberPlateText(veh, plate)
table.insert(myPlate, plate)
plate = string.gsub(plate, " ", "")
TriggerEvent('esx_vehiclelock:updatePlayerCars', "add", 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
end)
-- Show top left hint
Citizen.CreateThread(function()
while true do
Wait(0)
if hintIsShowed == true then
SetTextComponentFormat("STRING")
AddTextComponentString(hintToDisplay)
DisplayHelpTextFromStringLabel(0, 0, 1, -1)
end
end
end)
-- Display markers (only if on duty and the player's job ones)
Citizen.CreateThread(function()
while true do
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
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
end)
-- Display public markers
Citizen.CreateThread(function()
while true do
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
Wait(0)
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
if IsControlJustReleased(0, Keys["E"]) and isInPublicMarker then
TriggerEvent('esx_jobs:publicTeleports', position)
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
Citizen.CreateThread(function()
while true do
Wait(0)
if PlayerData.job ~= nil and PlayerData.job.name ~= 'unemployed' then
local zones = nil
local job = nil
for k,v in pairs(Config.Jobs) do
if PlayerData.job.name == k then
job = v
zones = v.Zones
end
end
local coords = GetEntityCoords(GetPlayerPed(-1))
local currentZone = nil
local zone = nil
local lastZone = nil
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 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
-- 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" .. "La caution rendue sera de ~g~" .. cautionVehicleInCaseofDrop .. "$~s~."
isVehicleOwner = true
break
end
end
if not isVehicleOwner then
hintToDisplay = "Ce n'est pas votre véhicule ou vous devez être conducteur."
end
else
hintToDisplay = "Vous devez être dans un véhicule."
end
hintIsShowed = true
elseif onDuty and zone.Spawner ~= spawner then
hintToDisplay = "Vous n'êtes pas au bon point de livraison."
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)
-- VEHICLE CAUTION
Citizen.CreateThread(function()
while true do
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
end)
-- Menu Controls
Citizen.CreateThread(function()
while true do
Wait(0)
if IsControlJustReleased(0, Keys['ENTER']) or IsControlJustReleased(0, Keys['E']) then
SendNUIMessage({ enterPressed = true })
elseif IsControlJustReleased(0, Keys['BACKSPACE']) then
SendNUIMessage({ backspacePressed = true })
elseif IsControlJustReleased(0, Keys['LEFT']) then
SendNUIMessage({ move = 'LEFT' })
elseif IsControlJustReleased(0, Keys['RIGHT']) then
SendNUIMessage({ move = 'RIGHT' })
elseif IsControlJustReleased(0, Keys['TOP']) then
SendNUIMessage({ move = 'UP' })
elseif IsControlJustReleased(0, Keys['DOWN']) then
SendNUIMessage({ move = 'DOWN' })
end
end
end)
+44
View File
@@ -0,0 +1,44 @@
Config = {}
Config.DrawDistance = 1000.0
Config.Plates = {
taxi = "TAXI",
fisherman = "FISH",
cop = "LSPD",
ambulance = "EMS",
depanneur = "MECA",
fuel = "FUEL",
lumberjack = "BUCH",
miner = "MINE",
reporter = "JOUR",
slaughterer = "ABAT",
textil = "COUT"
}
Config.Jobs = {}
Config.PublicZones = {
EnterBuilding = {
Pos = { x = -118.21381378174, y = -607.14227294922, z = 35.280723571777 },
Size = {x = 3.0, y = 3.0, z = 0.2},
Color = {r = 204, g = 204, b = 0},
Marker= 1,
Blip = false,
Name = "Le Maclerait Libéré",
Type = "teleport",
Hint = "Appuyez sur ~INPUT_PICKUP~ pour entrer dans l'immeuble.",
Teleport = { x = -139.09838867188, y = -620.74865722656, z = 167.82052612305 }
},
ExitBuilding = {
Pos = { x = -139.45831298828, y = -617.32312011719, z = 167.82052612305 },
Size = {x = 3.0, y = 3.0, z = 0.2},
Color = {r = 204, g = 204, b = 0},
Marker= 1,
Blip = false,
Name = "Le Maclerait Libéré",
Type = "teleport",
Hint = "Appuyez sur ~INPUT_PICKUP~ pour aller à l'entrée de l'immeuble.",
Teleport = { x = -113.07, y = -604.93, z = 35.28 },
},
}
Binary file not shown.
+61
View File
@@ -0,0 +1,61 @@
@font-face {
font-family: bankgothic;
src: url('../bankgothic.ttf');
}
@font-face {
font-family: pcdown;
src: url('../pdown.ttf');
}
#controls {
font-family : pcdown;
font-size : 3em;
color : #FFF;
position : absolute;
bottom : 40;
right : 40;
text-shadow:
-1px -1px 0 #000,
1px -1px 0 #000,
-1px 1px 0 #000,
1px 1px 0 #000
;
}
.controls {
display: none;
}
.menu {
font-family : bankgothic;
min-width : 350px;
background-color: #506be6;
color : #fff;
box-shadow : 0px 0px 50px 0px #000;
position : absolute;
left : 40;
top : 40;
}
.menu .head {
text-align : center;
height : 40px;
line-height : 40px;
}
.menu .menu-items .menu-item {
height : 40px;
display : block;
background-color: #f1f1f1;
box-shadow : inset 1px 0px 0px 1px #b8b8b8;
height : 32px;
line-height : 32px;
color : #3A3A3A;
text-align : center;
}
.menu .menu-items .menu-item.selected {
background-color: #d0d0d0;
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 941 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 376 B

BIN
View File
Binary file not shown.
+168
View File
@@ -0,0 +1,168 @@
(function(){
let DefaultTpl =
'<div class="head">{{title}}</div>' +
'<div class="menu-items">' +
'{{#items}}<div class="menu-item" data-value="{{value}}">{{label}}</div>{{/items}}' +
'</div>'+
'</div>'
;
let DefaultWithTypeAndCountTpl =
'<div class="head">{{title}}</div>' +
'<div class="menu-items">' +
'{{#items}}<div class="menu-item" data-value="{{value}}" data-remove-on-select="{{removeOnSelect}}" data-type="{{type}}" data-count="{{count}}">{{label}}</div>{{/items}}' +
'</div>'+
'</div>'
;
let menus = {
cloakroom : {
title : 'Vestiaire',
visible : false,
current : 0,
hasControl: true,
template : DefaultTpl,
items: [
{label: 'Tenue civile', value: 'citizen_wear'},
{label: 'Tenue de travail', value: 'job_wear'}
]
},
}
let renderMenus = function(){
for(let k in menus){
let elem = $('#menu_' + k);
elem.html(Mustache.render(menus[k].template, menus[k]));
if(menus[k].visible)
elem.show();
else
elem.hide();
}
}
let showMenu = function(menu){
currentMenu = menu;
for(let k in menus)
menus[k].visible = false;
menus[menu].visible = true;
renderMenus();
if(menus[currentMenu].items.length > 0){
$('#menu_' + currentMenu + ' .menu-item').removeClass('selected');
$('#menu_' + currentMenu + ' .menu-item:eq(0)').addClass('selected');
menus[currentMenu].current = 0;
currentVal = menus[currentMenu].items[menus[currentMenu].current].value;
currentType = $('#menu_' + currentMenu + ' .menu-item:eq(0)').data('type');
currentCount = $('#menu_' + currentMenu + ' .menu-item:eq(0)').data('count');
}
isMenuOpen = true
}
let hideMenus = function(){
for(let k in menus)
menus[k].visible = false;
renderMenus();
isMenuOpen = false;
}
let isMenuOpen = false
let currentMenu = null;
let currentControl = null;
let currentVal = null;
let currentType = null;
let currentCount = null;
renderMenus();
window.onData = function(data){
if(data.showMenu === true){
showMenu(data.menu);
}
if(data.showMenu === false){
hideMenus();
}
if(data.move && isMenuOpen){
if(data.move == 'UP'){
if(menus[currentMenu].current > 0)
menus[currentMenu].current--;
}
if(data.move == 'DOWN'){
let max = $('#menu_' + currentMenu + ' .menu-item').length;
if(menus[currentMenu].current < max - 1)
menus[currentMenu].current++;
}
$('#menu_' + currentMenu + ' .menu-item').removeClass('selected');
$('#menu_' + currentMenu + ' .menu-item:eq(' + menus[currentMenu].current + ')').addClass('selected');
currentVal = menus[currentMenu].items[menus[currentMenu].current].value;
currentType = $('#menu_' + currentMenu + ' .menu-item:eq(' + menus[currentMenu].current + ')').data('type');
currentCount = $('#menu_' + currentMenu + ' .menu-item:eq(' + menus[currentMenu].current + ')').data('count');
}
if(data.enterPressed){
if(isMenuOpen) {
$.post('http://esx_jobs/select', JSON.stringify({
menu : currentMenu,
val : currentVal,
type : currentType,
count: currentCount
}))
let elem = $('#menu_' + currentMenu + ' .menu-item.selected')
if(elem.data('remove-on-select') == true){
elem.remove();
menus[currentMenu].items.splice(menus[currentMenu].current, 1)
menus[currentMenu].current = 0;
$('#menu_' + currentMenu + ' .menu-item').removeClass('selected');
$('#menu_' + currentMenu + ' .menu-item:eq(0)').addClass('selected');
currentVal = menus[currentMenu].items[0].value;
currentType = $('#menu_' + currentMenu + ' .menu-item:eq(0)').data('type');
currentCount = $('#menu_' + currentMenu + ' .menu-item:eq(0)').data('count');
}
}
}
if(data.backspacePressed){
if(isMenuOpen && currentMenu == 'cloakroom'){
hideMenus();
}
}
}
window.onload = function(e){ window.addEventListener('message', function(event){ onData(event.data) }); }
})()
+1
View File
File diff suppressed because one or more lines are too long
+15
View File
@@ -0,0 +1,15 @@
<html>
<head>
<meta charset="utf-8"/>
<link rel="stylesheet" href="css/app.css" type="text/css" />
</head>
<body>
<div class="menu" id="menu_cloakroom"></div>
<!-- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> -->
<script src="nui://game/ui/jquery.js" type="text/javascript"></script>
<script src="scripts/mustache.min.js"></script>
<script src="scripts/app.js"></script>
</body>
</html>
+167
View File
@@ -0,0 +1,167 @@
Config.Jobs.fisherman = {
BlipInfos = {
Sprite = 68,
Color = 38
},
Vehicles = {
Truck = {
Spawner = 1,
Hash = "benson",
Trailer = "none",
HasCaution = true
},
Boat = {
Spawner = 2,
Hash = "tug",
Trailer = "none",
HasCaution = false
}
},
Zones = {
CloakRoom = {
Pos = {x = 868.39929199219, y = -1639.7556152344, z = 29.339252471924},
Size = {x = 3.0, y = 3.0, z = 1.0},
Color = {r = 204, g = 204, b = 0},
Marker= 1,
Blip = true,
Name = "Vestiaire",
Type = "cloakroom",
Hint = "Appuyez sur ~INPUT_PICKUP~ pour vous changer.",
GPS = {x = 880.74462890625, y = -1663.9635009766, z = 29.370491027832}
},
FishingSpot = {
Pos = {x = 4435.21, y = 4829.6, z = 0.3439},
Color = {r = 204, g = 204, b = 0},
Size = {x = 110.0, y = 110.0, z = 10.0},
Marker= 1,
Blip = true,
Name = "Zone de pêche",
Type = "work",
Item = {
{
name = "Poisson",
db_name= "fish",
time = 2000,
max = 100,
add = 1,
remove = 1,
requires = "nothing",
requires_name = "Nothing",
drop = 100
}
},
Hint = "Appuyez sur ~INPUT_PICKUP~ pour pêcher.",
GPS = {x = 3859.43, y = 4448.83, z = 0.39994}
},
BoatSpawner = {
Pos = {x = 3867.44, y = 4463.62, z = 1.72386},
Size = {x = 3.0, y = 3.0, z = 1.0},
Color = {r = 204, g = 204, b = 0},
Marker= 1,
Blip = true,
Name = "Spawner bateau",
Type = "vehspawner",
Spawner = 2,
Hint = "Appuyez sur ~INPUT_PICKUP~ pour appeler le bateau.",
Caution = 0,
GPS = {x = 4435.21, y = 4829.6, z = 0.3439}
},
BoatSpawnPoint = {
Pos = {x = 3888.3, y = 4468.09, z = 0.0},
Size = {x = 3.0, y = 3.0, z = 1.0},
Marker= -1,
Blip = false,
Name = "Bateau",
Type = "vehspawnpt",
Spawner = 2,
GPS = 0,
Heading = 270.1
},
BoatDeletePoint = {
Pos = {x = 3859.43, y = 4448.83, z = 0.39994},
Size = {x = 10.0, y = 10.0, z = 1.0},
Color = {r = 255, g = 0, b = 0},
Marker= 1,
Blip = false,
Name = "Supression du bateau",
Type = "vehdelete",
Hint = "Appuyez sur ~INPUT_PICKUP~ pour rendre le bateau.",
Spawner = 2,
Caution = 0,
GPS = {x = -1012.64758300781, y = -1354.62634277344, z = 5.54292726516724},
Teleport = {x = 3867.44, y = 4463.62, z = 1.72386}
},
VehicleSpawner = {
Pos = {x = 880.74462890625, y = -1663.9635009766, z = 29.370491027832},
Size = {x = 3.0, y = 3.0, z = 1.0},
Color = {r = 204, g = 204, b = 0},
Marker= 1,
Blip = false,
Name = "Spawner véhicule de fonction",
Type = "vehspawner",
Spawner = 1,
Hint = "Appuyez sur ~INPUT_PICKUP~ pour appeler le véhicule de livraison.",
Caution = 2000,
GPS = {x = 3867.44, y = 4463.62, z = 1.72386}
},
VehicleSpawnPoint = {
Pos = {x = 859.354, y = -1656.21, z = 29.5697},
Size = {x = 3.0, y = 3.0, z = 1.0},
Marker= -1,
Blip = false,
Name = "Véhicule de fonction",
Type = "vehspawnpt",
Spawner = 1,
GPS = 0,
Heading = 70.1
},
VehicleDeletePoint = {
Pos = {x = 863.23254394531, y = -1718.2849121094, z = 28.631998062134},
Size = {x = 5.0, y = 5.0, z = 1.0},
Color = {r = 255, g = 0, b = 0},
Marker= 1,
Blip = false,
Name = "Supression du véhicule",
Type = "vehdelete",
Hint = "Appuyez sur ~INPUT_PICKUP~ pour rendre le véhicule.",
Spawner = 1,
Caution = 2000,
GPS = 0,
Teleport = 0
},
Delivery = {
Pos = {x = -1012.64758300781, y = -1354.62634277344, z = 5.54292726516724},
Color = {r = 204, g = 204, b = 0},
Size = {x = 5.0, y = 5.0, z = 3.0},
Color = {r = 204, g = 204, b = 0},
Marker= 1,
Blip = true,
Name = "Point de livraison",
Type = "delivery",
Spawner = 2,
Item = {
{
name = "Livraison",
time = 500,
remove = 1,
max = 100, -- if not present, probably an error at itemQtty >= item.max in esx_jobs_sv.lua
price = 11,
requires = "fish",
requires_name = "Poisson",
drop = 100
}
},
Hint = "Appuyez sur ~INPUT_PICKUP~ pour livrer le poisson.",
GPS = {x = 3867.44, y = 4463.62, z = 1.72386}
}
}
}
+168
View File
@@ -0,0 +1,168 @@
Config.Jobs.fuel = {
BlipInfos = {
Sprite = 436,
Color = 5
},
Vehicles = {
Truck = {
Spawner = 1,
Hash = "phantom",
Trailer = "tanker",
HasCaution = true
}
},
Zones = {
CloakRoom = { -- 1
Pos = {x = 557.933, y = -2327.9, z = 4.82896},
Size = {x = 3.0, y = 3.0, z = 2.0},
Color = {r = 204, g = 204, b = 0},
Marker= 1,
Blip = true,
Name = "Vestiaire",
Type = "cloakroom",
Hint = "Appuyez sur ~INPUT_PICKUP~ pour vous changer.",
GPS = {x = 554.597, y = -2314.43, z = 4.86293}
},
ChampPetrol = { -- 4 -- 8
Pos = {x = 609.589, y = 2856.74, z = 39.4958},
Size = {x = 20.0, y = 20.0, z = 1.0},
Color = {r = 204, g = 204, b = 0},
Marker= 1,
Blip = true,
Name = "Pétrol",
Type = "work",
Item = {
{
name = "Pétrol",
db_name= "petrol",
time = 5000,
max = 24,
add = 1,
remove = 1,
requires = "nothing",
requires_name = "Nothing",
drop = 100
}
},
Hint = "Appuyez sur ~INPUT_PICKUP~ pour forer.",
GPS = {x = 2736.94, y = 1417.99, z = 23.4888}
},
Raffinerie = { -- 5
Pos = {x = 2736.94, y = 1417.99, z = 23.4888},
Size = {x = 10.0, y = 10.0, z = 1.0},
Color = {r = 204, g = 204, b = 0},
Marker= 1,
Blip = true,
Name = "Pétrol raffiné",
Type = "work",
Item = {
{
name = "Pétrol raffiné",
db_name= "petrol_raffin",
time = 5000,
max = 20,
add = 1,
remove = 2,
requires = "petrol",
requires_name = "Pétrol",
drop = 100
}
},
Hint = "Appuyez sur ~INPUT_PICKUP~ pour raffiner.",
GPS = {x = 265.752, y = -3013.39, z = 4.73275}
},
Melange = { -- 6
Pos = {x = 265.752, y = -3013.39, z = 4.73275},
Size = {x = 10.0, y = 10.0, z = 1.0},
Color = {r = 204, g = 204, b = 0},
Marker= 1,
Blip = true,
Name = "Mélange",
Type = "work",
Item = {
{
name = "Essence",
db_name= "essence",
time = 5000,
max = 20,
add = 2,
remove = 1,
requires = "petrol_raffin",
requires_name = "Pétrol raffiné",
drop = 100
}
},
Hint = "Appuyez sur ~INPUT_PICKUP~ pour mélanger.",
GPS = {x = 491.406, y = -2163.37, z = 4.91827}
},
VehicleSpawner = { -- 2
Pos = {x = 554.597, y = -2314.43, z = 4.86293},
Size = {x = 3.0, y = 3.0, z = 2.0},
Color = {r = 204, g = 204, b = 0},
Marker= 1,
Blip = false,
Name = "Spawner véhicule de fonction",
Type = "vehspawner",
Spawner = 1,
Hint = "Appuyez sur ~INPUT_PICKUP~ pour appeler le camion.",
Caution = 2000,
GPS = {x = 602.254, y = 2926.62, z = 39.6898}
},
VehicleSpawnPoint = {
Pos = {x = 580.541, y = -2309.7, z = 4.90915},
Size = {x = 3.0, y = 3.0, z = 1.0},
Marker= -1,
Blip = false,
Name = "Véhicule de fonction",
Type = "vehspawnpt",
Spawner = 1,
GPS = 0,
Heading = 0
},
VehicleDeletePoint = {
Pos = {x = 520.684, y = -2124.21, z = 4.98635},
Size = {x = 5.0, y = 5.0, z = 1.0},
Color = {r = 255, g = 0, b = 0},
Marker= 1,
Blip = false,
Name = "Supression du véhicule",
Type = "vehdelete",
Hint = "Appuyez sur ~INPUT_PICKUP~ pour rendre le véhicule.",
Spawner = 1,
Caution = 2000,
GPS = 0,
Teleport = 0
},
Delivery = { -- 7
Pos = {x = 491.406, y = -2163.37, z = 4.91827},
Color = {r = 204, g = 204, b = 0},
Size = {x = 10.0, y = 10.0, z = 1.0},
Marker= 1,
Blip = true,
Name = "Point de livraison",
Type = "delivery",
Spawner = 1,
Item = {
{
name = "Livraison",
time = 500,
remove = 1,
max = 100, -- if not present, probably an error at itemQtty >= item.max in esx_jobs_sv.lua
price = 61,
requires = "essence",
requires_name = "Essence",
drop = 100
}
},
Hint = "Appuyez sur ~INPUT_PICKUP~ pour livrer l'essence.",
GPS = {x = 609.589, y = 2856.74, z = 39.4958}
}
}
}
+161
View File
@@ -0,0 +1,161 @@
Config.Jobs.lumberjack = {
BlipInfos = {
Sprite = 237,
Color = 4
},
Vehicles = {
Truck = {
Spawner = 1,
Hash = "phantom",
Trailer = "trailers",
HasCaution = true
}
},
Zones = {
CloakRoom = {
Pos = {x = 1200.63, y = -1276.875, z = 34.38},
Size = {x = 3.0, y = 3.0, z = 1.0},
Color = {r = 204, g = 204, b = 0},
Marker= 1,
Blip = true,
Name = "Vestiaire",
Type = "cloakroom",
Hint = "Appuyez sur ~INPUT_PICKUP~ pour vous changer."
},
Wood = {
Pos = {x = -534.323669433594, y = 5373.794921875, z = 69.503059387207},
Size = {x = 3.0, y = 3.0, z = 1.0},
Color = {r = 204, g = 204, b = 0},
Marker= 1,
Blip = true,
Name = "Tas de bois",
Type = "work",
Item = {
{
name = "Bois",
db_name= "wood",
time = 3000,
max = 20,
add = 1,
remove = 1,
requires = "nothing",
requires_name = "Nothing",
drop = 100
}
},
Hint = "Appuyez sur ~INPUT_PICKUP~ pour récupérer du bois."
},
CuttedWood = {
Pos = {x = -552.214660644531, y = 5326.90966796875, z = 72.5996017456055},
Size = {x = 3.0, y = 3.0, z = 1.0},
Color = {r = 204, g = 204, b = 0},
Marker= 1,
Blip = false,
Name = "Découpe du bois",
Type = "work",
Item = {
{
name = "Bois coupé",
db_name= "cutted_wood",
time = 5000,
max = 20,
add = 1,
remove = 1,
requires = "wood",
requires_name = "Bois",
drop = 100
}
},
Hint = "Appuyez sur ~INPUT_PICKUP~ pour couper du bois."
},
Planks = {
Pos = {x = -501.386596679688, y = 5280.53076171875, z = 79.6187744140625},
Size = {x = 3.0, y = 3.0, z = 1.0},
Color = {r = 204, g = 204, b = 0},
Marker= 1,
Blip = false,
Name = "Planches",
Type = "work",
Item = {
{
name = "Paquet de planche",
db_name= "packaged_plank",
time = 4000,
max = 100,
add = 5,
remove = 1,
requires = "cutted_wood",
requires_name = "Bois coupé",
drop = 100
}
},
Hint = "Appuyez sur ~INPUT_PICKUP~ pour récupérer des planches."
},
VehicleSpawner = {
Pos = {x = 1191.9681396484, y = -1261.7775878906, z = 34.170627593994},
Size = {x = 3.0, y = 3.0, z = 1.0},
Color = {r = 204, g = 204, b = 0},
Marker= 1,
Blip = false,
Name = "Spawner véhicule de fonction",
Type = "vehspawner",
Spawner = 1,
Hint = "Appuyez sur ~INPUT_PICKUP~ pour appeler le véhicule de livraison.",
Caution = 2000
},
VehicleSpawnPoint = {
Pos = {x = 1194.6257324219, y = -1286.955078125, z = 34.121524810791},
Size = {x = 3.0, y = 3.0, z = 1.0},
Marker= -1,
Blip = false,
Name = "Véhicule de fonction",
Type = "vehspawnpt",
Spawner = 1,
Heading = 285.1
},
VehicleDeletePoint = {
Pos = {x = 1216.8983154297, y = -1229.2396240234, z = 34.403507232666},
Size = {x = 5.0, y = 5.0, z = 1.0},
Color = {r = 255, g = 0, b = 0},
Marker= 1,
Blip = false,
Name = "Supression du véhicule",
Type = "vehdelete",
Hint = "Appuyez sur ~INPUT_PICKUP~ pour rendre le véhicule.",
Spawner = 1,
Caution = 2000,
GPS = 0,
Teleport = 0
},
Delivery = {
Pos = {x = 1201.3558349609, y = -1327.5159912109, z = 34.226093292236},
Color = {r = 204, g = 204, b = 0},
Size = {x = 5.0, y = 5.0, z = 3.0},
Marker= 1,
Blip = true,
Name = "Point de livraison",
Type = "delivery",
Spawner = 1,
Item = {
{
name = "Livraison",
time = 500,
remove = 1,
max = 100, -- if not present, probably an error at itemQtty >= item.max in esx_jobs_sv.lua
price = 13,
requires = "packaged_plank",
requires_name = "Paquet de planche",
drop = 100
}
},
Hint = "Appuyez sur ~INPUT_PICKUP~ pour livrer les planches."
}
}
}
+267
View File
@@ -0,0 +1,267 @@
Config.Jobs.miner = {
BlipInfos = {
Sprite = 318,
Color = 5
},
Vehicles = {
Truck = {
Spawner = 1,
Hash = "rubble",
Trailer = "none",
HasCaution = true
}
},
Zones = {
CloakRoom = {
Pos = {x = 892.35333251953, y = -2172.7705078125, z = 31.286273956299},
Size = {x = 3.0, y = 3.0, z = 1.0},
Color = {r = 204, g = 204, b = 0},
Marker= 1,
Blip = true,
Name = "Vestiaire",
Type = "cloakroom",
Hint = "Appuyez sur ~INPUT_PICKUP~ pour vous changer.",
GPS = {x = 884.86889648438, y = -2176.5102539063, z = 29.519346237183}
},
Mine = {
Pos = {x = 2962.4, y = 2746.2, z = 42.398},
Size = {x = 5.0, y = 5.0, z = 1.0},
Color = {r = 204, g = 204, b = 0},
Marker= 1,
Blip = true,
Name = "Rocher",
Type = "work",
Item = {
{
name = "Rocher",
db_name= "stone",
time = 3000,
max = 7,
add = 1,
remove = 1,
requires = "nothing",
requires_name = "Nothing",
drop = 100
}
},
Hint = "Appuyez sur ~INPUT_PICKUP~ pour récupérer des rochers.",
GPS = {x = 289.244, y = 2862.9, z = 42.6424}
},
StoneWash = {
Pos = {x = 289.244, y = 2862.9, z = 42.6424},
Size = {x = 5.0, y = 5.0, z = 1.0},
Color = {r = 204, g = 204, b = 0},
Marker= 1,
Blip = true,
Name = "Roche lavé",
Type = "work",
Item = {
{
name = "Roche lavé",
db_name= "washed_stone",
time = 5000,
max = 7,
add = 1,
remove = 1,
requires = "stone",
requires_name = "Rocher",
drop = 100
}
},
Hint = "Appuyez sur ~INPUT_PICKUP~ pour laver les roches.",
GPS = {x = 1109.14, y = -2007.87, z = 30.0188}
},
Foundry = {
Pos = {x = 1109.14, y = -2007.87, z = 30.0188},
Size = {x = 5.0, y = 5.0, z = 1.0},
Color = {r = 204, g = 204, b = 0},
Marker= 1,
Blip = true,
Name = "Fonderie",
Type = "work",
Item = {
{
name = "Cuivre",
db_name= "copper",
time = 4000,
max = 56,
add = 8,
remove = 1,
requires = "washed_stone",
requires_name = "Roche lavé",
drop = 100
},
{
name = "Fer",
db_name= "iron",
max = 42,
add = 6,
drop = 100
},
{
name = "Or",
db_name= "gold",
max = 21,
add = 3,
drop = 100
},
{
name = "Diamant",
db_name= "diamond",
max = 50,
add = 1,
drop = 5
}
},
Hint = "Appuyez sur ~INPUT_PICKUP~ pour fondre les roches.",
GPS = {x = -169.481, y = -2659.16, z = 5.00103}
},
VehicleSpawner = {
Pos = {x = 884.86889648438, y = -2176.5102539063, z = 29.519346237183},
Size = {x = 5.0, y = 5.0, z = 1.0},
Color = {r = 204, g = 204, b = 0},
Marker= 1,
Blip = false,
Name = "Spawner véhicule de fonction",
Type = "vehspawner",
Spawner = 1,
Hint = "Appuyez sur ~INPUT_PICKUP~ pour appeler le véhicule de livraison.",
Caution = 2000,
GPS = {x = 2962.4, y = 2746.2, z = 42.398}
},
VehicleSpawnPoint = {
Pos = {x = 879.55700683594, y = -2189.7995605469, z = 29.519348144531},
Size = {x = 5.0, y = 5.0, z = 1.0},
Marker= -1,
Blip = false,
Name = "Véhicule de fonction",
Type = "vehspawnpt",
Spawner = 1,
Heading = 90.1,
GPS = 0
},
VehicleDeletePoint = {
Pos = {x = 881.93725585938, y = -2198.0151367188, z = 29.519351959229},
Size = {x = 5.0, y = 5.0, z = 1.0},
Color = {r = 255, g = 0, b = 0},
Marker= 1,
Blip = false,
Name = "Supression du véhicule",
Type = "vehdelete",
Hint = "Appuyez sur ~INPUT_PICKUP~ pour rendre le véhicule.",
Spawner = 1,
Caution = 2000,
GPS = 0,
Teleport = 0
},
CopperDelivery = {
Pos = {x = -169.481, y = -2659.16, z = 5.00103},
Color = {r = 204, g = 204, b = 0},
Size = {x = 5.0, y = 5.0, z = 3.0},
Marker= 1,
Blip = true,
Name = "Revente de cuivre",
Type = "delivery",
Spawner = 1,
Item = {
{
name = "Livraison",
time = 500,
remove = 1,
max = 56, -- if not present, probably an error at itemQtty >= item.max in esx_jobs_sv.lua
price = 5,
requires = "copper",
requires_name = "Cuivre",
drop = 100
}
},
Hint = "Appuyez sur ~INPUT_PICKUP~ pour livrer le cuivre.",
GPS = {x = -148.782, y = -1040.38, z = 26.2736}
},
IronDelivery = {
Pos = {x = -148.782, y = -1040.38, z = 26.2736},
Color = {r = 204, g = 204, b = 0},
Size = {x = 5.0, y = 5.0, z = 3.0},
Color = {r = 204, g = 204, b = 0},
Marker= 1,
Blip = true,
Name = "Revente de fer",
Type = "delivery",
Spawner = 1,
Item = {
{
name = "Livraison",
time = 500,
remove = 1,
max = 42, -- if not present, probably an error at itemQtty >= item.max in esx_jobs_sv.lua
price = 9,
requires = "iron",
requires_name = "Fer",
drop = 100
}
},
Hint = "Appuyez sur ~INPUT_PICKUP~ pour livrer le fer.",
GPS = {x = 261.487, y = 207.354, z = 109.287}
},
GoldDelivery = {
Pos = {x = 261.487, y = 207.354, z = 109.287},
Color = {r = 204, g = 204, b = 0},
Size = {x = 5.0, y = 5.0, z = 3.0},
Color = {r = 204, g = 204, b = 0},
Marker= 1,
Blip = true,
Name = "Revente d'or",
Type = "delivery",
Spawner = 1,
Item = {
{
name = "Livraison",
time = 500,
remove = 1,
max = 21, -- if not present, probably an error at itemQtty >= item.max in esx_jobs_sv.lua
price = 25,
requires = "gold",
requires_name = "Or",
drop = 100
}
},
Hint = "Appuyez sur ~INPUT_PICKUP~ pour livrer l'or'.",
GPS = {x = -621.046, y = -228.532, z = 37.0571}
},
DiamondDelivery = {
Pos = {x = -621.046, y = -228.532, z = 37.0571},
Color = {r = 204, g = 204, b = 0},
Size = {x = 5.0, y = 5.0, z = 3.0},
Color = {r = 204, g = 204, b = 0},
Marker= 1,
Blip = true,
Name = "Revente de diamants",
Type = "delivery",
Spawner = 1,
Item = {
{
name = "Livraison",
time = 500,
remove = 1,
max = 50, -- if not present, probably an error at itemQtty >= item.max in esx_jobs_sv.lua
price = 250,
requires = "diamond",
requires_name = "Diamant",
drop = 100
}
},
Hint = "Appuyez sur ~INPUT_PICKUP~ pour livrer les diamants.",
GPS = {x = 2962.4, y = 2746.2, z = 42.398}
}
}
}
+54
View File
@@ -0,0 +1,54 @@
Config.Jobs.reporter = {
BlipInfos = {
Sprite = 184,
Color = 1
},
Vehicles = {
Truck = {
Spawner = 1,
Hash = "rumpo",
Trailer = "none",
HasCaution = true
}
},
Zones = {
VehicleSpawner = {
Pos = { x = -141.41, y = -620.80, z = 167.82 },
Size = {x = 2.0, y = 2.0, z = 0.2},
Color = {r = 204, g = 204, b = 0},
Marker= 1,
Blip = true,
Name = "Le Maclerait Libéré",
Type = "vehspawner",
Spawner = 1,
Hint = "Appuyez sur ~INPUT_PICKUP~ pour descendre au garage.",
Caution = 2000
},
VehicleSpawnPoint = {
Pos = { x = -149.32023620605, y = -592.17163085938, z = 31.42448425293 },
Size = {x = 3.0, y = 3.0, z = 1.0},
Marker= -1,
Blip = false,
Name = "Véhicule de fonction",
Type = "vehspawnpt",
Spawner = 1,
Heading = 200.1
},
VehicleDeletePoint = {
Pos = { x = -144.2229309082, y = -577.02972412109, z = 31.42448425293 },
Size = {x = 5.0, y = 5.0, z = 0.2},
Color = {r = 255, g = 0, b = 0},
Marker= 1,
Blip = false,
Name = "Supression du véhicule",
Type = "vehdelete",
Hint = "Appuyez sur ~INPUT_PICKUP~ pour rendre le véhicule.",
Spawner = 1,
Caution = 2000,
GPS = 0,
Teleport = { x = -139.09838867188, y = -620.74865722656, z = 167.82052612305 }
}
}
}
+161
View File
@@ -0,0 +1,161 @@
Config.Jobs.slaughterer = {
BlipInfos = {
Sprite = 256,
Color = 5
},
Vehicles = {
Truck = {
Spawner = 1,
Hash = "benson",
Trailer = "none",
HasCaution = true
}
},
Zones = {
CloakRoom = {
Pos = {x = -1071.1319580078, y = -2003.7891845703, z = 14.78551197052},
Size = {x = 3.0, y = 3.0, z = 1.0},
Color = {r = 204, g = 204, b = 0},
Marker= 1,
Blip = true,
Name = "Vestiaire",
Type = "cloakroom",
Hint = "Appuyez sur ~INPUT_PICKUP~ pour vous changer."
},
AliveChicken = {
Pos = {x = -62.9018, y = 6241.46, z = 30.0901},
Size = {x = 3.0, y = 3.0, z = 1.0},
Color = {r = 204, g = 204, b = 0},
Marker= 1,
Blip = true,
Name = "Poulailler",
Type = "work",
Item = {
{
name = "Poulet vivant",
db_name= "alive_chicken",
time = 3000,
max = 20,
add = 1,
remove = 1,
requires = "nothing",
requires_name = "Nothing",
drop = 100
}
},
Hint = "Appuyez sur ~INPUT_PICKUP~ pour attrapper des poulets vivants."
},
SlaughterHouse = {
Pos = {x = -77.991, y = 6229.063, z = 30.091},
Size = {x = 3.0, y = 3.0, z = 1.0},
Color = {r = 204, g = 204, b = 0},
Marker= 1,
Blip = false,
Name = "Abattoir",
Type = "work",
Item = {
{
name = "Poulet à conditionner",
db_name= "slaughtered_chicken",
time = 5000,
max = 20,
add = 1,
remove = 1,
requires = "alive_chicken",
requires_name = "Poulet vivant",
drop = 100
}
},
Hint = "Appuyez sur ~INPUT_PICKUP~ pour dépecer les poulets."
},
Packaging = {
Pos = {x = -101.978, y = 6208.799, z = 30.025},
Size = {x = 3.0, y = 3.0, z = 1.0},
Color = {r = 204, g = 204, b = 0},
Marker= 1,
Blip = false,
Name = "Emballage",
Type = "work",
Item = {
{
name = "Poulet en barquette",
db_name= "packaged_chicken",
time = 4000,
max = 100,
add = 5,
remove = 1,
requires = "slaughtered_chicken",
requires_name = "Poulet à conditionner",
drop = 100
}
},
Hint = "Appuyez sur ~INPUT_PICKUP~ pour conditionner le poulet en barquette."
},
VehicleSpawner = {
Pos = {x = -1042.9444580078, y = -2023.2551269531, z = 12.161581993103},
Size = {x = 3.0, y = 3.0, z = 1.0},
Color = {r = 204, g = 204, b = 0},
Marker= 1,
Blip = false,
Name = "Spawner véhicule de fonction",
Type = "vehspawner",
Spawner = 1,
Hint = "Appuyez sur ~INPUT_PICKUP~ pour appeler le véhicule de livraison.",
Caution = 2000
},
VehicleSpawnPoint = {
Pos = {x = -1048.8568115234, y = -2025.322265625, z = 12.161581993103},
Size = {x = 3.0, y = 3.0, z = 1.0},
Marker= -1,
Blip = false,
Name = "Véhicule de fonction",
Type = "vehspawnpt",
Spawner = 1,
Heading = 130.1
},
VehicleDeletePoint = {
Pos = {x = -1061.5164794922, y = -2008.3552246094, z = 12.161584854126},
Size = {x = 5.0, y = 5.0, z = 1.0},
Color = {r = 255, g = 0, b = 0},
Marker= 1,
Blip = false,
Name = "Supression du véhicule",
Type = "vehdelete",
Hint = "Appuyez sur ~INPUT_PICKUP~ pour rendre le véhicule.",
Spawner = 1,
Caution = 2000,
GPS = 0,
Teleport = 0
},
Delivery = {
Pos = {x = -596.158, y = -889.324, z = 24.5073},
Color = {r = 204, g = 204, b = 0},
Size = {x = 5.0, y = 5.0, z = 1.0},
Marker= 1,
Blip = true,
Name = "Point de livraison",
Type = "delivery",
Spawner = 1,
Item = {
{
name = "Livraison",
time = 500,
remove = 1,
max = 100, -- if not present, probably an error at itemQtty >= item.max in esx_jobs_sv.lua
price = 11,
requires = "packaged_chicken",
requires_name = "Poulet en barquette",
drop = 100
}
},
Hint = "Appuyez sur ~INPUT_PICKUP~ pour livrer les barquettes de poulet."
}
}
}
+168
View File
@@ -0,0 +1,168 @@
Config.Jobs.textil = {
BlipInfos = {
Sprite = 366,
Color = 4
},
Vehicles = {
Truck = {
Spawner = 1,
Hash = "youga2",
Trailer = "none",
HasCaution = true
}
},
Zones = {
CloakRoom = {
Pos = {x = 706.735412597656, y = -960.902893066406, z = 29.3953247070313},
Size = {x = 3.0, y = 3.0, z = 1.0},
Color = {r = 204, g = 204, b = 0},
Marker= 1,
Blip = true,
Name = "Vestiaire",
Type = "cloakroom",
Hint = "Appuyez sur ~INPUT_PICKUP~ pour vous changer.",
GPS = {x = 740.808776855469, y = -970.066650390625, z = 23.4693908691406}
},
Whool = {
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},
Marker= 1,
Blip = true,
Name = "Laine",
Type = "work",
Item = {
{
name = "Laine",
db_name= "whool",
time = 3000,
max = 40,
add = 1,
remove = 1,
requires = "nothing",
requires_name = "Nothing",
drop = 100
}
},
Hint = "Appuyez sur ~INPUT_PICKUP~ pour récupérer de la laine.",
GPS = {x = 715.954650878906, y = -959.639587402344, z = 29.3953247070313}
},
Fabric = {
Pos = {x = 715.954650878906, y = -959.639587402344, z = 29.3953247070313},
Size = {x = 3.0, y = 3.0, z = 1.0},
Color = {r = 204, g = 204, b = 0},
Marker= 1,
Blip = false,
Name = "Tissu",
Type = "work",
Item = {
{
name = "Tissu",
db_name= "fabric",
time = 5000,
max = 80,
add = 2,
remove = 1,
requires = "whool",
requires_name = "Laine",
drop = 100
}
},
Hint = "Appuyez sur ~INPUT_PICKUP~ pour fabriquer du tissu.",
GPS = {x = 712.928283691406, y = -970.5869140625, z = 29.3953247070313}
},
Clothe = {
Pos = {x = 712.928283691406, y = -970.5869140625, z = 29.3953247070313},
Size = {x = 3.0, y = 3.0, z = 1.0},
Color = {r = 204, g = 204, b = 0},
Marker= 1,
Blip = false,
Name = "Vêtement",
Type = "work",
Item = {
{
name = "Vêtement",
db_name= "clothe",
time = 4000,
max = 40,
add = 1,
remove = 2,
requires = "fabric",
requires_name = "Tissu",
drop = 100
}
},
Hint = "Appuyez sur ~INPUT_PICKUP~ pour récupérer des vêtements.",
GPS = {x = 429.595855712891, y = -807.341613769531, z = 28.4911441802979}
},
VehicleSpawner = {
Pos = {x = 740.808776855469, y = -970.066650390625, z = 23.4693908691406},
Size = {x = 3.0, y = 3.0, z = 1.0},
Color = {r = 204, g = 204, b = 0},
Marker= 1,
Blip = false,
Name = "Spawner véhicule de fonction",
Type = "vehspawner",
Spawner = 1,
Hint = "Appuyez sur ~INPUT_PICKUP~ pour appeler le véhicule de livraison.",
Caution = 2000,
GPS = {x = 1978.92407226563, y = 5171.70166015625, z = 46.6391181945801}
},
VehicleSpawnPoint = {
Pos = {x = 747.31396484375, y = -966.235778808594, z = 23.705005645752},
Size = {x = 3.0, y = 3.0, z = 1.0},
Marker= -1,
Blip = false,
Name = "Véhicule de fonction",
Type = "vehspawnpt",
Spawner = 1,
Heading = 270.1,
GPS = 0
},
VehicleDeletePoint = {
Pos = {x = 693.796325683594, y = -963.010498046875, z = 22.8247337341309},
Size = {x = 3.0, y = 3.0, z = 1.0},
Color = {r = 255, g = 0, b = 0},
Marker= 1,
Blip = false,
Name = "Supression du véhicule",
Type = "vehdelete",
Hint = "Appuyez sur ~INPUT_PICKUP~ pour rendre le véhicule.",
Spawner = 1,
Caution = 2000,
GPS = 0,
Teleport = 0
},
Delivery = {
Pos = {x = 429.595855712891, y = -807.341613769531, z = 28.4911441802979},
Color = {r = 204, g = 204, b = 0},
Size = {x = 5.0, y = 5.0, z = 3.0},
Marker= 1,
Blip = true,
Name = "Point de livraison",
Type = "delivery",
Spawner = 1,
Item = {
{
name = "Livraison",
time = 500,
remove = 1,
max = 100, -- if not present, probably an error at itemQtty >= item.max in esx_jobs_sv.lua
price = 40,
requires = "clothe",
requires_name = "Vêtement",
drop = 100
}
},
Hint = "Appuyez sur ~INPUT_PICKUP~ pour livrer les vêtements.",
GPS = {x = 1978.92407226563, y = 5171.70166015625, z = 46.6391181945801}
}
}
}
+128
View File
@@ -0,0 +1,128 @@
local PlayersWorking = {}
local Players = {}
ESX = nil
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
AddEventHandler('esx:playerDropped', function(source)
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
local caution = xPlayer.get('caution')
TriggerEvent('esx_addonaccount:getAccount', 'caution', xPlayer.identifier, function(account)
account.addMoney(caution)
end)
end)
RegisterServerEvent('esx_jobs:setCautionInCaseOfDrop')
AddEventHandler('esx_jobs:setCautionInCaseOfDrop', function(caution)
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
xPlayer.set('caution', caution)
end)
RegisterServerEvent('esx_jobs:giveBackCautionInCaseOfDrop')
AddEventHandler('esx_jobs:giveBackCautionInCaseOfDrop', function()
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
local caution = 0
TriggerEvent('esx_addonaccount:getAccount', 'caution', xPlayer.identifier, function(account)
caution = account.money
account.removeMoney(caution)
end)
if caution > 0 then
xPlayer.addAccountMoney('bank', value)
TriggerClientEvent('esx:showNotification', _source, 'Une caution de ~g~'.. value .. '$ ~s~vous a été rendue suite à votre évanouissment.')
else
TriggerClientEvent('esx:showNotification', _source, "Vous n'aviez pas de caution")
end
end)
RegisterServerEvent('esx_jobs:setCaution')
AddEventHandler('esx_jobs:setCaution', function()
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
xPlayer.set('caution', 0)
end)
local function Work(source, item)
SetTimeout(item[1].time, function()
if PlayersWorking[source] == true then
local xPlayer = ESX.GetPlayerFromId(source)
for i=1, #item, 1 do
local itemQtty = 0
if item[i].name ~= "Livraison" then
itemQtty = xPlayer.getInventoryItem(item[i].db_name).count
end
local requiredItemQtty = 0
if item[1].requires ~= "nothing" then
requiredItemQtty = xPlayer.getInventoryItem(item[1].requires).count
end
if item[i].name ~= "Livraison" and itemQtty >= item[i].max then
TriggerClientEvent('esx:showNotification', source, 'Vous avez le maximum de: ' .. item[i].name)
elseif item[i].requires ~= "nothing" and requiredItemQtty <= 0 then
TriggerClientEvent('esx:showNotification', source, "Vous n'avez plus assez de " .. item[1].requires_name .. " pour continuer cette tâche.")
else
if item[i].name ~= "Livraison" then
-- Chances to drop the item
if item[i].drop == 100 then
xPlayer.addInventoryItem(item[i].db_name, item[i].add)
else
local chanceToDrop = math.random(100)
if chanceToDrop <= item[i].drop then
xPlayer.addInventoryItem(item[i].db_name, item[i].add)
end
end
else
xPlayer.addMoney(item[i].price)
end
end
end
if item[1].requires ~= "nothing" then
local itemToRemoveQtty = xPlayer.getInventoryItem(item[1].requires).count
if itemToRemoveQtty > 0 then
xPlayer.removeInventoryItem(item[1].requires, item[1].remove)
end
end
Work(source, item)
end
end)
end
RegisterServerEvent('esx_jobs:startWork')
AddEventHandler('esx_jobs:startWork', function(item)
local source = source
PlayersWorking[source] = true
Work(source, item)
end)
RegisterServerEvent('esx_jobs:stopWork')
AddEventHandler('esx_jobs:stopWork', function()
local source = source
PlayersWorking[source] = false
end)
RegisterServerEvent('esx_jobs:caution')
AddEventHandler('esx_jobs:caution', function(cautionType, cautionAmount, spawnPoint, vehicle)
local source = source
local xPlayer = ESX.GetPlayerFromId(source)
if cautionType == "take" then
xPlayer.removeAccountMoney('bank', cautionAmount)
xPlayer.set('caution', cautionAmount)
TriggerClientEvent('esx:showNotification', source, 'Une caution de ~r~'.. cautionAmount .. '$ ~s~vous a été prélevée.')
TriggerClientEvent('esx_jobs:spawnJobVehicle', source, spawnPoint, vehicle)
elseif cautionType == "give_back" then
xPlayer.addAccountMoney('bank', cautionAmount)
xPlayer.set('caution', 0)
TriggerClientEvent('esx:showNotification', source, 'Une caution de ~g~'.. cautionAmount .. '$ ~s~vous a été rendue.')
end
end)