4 tab indent, cleanup

This commit is contained in:
ElPumpo
2018-11-10 13:20:11 +01:00
parent 714a16c60b
commit b5d389a82e
4 changed files with 933 additions and 1078 deletions
-1
View File
@@ -26,7 +26,6 @@ git clone https://github.com/ESX-Org/esx_mecanojob [esx]/esx_mecanojob
- Download https://github.com/ESX-Org/esx_mecanojob/archive/master.zip
- Put it in the `[esx]` directory
## Installation
- Import `esx_mecanojob.sql` in your database
- If you want player management you have to set `Config.EnablePlayerManagement` to `true` in `config.lua`
+685 -810
View File
File diff suppressed because it is too large Load Diff
+91 -89
View File
@@ -8,105 +8,107 @@ Config.NPCNextToDistance = 25.0
Config.NPCJobEarnings = { min = 15, max = 40 }
Config.Locale = 'fr'
Config.Vehicles = {
'adder',
'asea',
'asterope',
'banshee',
'buffalo'
}
Config.Zones = {
MecanoActions = {
Pos = { x = -342.291, y = -133.370, z = 38.009 },
Size = { x = 1.5, y = 1.5, z = 1.0 },
Color = { r = 204, g = 204, b = 0 },
Type = 1,
},
Garage = {
Pos = { x = -97.5797576904297, y = 6496.11376953125, z = 30.4909038543701 },
Size = { x = 1.5, y = 1.5, z = 1.0 },
Color = { r = 204, g = 204, b = 0 },
Type = 1,
},
MecanoActions = {
Pos = { x = -342.291, y = -133.370, z = 38.009 },
Size = { x = 1.5, y = 1.5, z = 1.0 },
Color = { r = 204, g = 204, b = 0 },
Type = 1,
},
Craft = {
Pos = { x = -323.140, y = -129.882, z = 37.999 },
Size = { x = 1.5, y = 1.5, z = 1.0 },
Color = { r = 204, g = 204, b = 0 },
Type = 1,
},
Garage = {
Pos = { x = -97.5797576904297, y = 6496.11376953125, z = 30.4909038543701 },
Size = { x = 1.5, y = 1.5, z = 1.0 },
Color = { r = 204, g = 204, b = 0 },
Type = 1,
},
VehicleSpawnPoint = {
Pos = { x = -366.354, y = -110.766, z = 37.696 },
Size = { x = 1.5, y = 1.5, z = 1.0 },
Type = -1,
},
Craft = {
Pos = { x = -323.140, y = -129.882, z = 37.999 },
Size = { x = 1.5, y = 1.5, z = 1.0 },
Color = { r = 204, g = 204, b = 0 },
Type = 1,
},
VehicleDeleter = {
Pos = { x = -386.899, y = -105.675, z = 37.683 },
Size = { x = 3.0, y = 3.0, z = 1.0 },
Color = { r = 204, g = 204, b = 0 },
Type = 1,
},
VehicleSpawnPoint = {
Pos = { x = -366.354, y = -110.766, z = 37.696 },
Size = { x = 1.5, y = 1.5, z = 1.0 },
Type = -1,
},
VehicleDeleter = {
Pos = { x = -386.899, y = -105.675, z = 37.683 },
Size = { x = 3.0, y = 3.0, z = 1.0 },
Color = { r = 204, g = 204, b = 0 },
Type = 1,
},
VehicleDelivery = {
Pos = { x = -382.925, y = -133.748, z = 37.685 },
Size = { x = 20.0, y = 20.0, z = 3.0 },
Color = { r = 204, g = 204, b = 0 },
Type = -1,
}
VehicleDelivery = {
Pos = { x = -382.925, y = -133.748, z = 37.685 },
Size = { x = 20.0, y = 20.0, z = 3.0 },
Color = { r = 204, g = 204, b = 0 },
Type = -1,
},
}
Config.Towables = {
{ ['x'] = -2480.8720703125, ['y'] = -211.96409606934, ['z'] = 17.397672653198 },
{ ['x'] = -2723.392578125, ['y'] = 13.207388877869, ['z'] = 15.12806892395 },
{ ['x'] = -3169.6235351563, ['y'] = 976.18127441406, ['z'] = 15.038360595703 },
{ ['x'] = -3139.7568359375, ['y'] = 1078.7182617188, ['z'] = 20.189767837524 },
{ ['x'] = -1656.9357910156, ['y'] = -246.16479492188, ['z'] = 54.510955810547 },
{ ['x'] = -1586.6560058594, ['y'] = -647.56115722656, ['z'] = 29.441320419312 },
{ ['x'] = -1036.1470947266, ['y'] = -491.05856323242, ['z'] = 36.214912414551 },
{ ['x'] = -1029.1884765625, ['y'] = -475.53167724609, ['z'] = 36.416831970215 },
{ ['x'] = 75.212287902832, ['y'] = 164.8522644043, ['z'] = 104.69123077393 },
{ ['x'] = -534.60491943359, ['y'] = -756.71801757813, ['z'] = 31.599143981934 },
{ ['x'] = 487.24212646484, ['y'] = -30.827201843262, ['z'] = 88.856712341309 },
{ ['x'] = -772.20111083984, ['y'] = -1281.8114013672, ['z'] = 4.5642876625061 },
{ ['x'] = -663.84173583984, ['y'] = -1206.9936523438, ['z'] = 10.171216011047 },
{ ['x'] = 719.12451171875, ['y'] = -767.77545166016, ['z'] = 24.892364501953 },
{ ['x'] = -970.95465087891, ['y'] = -2410.4453125, ['z'] = 13.344270706177 },
{ ['x'] = -1067.5234375, ['y'] = -2571.4064941406, ['z'] = 13.211874008179 },
{ ['x'] = -619.23968505859, ['y'] = -2207.2927246094, ['z'] = 5.5659561157227 },
{ ['x'] = 1192.0831298828, ['y'] = -1336.9086914063, ['z'] = 35.106426239014 },
{ ['x'] = -432.81033325195, ['y'] = -2166.0505371094, ['z'] = 9.8885231018066 },
{ ['x'] = -451.82403564453, ['y'] = -2269.34765625, ['z'] = 7.1719741821289 },
{ ['x'] = 939.26702880859, ['y'] = -2197.5390625, ['z'] = 30.546691894531 },
{ ['x'] = -556.11486816406, ['y'] = -1794.7312011719, ['z'] = 22.043060302734 },
{ ['x'] = 591.73504638672, ['y'] = -2628.2197265625, ['z'] = 5.5735430717468 },
{ ['x'] = 1654.515625, ['y'] = -2535.8325195313, ['z'] = 74.491394042969 },
{ ['x'] = 1642.6146240234, ['y'] = -2413.3159179688, ['z'] = 93.139915466309 },
{ ['x'] = 1371.3223876953, ['y'] = -2549.525390625, ['z'] = 47.575256347656 },
{ ['x'] = 383.83779907227, ['y'] = -1652.8695068359, ['z'] = 37.278503417969 },
{ ['x'] = 27.219129562378, ['y'] = -1030.8818359375, ['z'] = 29.414621353149 },
{ ['x'] = 229.26435852051, ['y'] = -365.91101074219, ['z'] = 43.750762939453 },
{ ['x'] = -85.809432983398, ['y'] = -51.665500640869, ['z'] = 61.10591506958 },
{ ['x'] = -4.5967531204224, ['y'] = -670.27124023438, ['z'] = 31.85863494873 },
{ ['x'] = -111.89884185791, ['y'] = 91.96940612793, ['z'] = 71.080169677734 },
{ ['x'] = -314.26129150391, ['y'] = -698.23309326172, ['z'] = 32.545776367188 },
{ ['x'] = -366.90979003906, ['y'] = 115.53963470459, ['z'] = 65.575706481934 },
{ ['x'] = -592.06726074219, ['y'] = 138.20733642578, ['z'] = 60.074813842773 },
{ ['x'] = -1613.8572998047, ['y'] = 18.759860992432, ['z'] = 61.799819946289 },
{ ['x'] = -1709.7995605469, ['y'] = 55.105819702148, ['z'] = 65.706237792969 },
{ ['x'] = -521.88830566406, ['y'] = -266.7805480957, ['z'] = 34.940990447998 },
{ ['x'] = -451.08666992188, ['y'] = -333.52026367188, ['z'] = 34.021533966064 },
{ ['x'] = 322.36480712891, ['y'] = -1900.4990234375, ['z'] = 25.773607254028 },
{ ['x'] = -2480.8720703125, ['y'] = -211.96409606934, ['z'] = 17.397672653198 },
{ ['x'] = -2723.392578125, ['y'] = 13.207388877869, ['z'] = 15.12806892395 },
{ ['x'] = -3169.6235351563, ['y'] = 976.18127441406, ['z'] = 15.038360595703 },
{ ['x'] = -3139.7568359375, ['y'] = 1078.7182617188, ['z'] = 20.189767837524 },
{ ['x'] = -1656.9357910156, ['y'] = -246.16479492188, ['z'] = 54.510955810547 },
{ ['x'] = -1586.6560058594, ['y'] = -647.56115722656, ['z'] = 29.441320419312 },
{ ['x'] = -1036.1470947266, ['y'] = -491.05856323242, ['z'] = 36.214912414551 },
{ ['x'] = -1029.1884765625, ['y'] = -475.53167724609, ['z'] = 36.416831970215 },
{ ['x'] = 75.212287902832, ['y'] = 164.8522644043, ['z'] = 104.69123077393 },
{ ['x'] = -534.60491943359, ['y'] = -756.71801757813, ['z'] = 31.599143981934 },
{ ['x'] = 487.24212646484, ['y'] = -30.827201843262, ['z'] = 88.856712341309 },
{ ['x'] = -772.20111083984, ['y'] = -1281.8114013672, ['z'] = 4.5642876625061 },
{ ['x'] = -663.84173583984, ['y'] = -1206.9936523438, ['z'] = 10.171216011047 },
{ ['x'] = 719.12451171875, ['y'] = -767.77545166016, ['z'] = 24.892364501953 },
{ ['x'] = -970.95465087891, ['y'] = -2410.4453125, ['z'] = 13.344270706177 },
{ ['x'] = -1067.5234375, ['y'] = -2571.4064941406, ['z'] = 13.211874008179 },
{ ['x'] = -619.23968505859, ['y'] = -2207.2927246094, ['z'] = 5.5659561157227 },
{ ['x'] = 1192.0831298828, ['y'] = -1336.9086914063, ['z'] = 35.106426239014 },
{ ['x'] = -432.81033325195, ['y'] = -2166.0505371094, ['z'] = 9.8885231018066 },
{ ['x'] = -451.82403564453, ['y'] = -2269.34765625, ['z'] = 7.1719741821289 },
{ ['x'] = 939.26702880859, ['y'] = -2197.5390625, ['z'] = 30.546691894531 },
{ ['x'] = -556.11486816406, ['y'] = -1794.7312011719, ['z'] = 22.043060302734 },
{ ['x'] = 591.73504638672, ['y'] = -2628.2197265625, ['z'] = 5.5735430717468 },
{ ['x'] = 1654.515625, ['y'] = -2535.8325195313, ['z'] = 74.491394042969 },
{ ['x'] = 1642.6146240234, ['y'] = -2413.3159179688, ['z'] = 93.139915466309 },
{ ['x'] = 1371.3223876953, ['y'] = -2549.525390625, ['z'] = 47.575256347656 },
{ ['x'] = 383.83779907227, ['y'] = -1652.8695068359, ['z'] = 37.278503417969 },
{ ['x'] = 27.219129562378, ['y'] = -1030.8818359375, ['z'] = 29.414621353149 },
{ ['x'] = 229.26435852051, ['y'] = -365.91101074219, ['z'] = 43.750762939453 },
{ ['x'] = -85.809432983398, ['y'] = -51.665500640869, ['z'] = 61.10591506958 },
{ ['x'] = -4.5967531204224, ['y'] = -670.27124023438, ['z'] = 31.85863494873 },
{ ['x'] = -111.89884185791, ['y'] = 91.96940612793, ['z'] = 71.080169677734 },
{ ['x'] = -314.26129150391, ['y'] = -698.23309326172, ['z'] = 32.545776367188 },
{ ['x'] = -366.90979003906, ['y'] = 115.53963470459, ['z'] = 65.575706481934 },
{ ['x'] = -592.06726074219, ['y'] = 138.20733642578, ['z'] = 60.074813842773 },
{ ['x'] = -1613.8572998047, ['y'] = 18.759860992432, ['z'] = 61.799819946289 },
{ ['x'] = -1709.7995605469, ['y'] = 55.105819702148, ['z'] = 65.706237792969 },
{ ['x'] = -521.88830566406, ['y'] = -266.7805480957, ['z'] = 34.940990447998 },
{ ['x'] = -451.08666992188, ['y'] = -333.52026367188, ['z'] = 34.021533966064 },
{ ['x'] = 322.36480712891, ['y'] = -1900.4990234375, ['z'] = 25.773607254028 }
}
for i=1, #Config.Towables, 1 do
Config.Zones['Towable' .. i] = {
Pos = Config.Towables[i],
Size = { x = 1.5, y = 1.5, z = 1.0 },
Color = { r = 204, g = 204, b = 0 },
Type = -1
}
Config.Zones['Towable' .. i] = {
Pos = Config.Towables[i],
Size = { x = 1.5, y = 1.5, z = 1.0 },
Color = { r = 204, g = 204, b = 0 },
Type = -1
}
end
Config.Vehicles = {
'adder',
'asea',
'asterope',
'banshee',
'buffalo'
}
+157 -178
View File
@@ -9,262 +9,251 @@ PlayersCrafting3 = {}
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
if Config.MaxInService ~= -1 then
TriggerEvent('esx_service:activateService', 'mecano', Config.MaxInService)
TriggerEvent('esx_service:activateService', 'mecano', Config.MaxInService)
end
TriggerEvent('esx_phone:registerNumber', 'mecano', _U('mechanic_customer'), true, true)
TriggerEvent('esx_society:registerSociety', 'mecano', 'Mecano', 'society_mecano', 'society_mecano', 'society_mecano', {type = 'private'})
local function Harvest(source)
SetTimeout(4000, function()
SetTimeout(4000, function()
if PlayersHarvesting[source] == true then
local xPlayer = ESX.GetPlayerFromId(source)
local GazBottleQuantity = xPlayer.getInventoryItem('gazbottle').count
if PlayersHarvesting[source] == true then
if GazBottleQuantity >= 5 then
TriggerClientEvent('esx:showNotification', source, _U('you_do_not_room'))
else
xPlayer.addInventoryItem('gazbottle', 1)
Harvest(source)
end
end
local xPlayer = ESX.GetPlayerFromId(source)
local GazBottleQuantity = xPlayer.getInventoryItem('gazbottle').count
if GazBottleQuantity >= 5 then
TriggerClientEvent('esx:showNotification', source, _U('you_do_not_room'))
else
xPlayer.addInventoryItem('gazbottle', 1)
Harvest(source)
end
end
end)
end)
end
RegisterServerEvent('esx_mecanojob:startHarvest')
AddEventHandler('esx_mecanojob:startHarvest', function()
local _source = source
PlayersHarvesting[_source] = true
TriggerClientEvent('esx:showNotification', _source, _U('recovery_gas_can'))
Harvest(source)
local _source = source
PlayersHarvesting[_source] = true
TriggerClientEvent('esx:showNotification', _source, _U('recovery_gas_can'))
Harvest(source)
end)
RegisterServerEvent('esx_mecanojob:stopHarvest')
AddEventHandler('esx_mecanojob:stopHarvest', function()
local _source = source
PlayersHarvesting[_source] = false
local _source = source
PlayersHarvesting[_source] = false
end)
local function Harvest2(source)
SetTimeout(4000, function()
SetTimeout(4000, function()
if PlayersHarvesting2[source] == true then
local xPlayer = ESX.GetPlayerFromId(source)
local FixToolQuantity = xPlayer.getInventoryItem('fixtool').count
if PlayersHarvesting2[source] == true then
if FixToolQuantity >= 5 then
TriggerClientEvent('esx:showNotification', source, _U('you_do_not_room'))
else
xPlayer.addInventoryItem('fixtool', 1)
Harvest2(source)
end
end
local xPlayer = ESX.GetPlayerFromId(source)
local FixToolQuantity = xPlayer.getInventoryItem('fixtool').count
if FixToolQuantity >= 5 then
TriggerClientEvent('esx:showNotification', source, _U('you_do_not_room'))
else
xPlayer.addInventoryItem('fixtool', 1)
Harvest2(source)
end
end
end)
end)
end
RegisterServerEvent('esx_mecanojob:startHarvest2')
AddEventHandler('esx_mecanojob:startHarvest2', function()
local _source = source
PlayersHarvesting2[_source] = true
TriggerClientEvent('esx:showNotification', _source, _U('recovery_repair_tools'))
Harvest2(_source)
local _source = source
PlayersHarvesting2[_source] = true
TriggerClientEvent('esx:showNotification', _source, _U('recovery_repair_tools'))
Harvest2(_source)
end)
RegisterServerEvent('esx_mecanojob:stopHarvest2')
AddEventHandler('esx_mecanojob:stopHarvest2', function()
local _source = source
PlayersHarvesting2[_source] = false
local _source = source
PlayersHarvesting2[_source] = false
end)
local function Harvest3(source)
SetTimeout(4000, function()
SetTimeout(4000, function()
if PlayersHarvesting3[source] == true then
local xPlayer = ESX.GetPlayerFromId(source)
local CaroToolQuantity = xPlayer.getInventoryItem('carotool').count
if CaroToolQuantity >= 5 then
TriggerClientEvent('esx:showNotification', source, _U('you_do_not_room'))
else
xPlayer.addInventoryItem('carotool', 1)
Harvest3(source)
end
end
if PlayersHarvesting3[source] == true then
local xPlayer = ESX.GetPlayerFromId(source)
local CaroToolQuantity = xPlayer.getInventoryItem('carotool').count
if CaroToolQuantity >= 5 then
TriggerClientEvent('esx:showNotification', source, _U('you_do_not_room'))
else
xPlayer.addInventoryItem('carotool', 1)
Harvest3(source)
end
end
end)
end)
end
RegisterServerEvent('esx_mecanojob:startHarvest3')
AddEventHandler('esx_mecanojob:startHarvest3', function()
local _source = source
PlayersHarvesting3[_source] = true
TriggerClientEvent('esx:showNotification', _source, _U('recovery_body_tools'))
Harvest3(_source)
local _source = source
PlayersHarvesting3[_source] = true
TriggerClientEvent('esx:showNotification', _source, _U('recovery_body_tools'))
Harvest3(_source)
end)
RegisterServerEvent('esx_mecanojob:stopHarvest3')
AddEventHandler('esx_mecanojob:stopHarvest3', function()
local _source = source
PlayersHarvesting3[_source] = false
local _source = source
PlayersHarvesting3[_source] = false
end)
local function Craft(source)
SetTimeout(4000, function()
SetTimeout(4000, function()
if PlayersCrafting[source] == true then
local xPlayer = ESX.GetPlayerFromId(source)
local GazBottleQuantity = xPlayer.getInventoryItem('gazbottle').count
if PlayersCrafting[source] == true then
if GazBottleQuantity <= 0 then
TriggerClientEvent('esx:showNotification', source, _U('not_enough_gas_can'))
else
xPlayer.removeInventoryItem('gazbottle', 1)
xPlayer.addInventoryItem('blowpipe', 1)
Craft(source)
end
end
local xPlayer = ESX.GetPlayerFromId(source)
local GazBottleQuantity = xPlayer.getInventoryItem('gazbottle').count
if GazBottleQuantity <= 0 then
TriggerClientEvent('esx:showNotification', source, _U('not_enough_gas_can'))
else
xPlayer.removeInventoryItem('gazbottle', 1)
xPlayer.addInventoryItem('blowpipe', 1)
Craft(source)
end
end
end)
end)
end
RegisterServerEvent('esx_mecanojob:startCraft')
AddEventHandler('esx_mecanojob:startCraft', function()
local _source = source
PlayersCrafting[_source] = true
TriggerClientEvent('esx:showNotification', _source, _U('assembling_blowtorch'))
Craft(_source)
local _source = source
PlayersCrafting[_source] = true
TriggerClientEvent('esx:showNotification', _source, _U('assembling_blowtorch'))
Craft(_source)
end)
RegisterServerEvent('esx_mecanojob:stopCraft')
AddEventHandler('esx_mecanojob:stopCraft', function()
local _source = source
PlayersCrafting[_source] = false
local _source = source
PlayersCrafting[_source] = false
end)
local function Craft2(source)
SetTimeout(4000, function()
SetTimeout(4000, function()
if PlayersCrafting2[source] == true then
local xPlayer = ESX.GetPlayerFromId(source)
local FixToolQuantity = xPlayer.getInventoryItem('fixtool').count
if PlayersCrafting2[source] == true then
if FixToolQuantity <= 0 then
TriggerClientEvent('esx:showNotification', source, _U('not_enough_repair_tools'))
else
xPlayer.removeInventoryItem('fixtool', 1)
xPlayer.addInventoryItem('fixkit', 1)
Craft2(source)
end
end
local xPlayer = ESX.GetPlayerFromId(source)
local FixToolQuantity = xPlayer.getInventoryItem('fixtool').count
if FixToolQuantity <= 0 then
TriggerClientEvent('esx:showNotification', source, _U('not_enough_repair_tools'))
else
xPlayer.removeInventoryItem('fixtool', 1)
xPlayer.addInventoryItem('fixkit', 1)
Craft2(source)
end
end
end)
end)
end
RegisterServerEvent('esx_mecanojob:startCraft2')
AddEventHandler('esx_mecanojob:startCraft2', function()
local _source = source
PlayersCrafting2[_source] = true
TriggerClientEvent('esx:showNotification', _source, _U('assembling_repair_kit'))
Craft2(_source)
local _source = source
PlayersCrafting2[_source] = true
TriggerClientEvent('esx:showNotification', _source, _U('assembling_repair_kit'))
Craft2(_source)
end)
RegisterServerEvent('esx_mecanojob:stopCraft2')
AddEventHandler('esx_mecanojob:stopCraft2', function()
local _source = source
PlayersCrafting2[_source] = false
local _source = source
PlayersCrafting2[_source] = false
end)
local function Craft3(source)
SetTimeout(4000, function()
SetTimeout(4000, function()
if PlayersCrafting3[source] == true then
local xPlayer = ESX.GetPlayerFromId(source)
local CaroToolQuantity = xPlayer.getInventoryItem('carotool').count
if PlayersCrafting3[source] == true then
if CaroToolQuantity <= 0 then
TriggerClientEvent('esx:showNotification', source, _U('not_enough_body_tools'))
else
xPlayer.removeInventoryItem('carotool', 1)
xPlayer.addInventoryItem('carokit', 1)
Craft3(source)
end
end
local xPlayer = ESX.GetPlayerFromId(source)
local CaroToolQuantity = xPlayer.getInventoryItem('carotool').count
if CaroToolQuantity <= 0 then
TriggerClientEvent('esx:showNotification', source, _U('not_enough_body_tools'))
else
xPlayer.removeInventoryItem('carotool', 1)
xPlayer.addInventoryItem('carokit', 1)
Craft3(source)
end
end
end)
end)
end
RegisterServerEvent('esx_mecanojob:startCraft3')
AddEventHandler('esx_mecanojob:startCraft3', function()
local _source = source
PlayersCrafting3[_source] = true
TriggerClientEvent('esx:showNotification', _source, _U('assembling_body_kit'))
Craft3(_source)
local _source = source
PlayersCrafting3[_source] = true
TriggerClientEvent('esx:showNotification', _source, _U('assembling_body_kit'))
Craft3(_source)
end)
RegisterServerEvent('esx_mecanojob:stopCraft3')
AddEventHandler('esx_mecanojob:stopCraft3', function()
local _source = source
PlayersCrafting3[_source] = false
local _source = source
PlayersCrafting3[_source] = false
end)
RegisterServerEvent('esx_mecanojob:onNPCJobMissionCompleted')
AddEventHandler('esx_mecanojob:onNPCJobMissionCompleted', function()
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
local total = math.random(Config.NPCJobEarnings.min, Config.NPCJobEarnings.max);
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
local total = math.random(Config.NPCJobEarnings.min, Config.NPCJobEarnings.max);
if xPlayer.job.grade >= 3 then
total = total * 2
end
if xPlayer.job.grade >= 3 then
total = total * 2
end
TriggerEvent('esx_addonaccount:getSharedAccount', 'society_mecano', function(account)
account.addMoney(total)
end)
TriggerClientEvent("esx:showNotification", _source, _U('your_comp_earned').. total)
TriggerEvent('esx_addonaccount:getSharedAccount', 'society_mecano', function(account)
account.addMoney(total)
end)
TriggerClientEvent("esx:showNotification", _source, _U('your_comp_earned').. total)
end)
ESX.RegisterUsableItem('blowpipe', function(source)
local _source = source
local xPlayer = ESX.GetPlayerFromId(source)
local _source = source
local xPlayer = ESX.GetPlayerFromId(source)
xPlayer.removeInventoryItem('blowpipe', 1)
TriggerClientEvent('esx_mecanojob:onHijack', _source)
TriggerClientEvent('esx:showNotification', _source, _U('you_used_blowtorch'))
xPlayer.removeInventoryItem('blowpipe', 1)
TriggerClientEvent('esx_mecanojob:onHijack', _source)
TriggerClientEvent('esx:showNotification', _source, _U('you_used_blowtorch'))
end)
ESX.RegisterUsableItem('fixkit', function(source)
local _source = source
local xPlayer = ESX.GetPlayerFromId(source)
local _source = source
local xPlayer = ESX.GetPlayerFromId(source)
xPlayer.removeInventoryItem('fixkit', 1)
TriggerClientEvent('esx_mecanojob:onFixkit', _source)
TriggerClientEvent('esx:showNotification', _source, _U('you_used_repair_kit'))
xPlayer.removeInventoryItem('fixkit', 1)
TriggerClientEvent('esx_mecanojob:onFixkit', _source)
TriggerClientEvent('esx:showNotification', _source, _U('you_used_repair_kit'))
end)
ESX.RegisterUsableItem('carokit', function(source)
local _source = source
local xPlayer = ESX.GetPlayerFromId(source)
local _source = source
local xPlayer = ESX.GetPlayerFromId(source)
xPlayer.removeInventoryItem('carokit', 1)
TriggerClientEvent('esx_mecanojob:onCarokit', _source)
TriggerClientEvent('esx:showNotification', _source, _U('you_used_body_kit'))
xPlayer.removeInventoryItem('carokit', 1)
TriggerClientEvent('esx_mecanojob:onCarokit', _source)
TriggerClientEvent('esx:showNotification', _source, _U('you_used_body_kit'))
end)
RegisterServerEvent('esx_mecanojob:getStockItem')
@@ -274,10 +263,10 @@ AddEventHandler('esx_mecanojob:getStockItem', function(itemName, count)
TriggerEvent('esx_addoninventory:getSharedInventory', 'society_mecano', function(inventory)
local item = inventory.getItem(itemName)
local sourceItem = xPlayer.getInventoryItem(itemName)
-- is there enough in the society?
if count > 0 and item.count >= count then
-- can the player carry the said amount of x item?
if sourceItem.limit ~= -1 and (sourceItem.count + count) > sourceItem.limit then
TriggerClientEvent('esx:showNotification', xPlayer.source, _U('player_cannot_hold'))
@@ -293,43 +282,33 @@ AddEventHandler('esx_mecanojob:getStockItem', function(itemName, count)
end)
ESX.RegisterServerCallback('esx_mecanojob:getStockItems', function(source, cb)
TriggerEvent('esx_addoninventory:getSharedInventory', 'society_mecano', function(inventory)
cb(inventory.items)
end)
TriggerEvent('esx_addoninventory:getSharedInventory', 'society_mecano', function(inventory)
cb(inventory.items)
end)
end)
RegisterServerEvent('esx_mecanojob:putStockItems')
AddEventHandler('esx_mecanojob:putStockItems', function(itemName, count)
local xPlayer = ESX.GetPlayerFromId(source)
local xPlayer = ESX.GetPlayerFromId(source)
TriggerEvent('esx_addoninventory:getSharedInventory', 'society_mecano', function(inventory)
local item = inventory.getItem(itemName)
local playerItemCount = xPlayer.getInventoryItem(itemName).count
TriggerEvent('esx_addoninventory:getSharedInventory', 'society_mecano', function(inventory)
local item = inventory.getItem(itemName)
local playerItemCount = xPlayer.getInventoryItem(itemName).count
if item.count >= 0 and count <= playerItemCount then
xPlayer.removeInventoryItem(itemName, count)
inventory.addItem(itemName, count)
else
TriggerClientEvent('esx:showNotification', xPlayer.source, _U('invalid_quantity'))
end
TriggerClientEvent('esx:showNotification', xPlayer.source, _U('have_deposited', count, item.label))
end)
if item.count >= 0 and count <= playerItemCount then
xPlayer.removeInventoryItem(itemName, count)
inventory.addItem(itemName, count)
else
TriggerClientEvent('esx:showNotification', xPlayer.source, _U('invalid_quantity'))
end
TriggerClientEvent('esx:showNotification', xPlayer.source, _U('have_deposited', count, item.label))
end)
end)
ESX.RegisterServerCallback('esx_mecanojob:getPlayerInventory', function(source, cb)
local xPlayer = ESX.GetPlayerFromId(source)
local items = xPlayer.inventory
local xPlayer = ESX.GetPlayerFromId(source)
local items = xPlayer.inventory
cb({
items = items
})
cb({items = items})
end)