From 63c122fa1d3b8ea42818e1dee124d5029b147d60 Mon Sep 17 00:00:00 2001 From: ig0ne Date: Fri, 11 Aug 2017 02:11:11 +0200 Subject: [PATCH 01/66] Initial commit --- README.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 00000000..6f51f9ff --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# fxserver-esx_drugs +FXserver ESX Drugs From 1724e778e8608e2d7450f86196b9f3c866fbe858 Mon Sep 17 00:00:00 2001 From: ig0ne Date: Fri, 11 Aug 2017 02:18:30 +0200 Subject: [PATCH 02/66] Update README.md --- README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/README.md b/README.md index 6f51f9ff..97e88e09 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,26 @@ # fxserver-esx_drugs FXserver ESX Drugs + +[REQUIREMENTS] + + * esx_policejob => https://github.com/FXServer-ESX/fxserver-esx_policejob + +[INSTALLATION] + +1) CD in your resources/[esx] folder +2) Clone the repository +``` +git clone https://github.com/FXServer-ESX/fxserver-esx_drugs esx_drugs +``` +3) * Import esx_drugs.sql in your database + +4) Add this in your server.cfg : + +``` +start esx_drugs +``` + +[FEATURES] +* Use weed +* Cops can't see or interact with the drugs zones +* In the config.lua change the Config.RequiredCop to block the drugs zone in function of the cops count conected From de401cc8d24f39727986063a8454b9db2b4044bb Mon Sep 17 00:00:00 2001 From: ig0ne Date: Fri, 11 Aug 2017 02:19:05 +0200 Subject: [PATCH 03/66] Add files via upload --- __resource.lua | 7 + client/esx_drugs_cl.lua | 272 +++++++++++++++++++ config.lua | 20 ++ esx_drugs.sql | 8 + server/esx_drugs_sv.lua | 561 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 868 insertions(+) create mode 100644 __resource.lua create mode 100644 client/esx_drugs_cl.lua create mode 100644 config.lua create mode 100644 esx_drugs.sql create mode 100644 server/esx_drugs_sv.lua diff --git a/__resource.lua b/__resource.lua new file mode 100644 index 00000000..12628236 --- /dev/null +++ b/__resource.lua @@ -0,0 +1,7 @@ +description 'esx_drugs' + +server_script 'server/esx_drugs_sv.lua' +server_script 'config.lua' + +client_script 'config.lua' +client_script 'client/esx_drugs_cl.lua' \ No newline at end of file diff --git a/client/esx_drugs_cl.lua b/client/esx_drugs_cl.lua new file mode 100644 index 00000000..cfe2f4c7 --- /dev/null +++ b/client/esx_drugs_cl.lua @@ -0,0 +1,272 @@ +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 PID = 0 +local GUI = {} +local cokeQTE = 0 +ESX = nil +GUI.Time = 0 +local coke_poochQTE = 0 +local weedQTE = 0 +local weed_poochQTE = 0 +local methQTE = 0 +local meth_poochQTE = 0 +local PlayerData = {} +local GUI = {} +local HasAlreadyEnteredMarker = false +local LastZone = nil +local CurrentAction = nil +local CurrentActionMsg = '' +local CurrentActionData = {} + +Citizen.CreateThread(function() + while ESX == nil do + TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) + Citizen.Wait(0) + end +end) + +AddEventHandler('esx_drugs:hasEnteredMarker', function(zone) + + ESX.UI.Menu.CloseAll() + + if zone == 'CokeFarm' then + if myJob ~= "police" then + CurrentAction = 'coke_harvest' + CurrentActionMsg = 'Appuez sur ~INPUT_CONTEXT~ pour récolter la coke' + CurrentActionData = {} + end + end + + if zone == 'CokeTreatment' then + if myJob ~= "police" then + if cokeQTE >= 5 then + CurrentAction = 'coke_treatment' + CurrentActionMsg = 'Appuez sur ~INPUT_CONTEXT~ pour traiter la coke' + CurrentActionData = {} + end + end + end + + if zone == 'CokeResell' then + if myJob ~= "police" then + if coke_poochQTE >= 1 then + CurrentAction = 'coke_resell' + CurrentActionMsg = 'Appuez sur ~INPUT_CONTEXT~ pour vendre la coke' + CurrentActionData = {} + end + end + end + + if zone == 'MethFarm' then + if myJob ~= "police" then + CurrentAction = 'meth_harvest' + CurrentActionMsg = 'Appuez sur ~INPUT_CONTEXT~ pour récolter la meth' + CurrentActionData = {} + end + end + + if zone == 'MethTreatment' then + if myJob ~= "police" then + if cokeQTE >= 5 then + CurrentAction = 'meth_treatment' + CurrentActionMsg = 'Appuez sur ~INPUT_CONTEXT~ pour traiter la meth' + CurrentActionData = {} + end + end + end + + if zone == 'MethResell' then + if myJob ~= "police" then + if coke_poochQTE >= 1 then + CurrentAction = 'meth_resell' + CurrentActionMsg = 'Appuez sur ~INPUT_CONTEXT~ pour vendre la meth' + CurrentActionData = {} + end + end + end + + if zone == 'WeedFarm' then + if myJob ~= "police" then + CurrentAction = 'weed_harvest' + CurrentActionMsg = 'Appuez sur ~INPUT_CONTEXT~ pour récolter la weed' + CurrentActionData = {} + end + end + + if zone == 'WeedTreatment' then + if myJob ~= "police" then + if cokeQTE >= 5 then + CurrentAction = 'weed_treatment' + CurrentActionMsg = 'Appuez sur ~INPUT_CONTEXT~ pour traiter la weed' + CurrentActionData = {} + end + end + end + + if zone == 'WeedResell' then + if myJob ~= "police" then + if coke_poochQTE >= 1 then + CurrentAction = 'weed_resell' + CurrentActionMsg = 'Appuez sur ~INPUT_CONTEXT~ pour vendre la weed' + CurrentActionData = {} + end + end + end +end) + +AddEventHandler('esx_drugs:hasExitedMarker', function(zone) + + CurrentAction = nil + ESX.UI.Menu.CloseAll() + + TriggerServerEvent('esx_drugs:stopHarvestCoke') + TriggerServerEvent('esx_drugs:stopTransformCoke') + TriggerServerEvent('esx_drugs:stopSellCoke') + TriggerServerEvent('esx_drugs:stopHarvestMeth') + TriggerServerEvent('esx_drugs:stopTransformMeth') + TriggerServerEvent('esx_drugs:stopSellMeth') + TriggerServerEvent('esx_drugs:stopHarvestWeed') + TriggerServerEvent('esx_drugs:stopTransformWeed') + TriggerServerEvent('esx_drugs:stopSellWeed') +end) + +-- Weed Effect +RegisterNetEvent('esx_drugs:onPot') +AddEventHandler('esx_drugs:onPot', function() + RequestAnimSet("MOVE_M@DRUNK@SLIGHTLYDRUNK") + while not HasAnimSetLoaded("MOVE_M@DRUNK@SLIGHTLYDRUNK") do + Citizen.Wait(0) + end + TaskStartScenarioInPlace(GetPlayerPed(-1), "WORLD_HUMAN_SMOKING_POT", 0, true) + Citizen.Wait(5000) + DoScreenFadeOut(1000) + Citizen.Wait(1000) + ClearPedTasksImmediately(GetPlayerPed(-1)) + SetTimecycleModifier("spectator5") + SetPedMotionBlur(GetPlayerPed(-1), true) + SetPedMovementClipset(GetPlayerPed(-1), "MOVE_M@DRUNK@SLIGHTLYDRUNK", true) + SetPedIsDrunk(GetPlayerPed(-1), true) + DoScreenFadeIn(1000) + Citizen.Wait(600000) + DoScreenFadeOut(1000) + Citizen.Wait(1000) + DoScreenFadeIn(1000) + ClearTimecycleModifier() + ResetScenarioTypesEnabled() + ResetPedMovementClipset(GetPlayerPed(-1), 0) + SetPedIsDrunk(GetPlayerPed(-1), false) + SetPedMotionBlur(GetPlayerPed(-1), false) +end) + +-- Render markers +Citizen.CreateThread(function() + while true do + + Wait(0) + + local coords = GetEntityCoords(GetPlayerPed(-1)) + + for k,v in pairs(Config.Zones) do + if(GetDistanceBetweenCoords(coords, v.x, v.y, v.z, true) < Config.DrawDistance) then + DrawMarker(Config.MarkerType, v.x, v.y, v.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, Config.ZoneSize.x, Config.ZoneSize.y, Config.ZoneSize.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false) + end + end + + end +end) + +-- RETURN NUMBER OF ITEMS FROM SERVER +RegisterNetEvent('esx_drugs:ReturnInventory') +AddEventHandler('esx_drugs:ReturnInventory', function(cokeNbr, cokepNbr, methNbr, methpNbr, weedNbr, weedpNbr, jobName, currentZone) + cokeQTE = cokeNbr + coke_poochQTE = cokepNbr + methQTE = methNbr + meth_poochQTE = methpNbr + weedQTE = weedNbr + weed_poochQTE = weedpNbr + myJob = jobName + TriggerEvent('esx_drugs:hasEnteredMarker', currentZone) +end) + +-- Activate menu when player is inside marker +Citizen.CreateThread(function() + while true do + + Wait(0) + + local coords = GetEntityCoords(GetPlayerPed(-1)) + local isInMarker = false + local currentZone = nil + + for k,v in pairs(Config.Zones) do + if(GetDistanceBetweenCoords(coords, v.x, v.y, v.z, true) < Config.ZoneSize.x / 2) then + isInMarker = true + currentZone = k + end + end + + if isInMarker and not hasAlreadyEnteredMarker then + hasAlreadyEnteredMarker = true + lastZone = currentZone + TriggerServerEvent('esx_drugs:GetUserInventory', currentZone) + end + + if not isInMarker and hasAlreadyEnteredMarker then + hasAlreadyEnteredMarker = false + TriggerEvent('esx_drugs:hasExitedMarker', lastZone) + end + + end +end) + +-- Key Controls +Citizen.CreateThread(function() + while true do + Citizen.Wait(0) + if CurrentAction ~= nil then + SetTextComponentFormat('STRING') + AddTextComponentString(CurrentActionMsg) + DisplayHelpTextFromStringLabel(0, 0, 1, -1) + if IsControlJustReleased(0, 38) then + if CurrentAction == 'coke_harvest' then + TriggerServerEvent('esx_drugs:startHarvestCoke') + end + if CurrentAction == 'coke_treatment' then + TriggerServerEvent('esx_drugs:startTransformCoke') + end + if CurrentAction == 'coke_resell' then + TriggerServerEvent('esx_drugs:startSellCoke') + end + if CurrentAction == 'meth_harvest' then + TriggerServerEvent('esx_drugs:startHarvestMeth') + end + if CurrentAction == 'meth_treatment' then + TriggerServerEvent('esx_drugs:startTransformMeth') + end + if CurrentAction == 'meth_resell' then + TriggerServerEvent('esx_drugs:startSellCoke') + end + if CurrentAction == 'weed_harvest' then + TriggerServerEvent('esx_drugs:startHarvestWeed') + end + if CurrentAction == 'wedd_treatment' then + TriggerServerEvent('esx_drugs:startTransformWeed') + end + if CurrentAction == 'weed_resell' then + TriggerServerEvent('esx_drugs:startSellWeed') + end + CurrentAction = nil + end + end + end +end) diff --git a/config.lua b/config.lua new file mode 100644 index 00000000..6699d8ca --- /dev/null +++ b/config.lua @@ -0,0 +1,20 @@ +Config = {} +Config.MarkerType = 1 +Config.DrawDistance = 100.0 +Config.ZoneSize = {x = 5.0, y = 5.0, z = 3.0} +--Config.MarkerColor = {r = 100, g = 204, b = 100} +Config.RequiredCopsCoke = 2 +Config.RequiredCopsMeth = 2 +Config.RequiredCopsWeed = 0 + +Config.Zones = { + CokeFarm = {x=2448.9228515625, y=-1836.8076171875, z=51.953701019287}, + CokeTreatment = {x=-458.13967895508, y=-2278.6174316406, z=7.5158290863037}, + CokeResell = {x=-1756.1984863281, y=427.31674194336, z=126.68292999268}, + MethFarm = {x=1525.298828125, y=1710.0217285156, z=109.00956726074}, + MethTreatment = {x=-1001.4151611328, y=4848.0087890625, z=274.00686645508}, + MethResell = {x=-63.592178344727, y=-1224.0709228516, z=27.768648147583}, + WeedFarm = {x=1609.125, y=6663.5942382813, z=20.961572647095}, + WeedTreatment = {x=91.061386108398, y=3750.0380859375, z=39.77326965332}, + WeedResell = {x=-54.249694824219, y=-1443.3666992188, z=31.068626403809} +} \ No newline at end of file diff --git a/esx_drugs.sql b/esx_drugs.sql new file mode 100644 index 00000000..6cad45ce --- /dev/null +++ b/esx_drugs.sql @@ -0,0 +1,8 @@ +INSERT INTO `items` (name, label) VALUES + ('weed', 'Weed'), + ('weed_pooch', 'Pochon de weed'), + ('coke', 'Coke'), + ('coke_pooch', 'Pochon de coke'), + ('meth', 'Meth'), + ('meth_pooch', 'Pochon de meth') +; \ No newline at end of file diff --git a/server/esx_drugs_sv.lua b/server/esx_drugs_sv.lua new file mode 100644 index 00000000..87cbff66 --- /dev/null +++ b/server/esx_drugs_sv.lua @@ -0,0 +1,561 @@ +ESX = nil +local CopsConnected = 0 +local PlayersHarvestingCoke = {} +local PlayersTransformingCoke = {} +local PlayersSellingCoke = {} +local PlayersHarvestingMeth = {} +local PlayersTransformingMeth = {} +local PlayersSellingMeth = {} +local PlayersHarvestingWeed = {} +local PlayersTransformingWeed = {} +local PlayersSellingWeed = {} + +TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) + +function CountCops() + + local xPlayers = ESX.GetPlayers() + + CopsConnected = 0 + + for k,v in pairs(xPlayers) do + if v.job.name == 'police' then + CopsConnected = CopsConnected + 1 + end + end + + SetTimeout(5000, CountCops) + +end + +CountCops() + +local function HarvestCoke(source) + + if CopsConnected < Config.RequiredCopsCoke then + TriggerClientEvent('esx:showNotification', source, 'Action ~r~impossible~s~, ~b~policiers~s~: ' .. CopsConnected .. '/' .. Config.RequiredCopsCoke) + return + end + + SetTimeout(5000, function() + + if PlayersHarvestingCoke[source] == true then + + local xPlayer = ESX.GetPlayerFromId(source) + + local coke = xPlayer.getInventoryItem('coke') + + if coke.limit ~= -1 and coke.count >= coke.limit then + TriggerClientEvent('esx:showNotification', source, 'Vous ne pouvez plus ramasser de Cocaine, votre inventaire est ~r~plein~s~') + else + xPlayer.addInventoryItem('coke', 1) + HarvestCoke(source) + end + + end + end) +end + +RegisterServerEvent('esx_drugs:startHarvestCoke') +AddEventHandler('esx_drugs:startHarvestCoke', function() + + local _source = source + + PlayersHarvestingCoke[_source] = true + + TriggerClientEvent('esx:showNotification', _source, '~y~Ramassage en cours~s~...') + + HarvestCoke(source) + +end) + +RegisterServerEvent('esx_drugs:stopHarvestCoke') +AddEventHandler('esx_drugs:stopHarvestCoke', function() + + local _source = source + + PlayersHarvestingCoke[_source] = false + +end) + +local function TransformCoke(source) + + if CopsConnected < Config.RequiredCopsCoke then + TriggerClientEvent('esx:showNotification', source, 'Action ~r~impossible~s~, ~b~policiers~s~: ' .. CopsConnected .. '/' .. Config.RequiredCopsCoke) + return + end + + SetTimeout(10000, function() + + if PlayersTransformingCoke[source] == true then + + local xPlayer = ESX.GetPlayerFromId(source) + + local cokeQuantity = xPlayer.getInventoryItem('coke').count + local poochQuantity = xPlayer.getInventoryItem('coke_pooch').count + + if poochQuantity > 35 then + TriggerClientEvent('esx:showNotification', source, 'Vous avez trop de pochons') + elseif cokeQuantity < 5 then + TriggerClientEvent('esx:showNotification', source, 'Vous n\'avez pas assez de feuille de coca à ~r~conditionner~s~') + else + xPlayer.removeInventoryItem('coke', 5) + xPlayer.addInventoryItem('coke_pooch', 1) + + TransformCoke(source) + end + + end + end) +end + +RegisterServerEvent('esx_drugs:startTransformCoke') +AddEventHandler('esx_drugs:startTransformCoke', function() + + local _source = source + + PlayersTransformingCoke[_source] = true + + TriggerClientEvent('esx:showNotification', _source, '~y~Conditonnement en cours~s~...') + + TransformCoke(source) + +end) + +RegisterServerEvent('esx_drugs:stopTransformCoke') +AddEventHandler('esx_drugs:stopTransformCoke', function() + + local _source = source + + PlayersTransformingCoke[_source] = false + +end) + +local function SellCoke(source) + + if CopsConnected < Config.RequiredCopsCoke then + TriggerClientEvent('esx:showNotification', source, 'Action ~r~impossible~s~, ~b~policiers~s~: ' .. CopsConnected .. '/' .. Config.RequiredCopsCoke) + return + end + + SetTimeout(7500, function() + + if PlayersSellingCoke[source] == true then + + local xPlayer = ESX.GetPlayerFromId(source) + + local poochQuantity = xPlayer.getInventoryItem('coke_pooch').count + + if poochQuantity == 0 then + TriggerClientEvent('esx:showNotification', source, 'Vous n\'avez plus de pochons à ~r~vendre~s~') + else + xPlayer.removeInventoryItem('coke_pooch', 1) + if CopsConnected == 0 then + xPlayer.addAccountMoney('black_money', 198) + TriggerClientEvent('esx:showNotification', source, 'Vous avez vendu ~g~x1 Pochon de coke~s~') + elseif CopsConnected == 1 then + xPlayer.addAccountMoney('black_money', 258) + TriggerClientEvent('esx:showNotification', source, 'Vous avez vendu ~g~x1 Pochon de coke~s~') + elseif CopsConnected == 2 then + xPlayer.addAccountMoney('black_money', 308) + TriggerClientEvent('esx:showNotification', source, 'Vous avez vendu ~g~x1 Pochon de coke~s~') + elseif CopsConnected == 3 then + xPlayer.addAccountMoney('black_money', 358) + TriggerClientEvent('esx:showNotification', source, 'Vous avez vendu ~g~x1 Pochon de coke~s~') + elseif CopsConnected == 4 then + xPlayer.addAccountMoney('black_money', 396) + TriggerClientEvent('esx:showNotification', source, 'Vous avez vendu ~g~x1 Pochon de coke~s~') + elseif CopsConnected >= 5 then + xPlayer.addAccountMoney('black_money', 428) + TriggerClientEvent('esx:showNotification', source, 'Vous avez vendu ~g~x1 Pochon de coke~s~') + end + + SellCoke(source) + end + + end + end) +end + +RegisterServerEvent('esx_drugs:startSellCoke') +AddEventHandler('esx_drugs:startSellCoke', function() + + local _source = source + + PlayersSellingCoke[_source] = true + + TriggerClientEvent('esx:showNotification', _source, '~g~Vente en cours~s~...') + + SellCoke(source) + +end) + +RegisterServerEvent('esx_drugs:stopSellCoke') +AddEventHandler('esx_drugs:stopSellCoke', function() + + local _source = source + + PlayersSellingCoke[_source] = false + +end) + +local function HarvestMeth(source) + + if CopsConnected < Config.RequiredCopsMeth then + TriggerClientEvent('esx:showNotification', source, 'Action ~r~impossible~s~, ~b~policiers~s~: ' .. CopsConnected .. '/' .. Config.RequiredCopsMeth) + return + end + + SetTimeout(5000, function() + + if PlayersHarvestingMeth[source] == true then + + local xPlayer = ESX.GetPlayerFromId(source) + + local meth = xPlayer.getInventoryItem('meth') + + if meth.limit ~= -1 and meth.count >= meth.limit then + TriggerClientEvent('esx:showNotification', source, 'Vous ne pouvez plus ramasser de Meth, votre inventaire est ~r~plein~s~') + else + xPlayer.addInventoryItem('meth', 1) + HarvestMeth(source) + end + + end + end) +end + +RegisterServerEvent('esx_drugs:startHarvestMeth') +AddEventHandler('esx_drugs:startHarvestMeth', function() + + local _source = source + + PlayersHarvestingMeth[_source] = true + + TriggerClientEvent('esx:showNotification', _source, '~y~Ramassage en cours~s~...') + + HarvestMeth(source) + +end) + +RegisterServerEvent('esx_drugs:stopHarvestMeth') +AddEventHandler('esx_drugs:stopHarvestMeth', function() + + local _source = source + + PlayersHarvestingMeth[_source] = false + +end) + +local function TransformMeth(source) + + if CopsConnected < Config.RequiredCopsMeth then + TriggerClientEvent('esx:showNotification', source, 'Action ~r~impossible~s~, ~b~policiers~s~: ' .. CopsConnected .. '/' .. Config.RequiredCopsMeth) + return + end + + SetTimeout(12000, function() + + if PlayersTransformingMeth[source] == true then + + local xPlayer = ESX.GetPlayerFromId(source) + + local methQuantity = xPlayer.getInventoryItem('meth').count + local pochonQuantity = xPlayer.getInventoryItem('meth_pooch').count + + if pochonQuantity > 35 then + TriggerClientEvent('esx:showNotification', source, 'Vous avez trop de pochons') + elseif methQuantity < 5 then + TriggerClientEvent('esx:showNotification', source, 'Vous n\'avez pas assez de Meth à ~r~conditionner~s~') + else + xPlayer.removeInventoryItem('meth', 5) + xPlayer.addInventoryItem('meth_pochon', 1) + + TransformMeth(source) + end + + end + end) +end + +RegisterServerEvent('esx_drugs:startTransformMeth') +AddEventHandler('esx_drugs:startTransformMeth', function() + + local _source = source + + PlayersTransformingMeth[_source] = true + + TriggerClientEvent('esx:showNotification', _source, '~y~Conditonnement en cours~s~...') + + TransformMeth(source) + +end) + +RegisterServerEvent('esx_drugs:stopTransformMeth') +AddEventHandler('esx_drugs:stopTransformMeth', function() + + local _source = source + + PlayersTransformingMeth[_source] = false + +end) + +local function SellMeth(source) + + if CopsConnected < Config.RequiredCopsMeth then + TriggerClientEvent('esx:showNotification', source, 'Action ~r~impossible~s~, ~b~policiers~s~: ' .. CopsConnected .. '/' .. Config.RequiredCopsMeth) + return + end + + SetTimeout(7500, function() + + if PlayersSellingMeth[source] == true then + + local xPlayer = ESX.GetPlayerFromId(source) + + local pochonQuantity = xPlayer.getInventoryItem('meth_pooch').count + + if pochonQuantity == 0 then + TriggerClientEvent('esx:showNotification', source, 'Vous n\'avez plus de pochons à ~r~vendre~s~') + else + xPlayer.removeInventoryItem('meth_pochon', 1) + if CopsConnected == 0 then + xPlayer.addAccountMoney('black_money', 276) + TriggerClientEvent('esx:showNotification', source, 'Vous avez vendu ~g~x1 Pochon de meth~s~') + elseif CopsConnected == 1 then + xPlayer.addAccountMoney('black_money', 374) + TriggerClientEvent('esx:showNotification', source, 'Vous avez vendu ~g~x1 Pochon de meth~s~') + elseif CopsConnected == 2 then + xPlayer.addAccountMoney('black_money', 474) + TriggerClientEvent('esx:showNotification', source, 'Vous avez vendu ~g~x1 Pochon de meth~s~') + elseif CopsConnected == 3 then + xPlayer.addAccountMoney('black_money', 552) + TriggerClientEvent('esx:showNotification', source, 'Vous avez vendu ~g~x1 Pochon de meth~s~') + elseif CopsConnected == 4 then + xPlayer.addAccountMoney('black_money', 616) + TriggerClientEvent('esx:showNotification', source, 'Vous avez vendu ~g~x1 Pochon de meth~s~') + elseif CopsConnected == 5 then + xPlayer.addAccountMoney('black_money', 654) + TriggerClientEvent('esx:showNotification', source, 'Vous avez vendu ~g~x1 Pochon de meth~s~') + elseif CopsConnected >= 6 then + xPlayer.addAccountMoney('black_money', 686) + TriggerClientEvent('esx:showNotification', source, 'Vous avez vendu ~g~x1 Pochon de meth~s~') + end + + SellMeth(source) + end + + end + end) +end + +RegisterServerEvent('esx_drugs:startSellMeth') +AddEventHandler('esx_drugs:startSellMeth', function() + + local _source = source + + PlayersSellingMeth[_source] = true + + TriggerClientEvent('esx:showNotification', _source, '~g~Vente en cours~s~...') + + SellMeth(source) + +end) + +RegisterServerEvent('esx_drugs:stopSellMeth') +AddEventHandler('esx_drugs:stopSellMeth', function() + + local _source = source + + PlayersSellingMeth[_source] = false + +end) + +local function HarvestWeed(source) + + if CopsConnected < Config.RequiredCopsWeed then + TriggerClientEvent('esx:showNotification', source, 'Action ~r~impossible~s~, ~b~policiers~s~: ' .. CopsConnected .. '/' .. Config.RequiredCopsWeed) + return + end + + SetTimeout(5000, function() + + if PlayersHarvestingWeed[source] == true then + + local xPlayer = ESX.GetPlayerFromId(source) + + local weed = xPlayer.getInventoryItem('weed') + + if weed.limit ~= -1 and weed.count >= weed.limit then + TriggerClientEvent('esx:showNotification', source, 'Vous ne pouvez plus ramasser de weed, votre inventaire est ~r~plein~s~') + else + xPlayer.addInventoryItem('weed', 1) + HarvestWeed(source) + end + + end + end) +end + +RegisterServerEvent('esx_drugs:startHarvestWeed') +AddEventHandler('esx_drugs:startHarvestWeed', function() + + local _source = source + + PlayersHarvestingWeed[_source] = true + + TriggerClientEvent('esx:showNotification', _source, '~y~Ramassage en cours~s~...') + + HarvestWeed(source) + +end) + +RegisterServerEvent('esx_drugs:stopHarvestWeed') +AddEventHandler('esx_drugs:stopHarvestWeed', function() + + local _source = source + + PlayersHarvestingWeed[_source] = false + +end) + +local function TransformWeed(source) + + if CopsConnected < Config.RequiredCopsWeed then + TriggerClientEvent('esx:showNotification', source, 'Action ~r~impossible~s~, ~b~policiers~s~: ' .. CopsConnected .. '/' .. Config.RequiredCopsWeed) + return + end + + SetTimeout(7500, function() + + if PlayersTransformingWeed[source] == true then + + local xPlayer = ESX.GetPlayerFromId(source) + + local weedQuantity = xPlayer.getInventoryItem('weed').count + local poochQuantity = xPlayer.getInventoryItem('weed_pooch').count + + if poochQuantity > 35 then + TriggerClientEvent('esx:showNotification', source, 'Vous avez trop de pochons') + elseif weedQuantity < 5 then + TriggerClientEvent('esx:showNotification', source, 'Vous n\'avez pas assez de weed à ~r~conditionner~s~') + else + xPlayer.removeInventoryItem('weed', 5) + xPlayer.addInventoryItem('weed_pooch', 1) + + TransformWeed(source) + end + + end + end) +end + +RegisterServerEvent('esx_drugs:startTransformWeed') +AddEventHandler('esx_drugs:startTransformWeed', function() + + local _source = source + + PlayersTransformingWeed[_source] = true + + TriggerClientEvent('esx:showNotification', _source, '~y~Conditonnement en cours~s~...') + + TransformWeed(source) + +end) + +RegisterServerEvent('esx_drugs:stopTransformWeed') +AddEventHandler('esx_drugs:stopTransformWeed', function() + + local _source = source + + PlayersTransformingWeed[_source] = false + +end) + +local function SellWeed(source) + + if CopsConnected < Config.RequiredCopsWeed then + TriggerClientEvent('esx_weedjob:showNotification', source, 'Action ~r~impossible~s~, ~b~policiers~s~: ' .. CopsConnected .. '/' .. Config.RequiredCopsWeed) + return + end + + SetTimeout(7500, function() + + if PlayersSellingWeed[source] == true then + + local xPlayer = ESX.GetPlayerFromId(source) + + local poochQuantity = xPlayer.getInventoryItem('weed_pooch').count + + if poochQuantity == 0 then + TriggerClientEvent('esx:showNotification', source, 'Vous n\'avez plus de pochons à ~r~vendre~s~') + else + xPlayer:removeInventoryItem('weed_pooch', 1) + if CopsConnected == 0 then + xPlayer.addAccountMoney('black_money', 108) + TriggerClientEvent('esx:showNotification', source, 'Vous avez vendu ~g~x1 Pochon de weed~s~') + elseif CopsConnected == 1 then + xPlayer.addAccountMoney('black_money', 128) + TriggerClientEvent('esx:showNotification', source, 'Vous avez vendu ~g~x1 Pochon de weed~s~') + elseif CopsConnected == 2 then + xPlayer.addAccountMoney('black_money', 152) + TriggerClientEvent('esx:showNotification', source, 'Vous avez vendu ~g~x1 Pochon de weed~s~') + elseif CopsConnected == 3 then + xPlayer.addAccountMoney('black_money', 165) + TriggerClientEvent('esx:showNotification', source, 'Vous avez vendu ~g~x1 Pochon de weed~s~') + elseif CopsConnected >= 4 then + xPlayer.addAccountMoney('black_money', 180) + TriggerClientEvent('esx:showNotification', source, 'Vous avez vendu ~g~x1 Pochon de weed~s~') + end + + SellWeed(source) + end + + end + end) +end + +RegisterServerEvent('esx_drugs:startSellWeed') +AddEventHandler('esx_drugs:startSellWeed', function() + + local _source = source + + PlayersSellingWeed[_source] = true + + TriggerClientEvent('esx:showNotification', _source, '~g~Vente en cours~s~...') + + SellWeed(source) + +end) + +RegisterServerEvent('esx_drugs:stopSellWeed') +AddEventHandler('esx_drugs:stopSellWeed', function() + + local _source = source + + PlayersSellingWeed[_source] = false + +end) + +-- RETURN INVENTORY TO CLIENT +RegisterServerEvent('esx_drugs:GetUserInventory') +AddEventHandler('esx_drugs:GetUserInventory', function(currentZone) + local _source = source + local xPlayer = ESX.GetPlayerFromId(_source) + TriggerClientEvent('esx_drugs:ReturnInventory', _source, xPlayer.getInventoryItem('coke').count, xPlayer.getInventoryItem('coke_pooch').count, + xPlayer.getInventoryItem('meth').count, xPlayer.getInventoryItem('meth_pooch').count, + xPlayer.getInventoryItem('weed').count, xPlayer.getInventoryItem('weed_pooch').count, xPlayer.job.name, currentZone) +end) + +-- Register Usable Item +ESX.RegisterUsableItem('weed', function(source) + + local _source = source + local xPlayer = ESX.GetPlayerFromId(source) + + xPlayer.removeInventoryItem('weed', 1) + + TriggerClientEvent('esx_drugs:onPot', _source) + TriggerClientEvent('esx:showNotification', _source, 'Vous avez utilisé 1 de ~b~Weed') + +end) \ No newline at end of file From 45eed078250af116ad952ebea145a4dc4f3d69bb Mon Sep 17 00:00:00 2001 From: ig0ne Date: Fri, 11 Aug 2017 04:18:17 +0200 Subject: [PATCH 04/66] Debug drugs zone Debug for meth and weed zone treatment, selling --- client/esx_drugs_cl.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/client/esx_drugs_cl.lua b/client/esx_drugs_cl.lua index cfe2f4c7..9d935c73 100644 --- a/client/esx_drugs_cl.lua +++ b/client/esx_drugs_cl.lua @@ -77,7 +77,7 @@ AddEventHandler('esx_drugs:hasEnteredMarker', function(zone) if zone == 'MethTreatment' then if myJob ~= "police" then - if cokeQTE >= 5 then + if methQTE >= 5 then CurrentAction = 'meth_treatment' CurrentActionMsg = 'Appuez sur ~INPUT_CONTEXT~ pour traiter la meth' CurrentActionData = {} @@ -87,7 +87,7 @@ AddEventHandler('esx_drugs:hasEnteredMarker', function(zone) if zone == 'MethResell' then if myJob ~= "police" then - if coke_poochQTE >= 1 then + if meth_poochQTE >= 1 then CurrentAction = 'meth_resell' CurrentActionMsg = 'Appuez sur ~INPUT_CONTEXT~ pour vendre la meth' CurrentActionData = {} @@ -105,7 +105,7 @@ AddEventHandler('esx_drugs:hasEnteredMarker', function(zone) if zone == 'WeedTreatment' then if myJob ~= "police" then - if cokeQTE >= 5 then + if weedQTE >= 5 then CurrentAction = 'weed_treatment' CurrentActionMsg = 'Appuez sur ~INPUT_CONTEXT~ pour traiter la weed' CurrentActionData = {} @@ -115,7 +115,7 @@ AddEventHandler('esx_drugs:hasEnteredMarker', function(zone) if zone == 'WeedResell' then if myJob ~= "police" then - if coke_poochQTE >= 1 then + if weed_poochQTE >= 1 then CurrentAction = 'weed_resell' CurrentActionMsg = 'Appuez sur ~INPUT_CONTEXT~ pour vendre la weed' CurrentActionData = {} From 8103335ece3260971204b11e4aefb9a750ac9ed6 Mon Sep 17 00:00:00 2001 From: ig0ne Date: Fri, 11 Aug 2017 05:35:50 +0200 Subject: [PATCH 05/66] fix variable Declared a missing variable --- client/esx_drugs_cl.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/client/esx_drugs_cl.lua b/client/esx_drugs_cl.lua index 9d935c73..8a47bf97 100644 --- a/client/esx_drugs_cl.lua +++ b/client/esx_drugs_cl.lua @@ -20,6 +20,7 @@ local weedQTE = 0 local weed_poochQTE = 0 local methQTE = 0 local meth_poochQTE = 0 +local myJob = nil local PlayerData = {} local GUI = {} local HasAlreadyEnteredMarker = false From d055789eb24e038b28cdfe68cc0a27b13e410ce2 Mon Sep 17 00:00:00 2001 From: AdrineX Date: Sun, 13 Aug 2017 06:15:48 +0300 Subject: [PATCH 06/66] weed treatment fix --- client/esx_drugs_cl.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/esx_drugs_cl.lua b/client/esx_drugs_cl.lua index 8a47bf97..1eafc49f 100644 --- a/client/esx_drugs_cl.lua +++ b/client/esx_drugs_cl.lua @@ -260,7 +260,7 @@ Citizen.CreateThread(function() if CurrentAction == 'weed_harvest' then TriggerServerEvent('esx_drugs:startHarvestWeed') end - if CurrentAction == 'wedd_treatment' then + if CurrentAction == 'weed_treatment' then TriggerServerEvent('esx_drugs:startTransformWeed') end if CurrentAction == 'weed_resell' then From 917da362b85eeb7918ebde2ac9dff302221d3512 Mon Sep 17 00:00:00 2001 From: nearbyplayer Date: Tue, 15 Aug 2017 19:28:06 -0400 Subject: [PATCH 07/66] Multi-language support --- __resource.lua | 22 +++++++-- client/esx_drugs_cl.lua | 18 ++++---- config.lua | 1 + locales/en.lua | 29 ++++++++++++ locales/fr.lua | 29 ++++++++++++ server/esx_drugs_sv.lua | 98 ++++++++++++++++++++--------------------- 6 files changed, 135 insertions(+), 62 deletions(-) create mode 100644 locales/en.lua create mode 100644 locales/fr.lua diff --git a/__resource.lua b/__resource.lua index 12628236..47bf7078 100644 --- a/__resource.lua +++ b/__resource.lua @@ -1,7 +1,21 @@ description 'esx_drugs' -server_script 'server/esx_drugs_sv.lua' -server_script 'config.lua' +server_scripts { -client_script 'config.lua' -client_script 'client/esx_drugs_cl.lua' \ No newline at end of file + '@es_extended/locale.lua', + 'locales/en.lua', + 'locales/fr.lua', + 'server/esx_drugs_sv.lua', + 'config.lua' + +} + +client_scripts { + + '@es_extended/locale.lua', + 'locales/en.lua', + 'locales/fr.lua', + 'config.lua', + 'client/esx_drugs_cl.lua' + +} \ No newline at end of file diff --git a/client/esx_drugs_cl.lua b/client/esx_drugs_cl.lua index 1eafc49f..001da77a 100644 --- a/client/esx_drugs_cl.lua +++ b/client/esx_drugs_cl.lua @@ -43,7 +43,7 @@ AddEventHandler('esx_drugs:hasEnteredMarker', function(zone) if zone == 'CokeFarm' then if myJob ~= "police" then CurrentAction = 'coke_harvest' - CurrentActionMsg = 'Appuez sur ~INPUT_CONTEXT~ pour récolter la coke' + CurrentActionMsg = _U('press_collect_coke') CurrentActionData = {} end end @@ -52,7 +52,7 @@ AddEventHandler('esx_drugs:hasEnteredMarker', function(zone) if myJob ~= "police" then if cokeQTE >= 5 then CurrentAction = 'coke_treatment' - CurrentActionMsg = 'Appuez sur ~INPUT_CONTEXT~ pour traiter la coke' + CurrentActionMsg = _U('press_process_coke') CurrentActionData = {} end end @@ -62,7 +62,7 @@ AddEventHandler('esx_drugs:hasEnteredMarker', function(zone) if myJob ~= "police" then if coke_poochQTE >= 1 then CurrentAction = 'coke_resell' - CurrentActionMsg = 'Appuez sur ~INPUT_CONTEXT~ pour vendre la coke' + CurrentActionMsg = _U('press_sell_coke') CurrentActionData = {} end end @@ -71,7 +71,7 @@ AddEventHandler('esx_drugs:hasEnteredMarker', function(zone) if zone == 'MethFarm' then if myJob ~= "police" then CurrentAction = 'meth_harvest' - CurrentActionMsg = 'Appuez sur ~INPUT_CONTEXT~ pour récolter la meth' + CurrentActionMsg = _U('press_collect_meth') CurrentActionData = {} end end @@ -80,7 +80,7 @@ AddEventHandler('esx_drugs:hasEnteredMarker', function(zone) if myJob ~= "police" then if methQTE >= 5 then CurrentAction = 'meth_treatment' - CurrentActionMsg = 'Appuez sur ~INPUT_CONTEXT~ pour traiter la meth' + CurrentActionMsg = _U('press_process_meth') CurrentActionData = {} end end @@ -90,7 +90,7 @@ AddEventHandler('esx_drugs:hasEnteredMarker', function(zone) if myJob ~= "police" then if meth_poochQTE >= 1 then CurrentAction = 'meth_resell' - CurrentActionMsg = 'Appuez sur ~INPUT_CONTEXT~ pour vendre la meth' + CurrentActionMsg = _U('press_sell_meth') CurrentActionData = {} end end @@ -99,7 +99,7 @@ AddEventHandler('esx_drugs:hasEnteredMarker', function(zone) if zone == 'WeedFarm' then if myJob ~= "police" then CurrentAction = 'weed_harvest' - CurrentActionMsg = 'Appuez sur ~INPUT_CONTEXT~ pour récolter la weed' + CurrentActionMsg = _U('press_collect_weed') CurrentActionData = {} end end @@ -108,7 +108,7 @@ AddEventHandler('esx_drugs:hasEnteredMarker', function(zone) if myJob ~= "police" then if weedQTE >= 5 then CurrentAction = 'weed_treatment' - CurrentActionMsg = 'Appuez sur ~INPUT_CONTEXT~ pour traiter la weed' + CurrentActionMsg = _U('press_process_weed') CurrentActionData = {} end end @@ -118,7 +118,7 @@ AddEventHandler('esx_drugs:hasEnteredMarker', function(zone) if myJob ~= "police" then if weed_poochQTE >= 1 then CurrentAction = 'weed_resell' - CurrentActionMsg = 'Appuez sur ~INPUT_CONTEXT~ pour vendre la weed' + CurrentActionMsg = _U('press_sell_weed') CurrentActionData = {} end end diff --git a/config.lua b/config.lua index 6699d8ca..f277af23 100644 --- a/config.lua +++ b/config.lua @@ -6,6 +6,7 @@ Config.ZoneSize = {x = 5.0, y = 5.0, z = 3.0} Config.RequiredCopsCoke = 2 Config.RequiredCopsMeth = 2 Config.RequiredCopsWeed = 0 +Config.Locale = 'fr' Config.Zones = { CokeFarm = {x=2448.9228515625, y=-1836.8076171875, z=51.953701019287}, diff --git a/locales/en.lua b/locales/en.lua new file mode 100644 index 00000000..a3013aaa --- /dev/null +++ b/locales/en.lua @@ -0,0 +1,29 @@ +Locales['en'] = { + + ['press_collect_coke'] = 'press ~INPUT_CONTEXT~ to collect coke', + ['press_process_coke'] = 'press ~INPUT_CONTEXT~ to process coke', + ['press_sell_coke'] = 'press ~INPUT_CONTEXT~ to sell coke', + ['press_collect_meth'] = 'press ~INPUT_CONTEXT~ to collect meth', + ['press_process_meth'] = 'press ~INPUT_CONTEXT~ to process meth', + ['press_sell_meth'] = 'press ~INPUT_CONTEXT~ to sell meth', + ['press_collect_weed'] = 'press ~INPUT_CONTEXT~ to collect weed', + ['press_process_weed'] = 'press ~INPUT_CONTEXT~ to process weed', + ['press_sell_weed'] = 'press ~INPUT_CONTEXT~ to sell weed', + ['act_imp_police'] = 'action ~r~impossible~s~, ~b~police~s~: ', + ['inv_full_coke'] = 'you can no longer collect Cocaine, your inventory is ~r~full~s~', + ['pickup_in_prog'] = '~y~Pickup in progress~s~...', + ['too_many_pouches'] = 'you have too many pouches', + ['not_enough_coke'] = 'you do not have enough coca leaf to ~r~pack~s~', + ['packing_in_prog'] = '~y~Packaging in progress~s~...', + ['no_pouchs_sale'] = 'You have no more pouches for ~r~sale~s~', + ['sold_one_coke'] = 'you\'ve sold ~g~x1 Coke Pouch~s~', + ['sale_in_prog'] = '~g~Sale in progress~s~...', + ['inv_full_meth'] = 'you can no longer collect Meth, your inventory is ~r~full~s~', + ['not_enough_meth'] = 'you do not have enough Meth to ~r~pack~s~', + ['sold_one_meth'] = 'you\'ve sold ~g~x1 Meth Pouch~s~', + ['inv_full_weed'] = 'you can no longer collect Weed, your inventory is ~r~full~s~', + ['not_enough_weed'] = 'you do not have enough Weed to ~r~pack~s~', + ['sold_one_weed'] = 'you\'ve sold ~g~x1 Weed Pouch~s~', + ['used_one_weed'] = 'you used 1 pouch of ~b~weed', + +} \ No newline at end of file diff --git a/locales/fr.lua b/locales/fr.lua new file mode 100644 index 00000000..e182eb55 --- /dev/null +++ b/locales/fr.lua @@ -0,0 +1,29 @@ +Locales['fr'] = { + + ['press_collect_coke'] = 'appuyez sur ~INPUT_CONTEXT~ pour récolter la coke', + ['press_process_coke'] = 'appuyez sur ~INPUT_CONTEXT~ pour traiter la coke', + ['press_sell_coke'] = 'appuyez sur ~INPUT_CONTEXT~ pour vendre la coke', + ['press_collect_meth'] = 'appuyez sur ~INPUT_CONTEXT~ pour récolter la meth', + ['press_process_meth'] = 'appuyez sur ~INPUT_CONTEXT~ pour traiter la meth', + ['press_sell_meth'] = 'appuyez sur ~INPUT_CONTEXT~ pour vendre la meth', + ['press_collect_weed'] = 'appuyez sur ~INPUT_CONTEXT~ pour récolter la weed', + ['press_process_weed'] = 'appuyez sur ~INPUT_CONTEXT~ pour traiter la weed', + ['press_sell_weed'] = 'appuyez sur ~INPUT_CONTEXT~ pour vendre la weed', + ['act_imp_police'] = 'action ~r~impossible~s~, ~b~policiers~s~: ', + ['inv_full_coke'] = 'vous ne pouvez plus ramasser de Cocaine, votre inventaire est ~r~plein~s~', + ['pickup_in_prog'] = '~y~Ramassage en cours~s~...', + ['too_many_pouches'] = 'vous avez trop de pochons', + ['not_enough_coke'] = 'vous n\'avez pas assez de feuille de coca à ~r~conditionner~s~', + ['packing_in_prog'] = '~y~Conditonnement en cours~s~...', + ['no_pouches_sale'] = 'vous n\'avez plus de pochons à ~r~vendre~s~', + ['sold_one_coke'] = 'vous avez vendu ~g~x1 Pochon de coke~s~', + ['sale_in_prog'] = '~g~Vente en cours~s~...', + ['inv_full_meth'] = 'vous ne pouvez plus ramasser de Meth, votre inventaire est ~r~plein~s~', + ['not_enough_meth'] = 'vous n\'avez pas assez de Meth à ~r~conditionner~s~', + ['sold_one_meth'] = 'vous avez vendu ~g~x1 Pochon de meth~s~', + ['inv_full_weed'] = 'vous ne pouvez plus ramasser de weed, votre inventair est ~r~plein~s~', + ['not_enough_weed'] = 'vous n\'avez pas assez de weed à ~r~conditionner~s~', + ['sold_one_weed'] = 'vous avez vendu ~g~x1 Pochon de weed~s~', + ['used_one_weed'] = 'Vous avez utilisé 1 Pochon de ~b~weed', + +} \ No newline at end of file diff --git a/server/esx_drugs_sv.lua b/server/esx_drugs_sv.lua index 87cbff66..867a0bc5 100644 --- a/server/esx_drugs_sv.lua +++ b/server/esx_drugs_sv.lua @@ -33,7 +33,7 @@ CountCops() local function HarvestCoke(source) if CopsConnected < Config.RequiredCopsCoke then - TriggerClientEvent('esx:showNotification', source, 'Action ~r~impossible~s~, ~b~policiers~s~: ' .. CopsConnected .. '/' .. Config.RequiredCopsCoke) + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsCoke) return end @@ -46,7 +46,7 @@ local function HarvestCoke(source) local coke = xPlayer.getInventoryItem('coke') if coke.limit ~= -1 and coke.count >= coke.limit then - TriggerClientEvent('esx:showNotification', source, 'Vous ne pouvez plus ramasser de Cocaine, votre inventaire est ~r~plein~s~') + TriggerClientEvent('esx:showNotification', source, _U('inv_full_coke')) else xPlayer.addInventoryItem('coke', 1) HarvestCoke(source) @@ -63,7 +63,7 @@ AddEventHandler('esx_drugs:startHarvestCoke', function() PlayersHarvestingCoke[_source] = true - TriggerClientEvent('esx:showNotification', _source, '~y~Ramassage en cours~s~...') + TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog')) HarvestCoke(source) @@ -81,7 +81,7 @@ end) local function TransformCoke(source) if CopsConnected < Config.RequiredCopsCoke then - TriggerClientEvent('esx:showNotification', source, 'Action ~r~impossible~s~, ~b~policiers~s~: ' .. CopsConnected .. '/' .. Config.RequiredCopsCoke) + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsCoke) return end @@ -95,9 +95,9 @@ local function TransformCoke(source) local poochQuantity = xPlayer.getInventoryItem('coke_pooch').count if poochQuantity > 35 then - TriggerClientEvent('esx:showNotification', source, 'Vous avez trop de pochons') + TriggerClientEvent('esx:showNotification', source, _U('too_many_pouches')) elseif cokeQuantity < 5 then - TriggerClientEvent('esx:showNotification', source, 'Vous n\'avez pas assez de feuille de coca à ~r~conditionner~s~') + TriggerClientEvent('esx:showNotification', source, _U('not_enough_coke')) else xPlayer.removeInventoryItem('coke', 5) xPlayer.addInventoryItem('coke_pooch', 1) @@ -116,7 +116,7 @@ AddEventHandler('esx_drugs:startTransformCoke', function() PlayersTransformingCoke[_source] = true - TriggerClientEvent('esx:showNotification', _source, '~y~Conditonnement en cours~s~...') + TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog')) TransformCoke(source) @@ -134,7 +134,7 @@ end) local function SellCoke(source) if CopsConnected < Config.RequiredCopsCoke then - TriggerClientEvent('esx:showNotification', source, 'Action ~r~impossible~s~, ~b~policiers~s~: ' .. CopsConnected .. '/' .. Config.RequiredCopsCoke) + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsCoke) return end @@ -147,27 +147,27 @@ local function SellCoke(source) local poochQuantity = xPlayer.getInventoryItem('coke_pooch').count if poochQuantity == 0 then - TriggerClientEvent('esx:showNotification', source, 'Vous n\'avez plus de pochons à ~r~vendre~s~') + TriggerClientEvent('esx:showNotification', source, _U('no_pouches_sale')) else xPlayer.removeInventoryItem('coke_pooch', 1) if CopsConnected == 0 then xPlayer.addAccountMoney('black_money', 198) - TriggerClientEvent('esx:showNotification', source, 'Vous avez vendu ~g~x1 Pochon de coke~s~') + TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) elseif CopsConnected == 1 then xPlayer.addAccountMoney('black_money', 258) - TriggerClientEvent('esx:showNotification', source, 'Vous avez vendu ~g~x1 Pochon de coke~s~') + TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) elseif CopsConnected == 2 then xPlayer.addAccountMoney('black_money', 308) - TriggerClientEvent('esx:showNotification', source, 'Vous avez vendu ~g~x1 Pochon de coke~s~') + TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) elseif CopsConnected == 3 then xPlayer.addAccountMoney('black_money', 358) - TriggerClientEvent('esx:showNotification', source, 'Vous avez vendu ~g~x1 Pochon de coke~s~') + TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) elseif CopsConnected == 4 then xPlayer.addAccountMoney('black_money', 396) - TriggerClientEvent('esx:showNotification', source, 'Vous avez vendu ~g~x1 Pochon de coke~s~') + TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) elseif CopsConnected >= 5 then xPlayer.addAccountMoney('black_money', 428) - TriggerClientEvent('esx:showNotification', source, 'Vous avez vendu ~g~x1 Pochon de coke~s~') + TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) end SellCoke(source) @@ -184,7 +184,7 @@ AddEventHandler('esx_drugs:startSellCoke', function() PlayersSellingCoke[_source] = true - TriggerClientEvent('esx:showNotification', _source, '~g~Vente en cours~s~...') + TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog')) SellCoke(source) @@ -202,7 +202,7 @@ end) local function HarvestMeth(source) if CopsConnected < Config.RequiredCopsMeth then - TriggerClientEvent('esx:showNotification', source, 'Action ~r~impossible~s~, ~b~policiers~s~: ' .. CopsConnected .. '/' .. Config.RequiredCopsMeth) + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsMeth) return end @@ -215,7 +215,7 @@ local function HarvestMeth(source) local meth = xPlayer.getInventoryItem('meth') if meth.limit ~= -1 and meth.count >= meth.limit then - TriggerClientEvent('esx:showNotification', source, 'Vous ne pouvez plus ramasser de Meth, votre inventaire est ~r~plein~s~') + TriggerClientEvent('esx:showNotification', source, _U('inv_full_meth')) else xPlayer.addInventoryItem('meth', 1) HarvestMeth(source) @@ -232,7 +232,7 @@ AddEventHandler('esx_drugs:startHarvestMeth', function() PlayersHarvestingMeth[_source] = true - TriggerClientEvent('esx:showNotification', _source, '~y~Ramassage en cours~s~...') + TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog')) HarvestMeth(source) @@ -250,7 +250,7 @@ end) local function TransformMeth(source) if CopsConnected < Config.RequiredCopsMeth then - TriggerClientEvent('esx:showNotification', source, 'Action ~r~impossible~s~, ~b~policiers~s~: ' .. CopsConnected .. '/' .. Config.RequiredCopsMeth) + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsMeth) return end @@ -264,9 +264,9 @@ local function TransformMeth(source) local pochonQuantity = xPlayer.getInventoryItem('meth_pooch').count if pochonQuantity > 35 then - TriggerClientEvent('esx:showNotification', source, 'Vous avez trop de pochons') + TriggerClientEvent('esx:showNotification', source, _U('too_many_pouches')) elseif methQuantity < 5 then - TriggerClientEvent('esx:showNotification', source, 'Vous n\'avez pas assez de Meth à ~r~conditionner~s~') + TriggerClientEvent('esx:showNotification', source, _U('not_enough_meth')) else xPlayer.removeInventoryItem('meth', 5) xPlayer.addInventoryItem('meth_pochon', 1) @@ -285,7 +285,7 @@ AddEventHandler('esx_drugs:startTransformMeth', function() PlayersTransformingMeth[_source] = true - TriggerClientEvent('esx:showNotification', _source, '~y~Conditonnement en cours~s~...') + TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog')) TransformMeth(source) @@ -303,7 +303,7 @@ end) local function SellMeth(source) if CopsConnected < Config.RequiredCopsMeth then - TriggerClientEvent('esx:showNotification', source, 'Action ~r~impossible~s~, ~b~policiers~s~: ' .. CopsConnected .. '/' .. Config.RequiredCopsMeth) + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsMeth) return end @@ -316,30 +316,30 @@ local function SellMeth(source) local pochonQuantity = xPlayer.getInventoryItem('meth_pooch').count if pochonQuantity == 0 then - TriggerClientEvent('esx:showNotification', source, 'Vous n\'avez plus de pochons à ~r~vendre~s~') + TriggerClientEvent('esx:showNotification', source, _U('no_pouches_sale')) else xPlayer.removeInventoryItem('meth_pochon', 1) if CopsConnected == 0 then xPlayer.addAccountMoney('black_money', 276) - TriggerClientEvent('esx:showNotification', source, 'Vous avez vendu ~g~x1 Pochon de meth~s~') + TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) elseif CopsConnected == 1 then xPlayer.addAccountMoney('black_money', 374) - TriggerClientEvent('esx:showNotification', source, 'Vous avez vendu ~g~x1 Pochon de meth~s~') + TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) elseif CopsConnected == 2 then xPlayer.addAccountMoney('black_money', 474) - TriggerClientEvent('esx:showNotification', source, 'Vous avez vendu ~g~x1 Pochon de meth~s~') + TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) elseif CopsConnected == 3 then xPlayer.addAccountMoney('black_money', 552) - TriggerClientEvent('esx:showNotification', source, 'Vous avez vendu ~g~x1 Pochon de meth~s~') + TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) elseif CopsConnected == 4 then xPlayer.addAccountMoney('black_money', 616) - TriggerClientEvent('esx:showNotification', source, 'Vous avez vendu ~g~x1 Pochon de meth~s~') + TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) elseif CopsConnected == 5 then xPlayer.addAccountMoney('black_money', 654) - TriggerClientEvent('esx:showNotification', source, 'Vous avez vendu ~g~x1 Pochon de meth~s~') + TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) elseif CopsConnected >= 6 then xPlayer.addAccountMoney('black_money', 686) - TriggerClientEvent('esx:showNotification', source, 'Vous avez vendu ~g~x1 Pochon de meth~s~') + TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) end SellMeth(source) @@ -356,7 +356,7 @@ AddEventHandler('esx_drugs:startSellMeth', function() PlayersSellingMeth[_source] = true - TriggerClientEvent('esx:showNotification', _source, '~g~Vente en cours~s~...') + TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog')) SellMeth(source) @@ -374,7 +374,7 @@ end) local function HarvestWeed(source) if CopsConnected < Config.RequiredCopsWeed then - TriggerClientEvent('esx:showNotification', source, 'Action ~r~impossible~s~, ~b~policiers~s~: ' .. CopsConnected .. '/' .. Config.RequiredCopsWeed) + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsWeed) return end @@ -387,7 +387,7 @@ local function HarvestWeed(source) local weed = xPlayer.getInventoryItem('weed') if weed.limit ~= -1 and weed.count >= weed.limit then - TriggerClientEvent('esx:showNotification', source, 'Vous ne pouvez plus ramasser de weed, votre inventaire est ~r~plein~s~') + TriggerClientEvent('esx:showNotification', source, _U('inv_full_weed')) else xPlayer.addInventoryItem('weed', 1) HarvestWeed(source) @@ -404,7 +404,7 @@ AddEventHandler('esx_drugs:startHarvestWeed', function() PlayersHarvestingWeed[_source] = true - TriggerClientEvent('esx:showNotification', _source, '~y~Ramassage en cours~s~...') + TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog')) HarvestWeed(source) @@ -422,7 +422,7 @@ end) local function TransformWeed(source) if CopsConnected < Config.RequiredCopsWeed then - TriggerClientEvent('esx:showNotification', source, 'Action ~r~impossible~s~, ~b~policiers~s~: ' .. CopsConnected .. '/' .. Config.RequiredCopsWeed) + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsWeed) return end @@ -436,9 +436,9 @@ local function TransformWeed(source) local poochQuantity = xPlayer.getInventoryItem('weed_pooch').count if poochQuantity > 35 then - TriggerClientEvent('esx:showNotification', source, 'Vous avez trop de pochons') + TriggerClientEvent('esx:showNotification', source, _U('too_many_pouches')) elseif weedQuantity < 5 then - TriggerClientEvent('esx:showNotification', source, 'Vous n\'avez pas assez de weed à ~r~conditionner~s~') + TriggerClientEvent('esx:showNotification', source, _U('not_enough_weed')) else xPlayer.removeInventoryItem('weed', 5) xPlayer.addInventoryItem('weed_pooch', 1) @@ -457,7 +457,7 @@ AddEventHandler('esx_drugs:startTransformWeed', function() PlayersTransformingWeed[_source] = true - TriggerClientEvent('esx:showNotification', _source, '~y~Conditonnement en cours~s~...') + TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog')) TransformWeed(source) @@ -475,7 +475,7 @@ end) local function SellWeed(source) if CopsConnected < Config.RequiredCopsWeed then - TriggerClientEvent('esx_weedjob:showNotification', source, 'Action ~r~impossible~s~, ~b~policiers~s~: ' .. CopsConnected .. '/' .. Config.RequiredCopsWeed) + TriggerClientEvent('esx_weedjob:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsWeed) return end @@ -488,24 +488,24 @@ local function SellWeed(source) local poochQuantity = xPlayer.getInventoryItem('weed_pooch').count if poochQuantity == 0 then - TriggerClientEvent('esx:showNotification', source, 'Vous n\'avez plus de pochons à ~r~vendre~s~') + TriggerClientEvent('esx:showNotification', source, _U('no_pouches_sale')) else xPlayer:removeInventoryItem('weed_pooch', 1) if CopsConnected == 0 then xPlayer.addAccountMoney('black_money', 108) - TriggerClientEvent('esx:showNotification', source, 'Vous avez vendu ~g~x1 Pochon de weed~s~') + TriggerClientEvent('esx:showNotification', source, _U('sold_one_weed')) elseif CopsConnected == 1 then xPlayer.addAccountMoney('black_money', 128) - TriggerClientEvent('esx:showNotification', source, 'Vous avez vendu ~g~x1 Pochon de weed~s~') + TriggerClientEvent('esx:showNotification', source, _U('sold_one_weed')) elseif CopsConnected == 2 then xPlayer.addAccountMoney('black_money', 152) - TriggerClientEvent('esx:showNotification', source, 'Vous avez vendu ~g~x1 Pochon de weed~s~') + TriggerClientEvent('esx:showNotification', source, _U('sold_one_weed')) elseif CopsConnected == 3 then xPlayer.addAccountMoney('black_money', 165) - TriggerClientEvent('esx:showNotification', source, 'Vous avez vendu ~g~x1 Pochon de weed~s~') + TriggerClientEvent('esx:showNotification', source, _U('sold_one_weed')) elseif CopsConnected >= 4 then xPlayer.addAccountMoney('black_money', 180) - TriggerClientEvent('esx:showNotification', source, 'Vous avez vendu ~g~x1 Pochon de weed~s~') + TriggerClientEvent('esx:showNotification', source, _U('sold_one_weed')) end SellWeed(source) @@ -522,7 +522,7 @@ AddEventHandler('esx_drugs:startSellWeed', function() PlayersSellingWeed[_source] = true - TriggerClientEvent('esx:showNotification', _source, '~g~Vente en cours~s~...') + TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog')) SellWeed(source) @@ -556,6 +556,6 @@ ESX.RegisterUsableItem('weed', function(source) xPlayer.removeInventoryItem('weed', 1) TriggerClientEvent('esx_drugs:onPot', _source) - TriggerClientEvent('esx:showNotification', _source, 'Vous avez utilisé 1 de ~b~Weed') + TriggerClientEvent('esx:showNotification', _source, _U('used_one_weed')) end) \ No newline at end of file From 0a9da2b42683a36c114e25c99d4b5e42b15204c4 Mon Sep 17 00:00:00 2001 From: pixinc Date: Fri, 18 Aug 2017 02:53:09 +1100 Subject: [PATCH 08/66] Fix SellWeed xPlayer:removeInventoryItem replaced by xPlayer.removeInventoryItem --- server/esx_drugs_sv.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/esx_drugs_sv.lua b/server/esx_drugs_sv.lua index 867a0bc5..00417a88 100644 --- a/server/esx_drugs_sv.lua +++ b/server/esx_drugs_sv.lua @@ -490,7 +490,7 @@ local function SellWeed(source) if poochQuantity == 0 then TriggerClientEvent('esx:showNotification', source, _U('no_pouches_sale')) else - xPlayer:removeInventoryItem('weed_pooch', 1) + xPlayer.removeInventoryItem('weed_pooch', 1) if CopsConnected == 0 then xPlayer.addAccountMoney('black_money', 108) TriggerClientEvent('esx:showNotification', source, _U('sold_one_weed')) @@ -558,4 +558,4 @@ ESX.RegisterUsableItem('weed', function(source) TriggerClientEvent('esx_drugs:onPot', _source) TriggerClientEvent('esx:showNotification', _source, _U('used_one_weed')) -end) \ No newline at end of file +end) From 97fe7507eac836335a1668d8f57ead5324887c7a Mon Sep 17 00:00:00 2001 From: TakumiBR <31086346+TakumiBR@users.noreply.github.com> Date: Thu, 17 Aug 2017 08:53:20 -0700 Subject: [PATCH 09/66] Multi-language support Brazilian Portuguese translation --- __resource.lua | 2 ++ locales/br.lua | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 locales/br.lua diff --git a/__resource.lua b/__resource.lua index 47bf7078..53c16c00 100644 --- a/__resource.lua +++ b/__resource.lua @@ -3,6 +3,7 @@ description 'esx_drugs' server_scripts { '@es_extended/locale.lua', + 'locales/br.lua', 'locales/en.lua', 'locales/fr.lua', 'server/esx_drugs_sv.lua', @@ -13,6 +14,7 @@ server_scripts { client_scripts { '@es_extended/locale.lua', + 'locales/br.lua', 'locales/en.lua', 'locales/fr.lua', 'config.lua', diff --git a/locales/br.lua b/locales/br.lua new file mode 100644 index 00000000..23afcbb4 --- /dev/null +++ b/locales/br.lua @@ -0,0 +1,29 @@ +Locales['br'] = { + + ['press_collect_coke'] = 'Pressione ~INPUT_CONTEXT~ para coletar coca', + ['press_process_coke'] = 'Pressione ~INPUT_CONTEXT~ para processar a coca', + ['press_sell_coke'] = 'Pressione ~INPUT_CONTEXT~ para vender coca', + ['press_collect_meth'] = 'Pressione ~INPUT_CONTEXT~ para coletar metanfetamina', + ['press_process_meth'] = 'Pressione ~INPUT_CONTEXT~ para processar metanfetamina', + ['press_sell_meth'] = 'Pressione ~INPUT_CONTEXT~ para vender metanfetamina', + ['press_collect_weed'] = 'Pressione ~INPUT_CONTEXT~ para coletar erva', + ['press_process_weed'] = 'Pressione ~INPUT_CONTEXT~ para processar erva', + ['press_sell_weed'] = 'Pressione ~INPUT_CONTEXT~ para vender erva', + ['act_imp_police'] = 'Ação ~r~impossivel~s~, ~b~polícia~s~: ', + ['inv_full_coke'] = 'Você não pode mais coletar a Cocaína, seu estoque está ~r~cheio~s~', + ['pickup_in_prog'] = '~y~Colheita em progresso~s~...', + ['too_many_pouches'] = 'Você tem muitas trouxinhas', + ['not_enough_coke'] = 'Você não tem folha de coca suficiente para ~r~empacotar~s~', + ['packing_in_prog'] = '~y~Empacotamento em progresso~s~...', + ['no_pouchs_sale'] = 'Você não tem mais trouxinhas para ~r~vender~s~', + ['sold_one_coke'] = 'Você vendeu ~g~x1 Trouxinha de Cocaína~s~', + ['sale_in_prog'] = '~g~Venda em progresso~s~...', + ['inv_full_meth'] = 'Você não pode mais coletar metanfetamina, seu inventário está ~r~cheio~s~', + ['not_enough_meth'] = 'Você não tem metanfetamina suficiente para ~r~embalar~s~', + ['sold_one_meth'] = 'Você vendeu ~g~x1 Trouxinha de Metanfetamina~s~', + ['inv_full_weed'] = 'Você não pode mais coletar erva, seu inventário está ~r~cheio~s~', + ['not_enough_weed'] = 'Você não tem erva suficiente para ~r~embalar~s~', + ['sold_one_weed'] = 'Você vendeu ~g~x1 Trouxinha de erva~s~', + ['used_one_weed'] = 'Você usou 1 trouxinha de ~b~erva', + +} \ No newline at end of file From 9edebd8776e74ef4b8f1e6719215a64446472721 Mon Sep 17 00:00:00 2001 From: Pgmbru Date: Sun, 20 Aug 2017 21:04:26 +0200 Subject: [PATCH 10/66] esx_drugs_cl.lua FIX by Pgmbru Changement du pochonQuantity vers poochQuantity Changement du meth_pochon vers meth_pooch --- server/esx_drugs_sv.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/server/esx_drugs_sv.lua b/server/esx_drugs_sv.lua index 00417a88..82de1a90 100644 --- a/server/esx_drugs_sv.lua +++ b/server/esx_drugs_sv.lua @@ -261,15 +261,15 @@ local function TransformMeth(source) local xPlayer = ESX.GetPlayerFromId(source) local methQuantity = xPlayer.getInventoryItem('meth').count - local pochonQuantity = xPlayer.getInventoryItem('meth_pooch').count + local poochQuantity = xPlayer.getInventoryItem('meth_pooch').count - if pochonQuantity > 35 then + if poochQuantity > 35 then TriggerClientEvent('esx:showNotification', source, _U('too_many_pouches')) elseif methQuantity < 5 then TriggerClientEvent('esx:showNotification', source, _U('not_enough_meth')) else xPlayer.removeInventoryItem('meth', 5) - xPlayer.addInventoryItem('meth_pochon', 1) + xPlayer.addInventoryItem('meth_pooch', 1) TransformMeth(source) end @@ -313,12 +313,12 @@ local function SellMeth(source) local xPlayer = ESX.GetPlayerFromId(source) - local pochonQuantity = xPlayer.getInventoryItem('meth_pooch').count + local poochQuantity = xPlayer.getInventoryItem('meth_pooch').count - if pochonQuantity == 0 then + if poochQuantity == 0 then TriggerClientEvent('esx:showNotification', source, _U('no_pouches_sale')) else - xPlayer.removeInventoryItem('meth_pochon', 1) + xPlayer.removeInventoryItem('meth_pooch', 1) if CopsConnected == 0 then xPlayer.addAccountMoney('black_money', 276) TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) From 34853e0ea8815064890c451e9dec4204c9c22742 Mon Sep 17 00:00:00 2001 From: Pgmbru Date: Sun, 20 Aug 2017 21:08:17 +0200 Subject: [PATCH 11/66] esx_drugs_cl.lua FIX by Pgmbru Changement du ('esx_drugs:startSellCoke') vers ('esx_drugs:startSellMeth') --- client/esx_drugs_cl.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/esx_drugs_cl.lua b/client/esx_drugs_cl.lua index 001da77a..ae97c58c 100644 --- a/client/esx_drugs_cl.lua +++ b/client/esx_drugs_cl.lua @@ -255,7 +255,7 @@ Citizen.CreateThread(function() TriggerServerEvent('esx_drugs:startTransformMeth') end if CurrentAction == 'meth_resell' then - TriggerServerEvent('esx_drugs:startSellCoke') + TriggerServerEvent('esx_drugs:startSellMeth') end if CurrentAction == 'weed_harvest' then TriggerServerEvent('esx_drugs:startHarvestWeed') From d5721f363599940ff87e3efb49a34fcba21a69aa Mon Sep 17 00:00:00 2001 From: Charly Date: Mon, 21 Aug 2017 10:12:30 +0200 Subject: [PATCH 12/66] Correction texte --- locales/fr.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locales/fr.lua b/locales/fr.lua index e182eb55..eeddacb2 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -21,7 +21,7 @@ Locales['fr'] = { ['inv_full_meth'] = 'vous ne pouvez plus ramasser de Meth, votre inventaire est ~r~plein~s~', ['not_enough_meth'] = 'vous n\'avez pas assez de Meth à ~r~conditionner~s~', ['sold_one_meth'] = 'vous avez vendu ~g~x1 Pochon de meth~s~', - ['inv_full_weed'] = 'vous ne pouvez plus ramasser de weed, votre inventair est ~r~plein~s~', + ['inv_full_weed'] = 'vous ne pouvez plus ramasser de weed, votre inventaire est ~r~plein~s~', ['not_enough_weed'] = 'vous n\'avez pas assez de weed à ~r~conditionner~s~', ['sold_one_weed'] = 'vous avez vendu ~g~x1 Pochon de weed~s~', ['used_one_weed'] = 'Vous avez utilisé 1 Pochon de ~b~weed', From 27992b06fee348a7733255e5630d0cb9066f3906 Mon Sep 17 00:00:00 2001 From: renaiku Date: Tue, 22 Aug 2017 01:42:50 +0200 Subject: [PATCH 13/66] fix --- server/esx_drugs_sv.lua | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/server/esx_drugs_sv.lua b/server/esx_drugs_sv.lua index 82de1a90..970e799b 100644 --- a/server/esx_drugs_sv.lua +++ b/server/esx_drugs_sv.lua @@ -18,8 +18,9 @@ function CountCops() CopsConnected = 0 - for k,v in pairs(xPlayers) do - if v.job.name == 'police' then + for i=1, #xPlayers, 1 do + local xPlayer = ESX.GetPlayerFromId(xPlayers[i]) + if xPlayer.job.name == 'police' then CopsConnected = CopsConnected + 1 end end @@ -65,7 +66,7 @@ AddEventHandler('esx_drugs:startHarvestCoke', function() TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog')) - HarvestCoke(source) + HarvestCoke(_source) end) @@ -118,7 +119,7 @@ AddEventHandler('esx_drugs:startTransformCoke', function() TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog')) - TransformCoke(source) + TransformCoke(_source) end) @@ -186,7 +187,7 @@ AddEventHandler('esx_drugs:startSellCoke', function() TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog')) - SellCoke(source) + SellCoke(_source) end) @@ -234,7 +235,7 @@ AddEventHandler('esx_drugs:startHarvestMeth', function() TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog')) - HarvestMeth(source) + HarvestMeth(_source) end) @@ -287,7 +288,7 @@ AddEventHandler('esx_drugs:startTransformMeth', function() TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog')) - TransformMeth(source) + TransformMeth(_source) end) @@ -358,7 +359,7 @@ AddEventHandler('esx_drugs:startSellMeth', function() TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog')) - SellMeth(source) + SellMeth(_source) end) @@ -406,7 +407,7 @@ AddEventHandler('esx_drugs:startHarvestWeed', function() TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog')) - HarvestWeed(source) + HarvestWeed(_source) end) @@ -459,7 +460,7 @@ AddEventHandler('esx_drugs:startTransformWeed', function() TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog')) - TransformWeed(source) + TransformWeed(_source) end) @@ -524,7 +525,7 @@ AddEventHandler('esx_drugs:startSellWeed', function() TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog')) - SellWeed(source) + SellWeed(_source) end) @@ -542,9 +543,17 @@ RegisterServerEvent('esx_drugs:GetUserInventory') AddEventHandler('esx_drugs:GetUserInventory', function(currentZone) local _source = source local xPlayer = ESX.GetPlayerFromId(_source) - TriggerClientEvent('esx_drugs:ReturnInventory', _source, xPlayer.getInventoryItem('coke').count, xPlayer.getInventoryItem('coke_pooch').count, - xPlayer.getInventoryItem('meth').count, xPlayer.getInventoryItem('meth_pooch').count, - xPlayer.getInventoryItem('weed').count, xPlayer.getInventoryItem('weed_pooch').count, xPlayer.job.name, currentZone) + TriggerClientEvent('esx_drugs:ReturnInventory', + _source, + xPlayer.getInventoryItem('coke').count, + xPlayer.getInventoryItem('coke_pooch').count, + xPlayer.getInventoryItem('meth').count, + xPlayer.getInventoryItem('meth_pooch').count, + xPlayer.getInventoryItem('weed').count, + xPlayer.getInventoryItem('weed_pooch').count, + xPlayer.job.name, + currentZone + ) end) -- Register Usable Item From 93a8db19a08db44de307aaa380524085e4ff0a30 Mon Sep 17 00:00:00 2001 From: TanguyOrtegat Date: Fri, 25 Aug 2017 18:51:12 +0200 Subject: [PATCH 14/66] added opium --- README.md | 12 ++- client/esx_drugs_cl.lua | 58 +++++++++++- config.lua | 22 +++-- esx_drugs.sql | 4 +- locales/br.lua | 7 ++ locales/en.lua | 7 ++ locales/fr.lua | 7 ++ server/esx_drugs_sv.lua | 203 +++++++++++++++++++++++++++++++++++++--- 8 files changed, 293 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 97e88e09..e1873b00 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,17 @@ FXserver ESX Drugs * esx_policejob => https://github.com/FXServer-ESX/fxserver-esx_policejob -[INSTALLATION] + + [UPDATE] + to install opium : +``` +INSERT INTO `items` (name, label) VALUES + ('opium', 'Opium'), + ('opium_pooch', 'Pochon de opium') +; +``` + + [INSTALLATION] 1) CD in your resources/[esx] folder 2) Clone the repository diff --git a/client/esx_drugs_cl.lua b/client/esx_drugs_cl.lua index ae97c58c..9e5b8a7d 100644 --- a/client/esx_drugs_cl.lua +++ b/client/esx_drugs_cl.lua @@ -20,6 +20,8 @@ local weedQTE = 0 local weed_poochQTE = 0 local methQTE = 0 local meth_poochQTE = 0 +local opiumQTE = 0 +local opium_poochQTE = 0 local myJob = nil local PlayerData = {} local GUI = {} @@ -39,7 +41,8 @@ end) AddEventHandler('esx_drugs:hasEnteredMarker', function(zone) ESX.UI.Menu.CloseAll() - + + --coke if zone == 'CokeFarm' then if myJob ~= "police" then CurrentAction = 'coke_harvest' @@ -67,7 +70,8 @@ AddEventHandler('esx_drugs:hasEnteredMarker', function(zone) end end end - + + --meth if zone == 'MethFarm' then if myJob ~= "police" then CurrentAction = 'meth_harvest' @@ -95,7 +99,8 @@ AddEventHandler('esx_drugs:hasEnteredMarker', function(zone) end end end - + + --weed if zone == 'WeedFarm' then if myJob ~= "police" then CurrentAction = 'weed_harvest' @@ -123,6 +128,35 @@ AddEventHandler('esx_drugs:hasEnteredMarker', function(zone) end end end + + --opium + if zone == 'OpiumFarm' then + if myJob ~= "police" then + CurrentAction = 'opium_harvest' + CurrentActionMsg = _U('press_collect_opium') + CurrentActionData = {} + end + end + + if zone == 'OpiumTreatment' then + if myJob ~= "police" then + if opiumQTE >= 5 then + CurrentAction = 'opium_treatment' + CurrentActionMsg = _U('press_process_opium') + CurrentActionData = {} + end + end + end + + if zone == 'OpiumResell' then + if myJob ~= "police" then + if opium_poochQTE >= 1 then + CurrentAction = 'opium_resell' + CurrentActionMsg = _U('press_sell_opium') + CurrentActionData = {} + end + end + end end) AddEventHandler('esx_drugs:hasExitedMarker', function(zone) @@ -139,6 +173,9 @@ AddEventHandler('esx_drugs:hasExitedMarker', function(zone) TriggerServerEvent('esx_drugs:stopHarvestWeed') TriggerServerEvent('esx_drugs:stopTransformWeed') TriggerServerEvent('esx_drugs:stopSellWeed') + TriggerServerEvent('esx_drugs:stopHarvestOpium') + TriggerServerEvent('esx_drugs:stopTransformOpium') + TriggerServerEvent('esx_drugs:stopSellOpium') end) -- Weed Effect @@ -188,13 +225,15 @@ end) -- RETURN NUMBER OF ITEMS FROM SERVER RegisterNetEvent('esx_drugs:ReturnInventory') -AddEventHandler('esx_drugs:ReturnInventory', function(cokeNbr, cokepNbr, methNbr, methpNbr, weedNbr, weedpNbr, jobName, currentZone) +AddEventHandler('esx_drugs:ReturnInventory', function(cokeNbr, cokepNbr, methNbr, methpNbr, weedNbr, weedpNbr,opiumNbr, opiumpNbr, jobName, currentZone) cokeQTE = cokeNbr coke_poochQTE = cokepNbr methQTE = methNbr meth_poochQTE = methpNbr weedQTE = weedNbr - weed_poochQTE = weedpNbr + weed_poochQTE = weedpNbr + opiumQTE = opiumbr + opium_poochQTE = opiumpNbr myJob = jobName TriggerEvent('esx_drugs:hasEnteredMarker', currentZone) end) @@ -266,6 +305,15 @@ Citizen.CreateThread(function() if CurrentAction == 'weed_resell' then TriggerServerEvent('esx_drugs:startSellWeed') end + if CurrentAction == 'opium_harvest' then + TriggerServerEvent('esx_drugs:startHarvestOpium') + end + if CurrentAction == 'opium_treatment' then + TriggerServerEvent('esx_drugs:startTransformOpium') + end + if CurrentAction == 'opium_resell' then + TriggerServerEvent('esx_drugs:startSellOpium') + end CurrentAction = nil end end diff --git a/config.lua b/config.lua index f277af23..7d660cd6 100644 --- a/config.lua +++ b/config.lua @@ -6,16 +6,20 @@ Config.ZoneSize = {x = 5.0, y = 5.0, z = 3.0} Config.RequiredCopsCoke = 2 Config.RequiredCopsMeth = 2 Config.RequiredCopsWeed = 0 +Config.RequiredCopsOpium = 3 Config.Locale = 'fr' Config.Zones = { - CokeFarm = {x=2448.9228515625, y=-1836.8076171875, z=51.953701019287}, - CokeTreatment = {x=-458.13967895508, y=-2278.6174316406, z=7.5158290863037}, - CokeResell = {x=-1756.1984863281, y=427.31674194336, z=126.68292999268}, - MethFarm = {x=1525.298828125, y=1710.0217285156, z=109.00956726074}, - MethTreatment = {x=-1001.4151611328, y=4848.0087890625, z=274.00686645508}, - MethResell = {x=-63.592178344727, y=-1224.0709228516, z=27.768648147583}, - WeedFarm = {x=1609.125, y=6663.5942382813, z=20.961572647095}, - WeedTreatment = {x=91.061386108398, y=3750.0380859375, z=39.77326965332}, - WeedResell = {x=-54.249694824219, y=-1443.3666992188, z=31.068626403809} + CokeFarm = {x=2448.9228515625, y=-1836.8076171875, z=51.953701019287}, + CokeTreatment = {x=-458.13967895508, y=-2278.6174316406, z=7.5158290863037}, + CokeResell = {x=-1756.1984863281, y=427.31674194336, z=126.68292999268}, + MethFarm = {x=1525.298828125, y=1710.0217285156, z=109.00956726074}, + MethTreatment = {x=-1001.4151611328, y=4848.0087890625, z=274.00686645508}, + MethResell = {x=-63.592178344727, y=-1224.0709228516, z=27.768648147583}, + WeedFarm = {x=1609.125, y=6663.5942382813, z=20.961572647095}, + WeedTreatment = {x=91.061386108398, y=3750.0380859375, z=39.77326965332}, + WeedResell = {x=-54.249694824219, y=-1443.3666992188, z=31.068626403809}, + OpiumFarm = {x=1972.784790039, y=3819.3999023438, z=33.428722381592}, + OpiumTreatment = {x=971.86499023438,y=-2157.61328125, z=28.475107192994}, + OpiumResell = {x=2331.0881347656,y=2570.2250976562,z=46.681819915772} } \ No newline at end of file diff --git a/esx_drugs.sql b/esx_drugs.sql index 6cad45ce..17d92a2d 100644 --- a/esx_drugs.sql +++ b/esx_drugs.sql @@ -4,5 +4,7 @@ INSERT INTO `items` (name, label) VALUES ('coke', 'Coke'), ('coke_pooch', 'Pochon de coke'), ('meth', 'Meth'), - ('meth_pooch', 'Pochon de meth') + ('meth_pooch', 'Pochon de meth'), + ('opium', 'Opium'), + ('opium_pooch', 'Pochon de opium') ; \ No newline at end of file diff --git a/locales/br.lua b/locales/br.lua index 23afcbb4..fdad1ed5 100644 --- a/locales/br.lua +++ b/locales/br.lua @@ -8,6 +8,9 @@ Locales['br'] = { ['press_sell_meth'] = 'Pressione ~INPUT_CONTEXT~ para vender metanfetamina', ['press_collect_weed'] = 'Pressione ~INPUT_CONTEXT~ para coletar erva', ['press_process_weed'] = 'Pressione ~INPUT_CONTEXT~ para processar erva', + ['press_sell_opium'] = 'Pressione ~INPUT_CONTEXT~ para vender ópio', + ['press_collect_opium'] = 'Pressione ~INPUT_CONTEXT~ para coletar ópio', + ['press_process_opium'] = 'Pressione ~INPUT_CONTEXT~ para processar ópio', ['press_sell_weed'] = 'Pressione ~INPUT_CONTEXT~ para vender erva', ['act_imp_police'] = 'Ação ~r~impossivel~s~, ~b~polícia~s~: ', ['inv_full_coke'] = 'Você não pode mais coletar a Cocaína, seu estoque está ~r~cheio~s~', @@ -25,5 +28,9 @@ Locales['br'] = { ['not_enough_weed'] = 'Você não tem erva suficiente para ~r~embalar~s~', ['sold_one_weed'] = 'Você vendeu ~g~x1 Trouxinha de erva~s~', ['used_one_weed'] = 'Você usou 1 trouxinha de ~b~erva', + ['inv_full_opium'] = 'Você não pode mais coletar ópio, seu inventário está ~r~cheio~s~', + ['not_enough_opium'] = 'Você não tem ópio suficiente para ~r~embalar~s~', + ['sold_one_opium'] = 'Você vendeu ~g~x1 Trouxinha de ópio~s~', + ['used_one_opium'] = 'Você usou 1 trouxinha de ~b~ópio', } \ No newline at end of file diff --git a/locales/en.lua b/locales/en.lua index a3013aaa..3852ef36 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -9,6 +9,9 @@ Locales['en'] = { ['press_collect_weed'] = 'press ~INPUT_CONTEXT~ to collect weed', ['press_process_weed'] = 'press ~INPUT_CONTEXT~ to process weed', ['press_sell_weed'] = 'press ~INPUT_CONTEXT~ to sell weed', + ['press_collect_opium'] = 'press ~INPUT_CONTEXT~ to collect opium', + ['press_process_opium'] = 'press ~INPUT_CONTEXT~ to process opium', + ['press_sell_opium'] = 'press ~INPUT_CONTEXT~ to sell opium', ['act_imp_police'] = 'action ~r~impossible~s~, ~b~police~s~: ', ['inv_full_coke'] = 'you can no longer collect Cocaine, your inventory is ~r~full~s~', ['pickup_in_prog'] = '~y~Pickup in progress~s~...', @@ -25,5 +28,9 @@ Locales['en'] = { ['not_enough_weed'] = 'you do not have enough Weed to ~r~pack~s~', ['sold_one_weed'] = 'you\'ve sold ~g~x1 Weed Pouch~s~', ['used_one_weed'] = 'you used 1 pouch of ~b~weed', + ['inv_full_opium'] = 'you can no longer collect opium, your inventory is ~r~full~s~', + ['not_enough_opium'] = 'you do not have enough opium to ~r~pack~s~', + ['sold_one_opium'] = 'you\'ve sold ~g~x1 opium Pouch~s~', + ['used_one_opium'] = 'you used 1 pouch of ~b~opium', } \ No newline at end of file diff --git a/locales/fr.lua b/locales/fr.lua index eeddacb2..55d455e3 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -9,6 +9,9 @@ Locales['fr'] = { ['press_collect_weed'] = 'appuyez sur ~INPUT_CONTEXT~ pour récolter la weed', ['press_process_weed'] = 'appuyez sur ~INPUT_CONTEXT~ pour traiter la weed', ['press_sell_weed'] = 'appuyez sur ~INPUT_CONTEXT~ pour vendre la weed', + ['press_collect_opium'] = "appuyez sur ~INPUT_CONTEXT~ pour récolter l'opium", + ['press_process_opium'] = "appuyez sur ~INPUT_CONTEXT~ pour traiter l'opium", + ['press_sell_opium'] = "appuyez sur ~INPUT_CONTEXT~ pour vendre l'opium", ['act_imp_police'] = 'action ~r~impossible~s~, ~b~policiers~s~: ', ['inv_full_coke'] = 'vous ne pouvez plus ramasser de Cocaine, votre inventaire est ~r~plein~s~', ['pickup_in_prog'] = '~y~Ramassage en cours~s~...', @@ -25,5 +28,9 @@ Locales['fr'] = { ['not_enough_weed'] = 'vous n\'avez pas assez de weed à ~r~conditionner~s~', ['sold_one_weed'] = 'vous avez vendu ~g~x1 Pochon de weed~s~', ['used_one_weed'] = 'Vous avez utilisé 1 Pochon de ~b~weed', + ['inv_full_opium'] = 'vous ne pouvez plus ramasser de weed, votre inventaire est ~r~plein~s~', + ['not_enough_opium'] = 'vous n\'avez pas assez de opium à ~r~conditionner~s~', + ['sold_one_opium'] = 'vous avez vendu ~g~x1 Pochon de opium~s~', + ['used_one_opium'] = 'Vous avez utilisé 1 Pochon de ~b~opium', } \ No newline at end of file diff --git a/server/esx_drugs_sv.lua b/server/esx_drugs_sv.lua index 970e799b..ba8606aa 100644 --- a/server/esx_drugs_sv.lua +++ b/server/esx_drugs_sv.lua @@ -1,14 +1,17 @@ -ESX = nil -local CopsConnected = 0 -local PlayersHarvestingCoke = {} -local PlayersTransformingCoke = {} -local PlayersSellingCoke = {} -local PlayersHarvestingMeth = {} -local PlayersTransformingMeth = {} -local PlayersSellingMeth = {} -local PlayersHarvestingWeed = {} -local PlayersTransformingWeed = {} -local PlayersSellingWeed = {} +ESX = nil +local CopsConnected = 0 +local PlayersHarvestingCoke = {} +local PlayersTransformingCoke = {} +local PlayersSellingCoke = {} +local PlayersHarvestingMeth = {} +local PlayersTransformingMeth = {} +local PlayersSellingMeth = {} +local PlayersHarvestingWeed = {} +local PlayersTransformingWeed = {} +local PlayersSellingWeed = {} +local PlayersHarvestingOpium = {} +local PlayersTransformingOpium = {} +local PlayersSellingOpium = {} TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) @@ -31,6 +34,7 @@ end CountCops() +--coke local function HarvestCoke(source) if CopsConnected < Config.RequiredCopsCoke then @@ -200,6 +204,7 @@ AddEventHandler('esx_drugs:stopSellCoke', function() end) +--meth local function HarvestMeth(source) if CopsConnected < Config.RequiredCopsMeth then @@ -372,6 +377,7 @@ AddEventHandler('esx_drugs:stopSellMeth', function() end) +--weed local function HarvestWeed(source) if CopsConnected < Config.RequiredCopsWeed then @@ -538,6 +544,179 @@ AddEventHandler('esx_drugs:stopSellWeed', function() end) + +--opium + +local function HarvestOpium(source) + + if CopsConnected < Config.RequiredCopsOpium then + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsOpium) + return + end + + SetTimeout(5000, function() + + if PlayersHarvestingOpium[source] == true then + + local xPlayer = ESX.GetPlayerFromId(source) + + local opium = xPlayer.getInventoryItem('opium') + + if opium.limit ~= -1 and opium.count >= opium.limit then + TriggerClientEvent('esx:showNotification', source, _U('inv_full_opium')) + else + xPlayer.addInventoryItem('opium', 1) + HarvestOpium(source) + end + + end + end) +end + +RegisterServerEvent('esx_drugs:startHarvestOpium') +AddEventHandler('esx_drugs:startHarvestOpium', function() + + local _source = source + + PlayersHarvestingOpium[_source] = true + + TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog')) + + HarvestOpium(_source) + +end) + +RegisterServerEvent('esx_drugs:stopHarvestOpium') +AddEventHandler('esx_drugs:stopHarvestOpium', function() + + local _source = source + + PlayersHarvestingOpium[_source] = false + +end) + +local function TransformOpium(source) + + if CopsConnected < Config.RequiredCopsOpium then + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsOpium) + return + end + + SetTimeout(10000, function() + + if PlayersTransformingOpium[source] == true then + + local xPlayer = ESX.GetPlayerFromId(source) + + local opiumQuantity = xPlayer.getInventoryItem('opium').count + local poochQuantity = xPlayer.getInventoryItem('opium_pooch').count + + if poochQuantity > 35 then + TriggerClientEvent('esx:showNotification', source, _U('too_many_pouches')) + elseif opiumQuantity < 5 then + TriggerClientEvent('esx:showNotification', source, _U('not_enough_opium')) + else + xPlayer.removeInventoryItem('opium', 5) + xPlayer.addInventoryItem('opium_pooch', 1) + + TransformOpium(source) + end + + end + end) +end + +RegisterServerEvent('esx_drugs:startTransformOpium') +AddEventHandler('esx_drugs:startTransformOpium', function() + + local _source = source + + PlayersTransformingOpium[_source] = true + + TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog')) + + TransformOpium(_source) + +end) + +RegisterServerEvent('esx_drugs:stopTransformOpium') +AddEventHandler('esx_drugs:stopTransformOpium', function() + + local _source = source + + PlayersTransformingOpium[_source] = false + +end) + +local function SellOpium(source) + + if CopsConnected < Config.RequiredCopsOpium then + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsOpium) + return + end + + SetTimeout(7500, function() + + if PlayersSellingOpium[source] == true then + + local xPlayer = ESX.GetPlayerFromId(source) + + local poochQuantity = xPlayer.getInventoryItem('opium_pooch').count + + if poochQuantity == 0 then + TriggerClientEvent('esx:showNotification', source, _U('no_pouches_sale')) + else + xPlayer.removeInventoryItem('opium_pooch', 1) + if CopsConnected == 0 then + xPlayer.addAccountMoney('black_money', 300) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) + elseif CopsConnected == 1 then + xPlayer.addAccountMoney('black_money', 500) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) + elseif CopsConnected == 2 then + xPlayer.addAccountMoney('black_money', 700) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) + elseif CopsConnected == 3 then + xPlayer.addAccountMoney('black_money', 800) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) + elseif CopsConnected == 4 then + xPlayer.addAccountMoney('black_money', 900) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) + elseif CopsConnected >= 5 then + xPlayer.addAccountMoney('black_money', 1000) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) + end + + SellOpium(source) + end + + end + end) +end + +RegisterServerEvent('esx_drugs:startSellOpium') +AddEventHandler('esx_drugs:startSellOpium', function() + + local _source = source + + PlayersSellingOpium[_source] = true + + TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog')) + + SellOpium(_source) + +end) + +RegisterServerEvent('esx_drugs:stopSellOpium') +AddEventHandler('esx_drugs:stopSellOpium', function() + + local _source = source + + PlayersSellingOpium[_source] = false + +end) + + -- RETURN INVENTORY TO CLIENT RegisterServerEvent('esx_drugs:GetUserInventory') AddEventHandler('esx_drugs:GetUserInventory', function(currentZone) @@ -551,6 +730,8 @@ AddEventHandler('esx_drugs:GetUserInventory', function(currentZone) xPlayer.getInventoryItem('meth_pooch').count, xPlayer.getInventoryItem('weed').count, xPlayer.getInventoryItem('weed_pooch').count, + xPlayer.getInventoryItem('opium').count, + xPlayer.getInventoryItem('opium_pooch').count, xPlayer.job.name, currentZone ) From 18aab6e401e50fc4d3c15ba10cf886297a8d40f3 Mon Sep 17 00:00:00 2001 From: ultratm Date: Sat, 26 Aug 2017 11:19:25 +0200 Subject: [PATCH 15/66] Add German Language --- __resource.lua | 2 ++ de_esx_drugs.sql | 10 ++++++++++ locales/de.lua | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 de_esx_drugs.sql create mode 100644 locales/de.lua diff --git a/__resource.lua b/__resource.lua index 53c16c00..ac31d644 100644 --- a/__resource.lua +++ b/__resource.lua @@ -3,6 +3,7 @@ description 'esx_drugs' server_scripts { '@es_extended/locale.lua', + 'locales/de.lua', 'locales/br.lua', 'locales/en.lua', 'locales/fr.lua', @@ -14,6 +15,7 @@ server_scripts { client_scripts { '@es_extended/locale.lua', + 'locales/de.lua', 'locales/br.lua', 'locales/en.lua', 'locales/fr.lua', diff --git a/de_esx_drugs.sql b/de_esx_drugs.sql new file mode 100644 index 00000000..5ffb3e66 --- /dev/null +++ b/de_esx_drugs.sql @@ -0,0 +1,10 @@ +INSERT INTO `items` (name, label) VALUES + ('weed', 'Grass'), + ('weed_pooch', 'Portion Grass'), + ('coke', 'Koks'), + ('coke_pooch', 'Portion Koks'), + ('meth', 'Meth'), + ('meth_pooch', 'Portion Meth'), + ('opium', 'Opium'), + ('opium_pooch', 'Portion Opium') +; \ No newline at end of file diff --git a/locales/de.lua b/locales/de.lua new file mode 100644 index 00000000..4cbdbfe6 --- /dev/null +++ b/locales/de.lua @@ -0,0 +1,36 @@ +Locales['de'] = { + + ['press_collect_coke'] = 'drücke ~INPUT_CONTEXT~ um Koks zu sammeln', + ['press_process_coke'] = 'drücke ~INPUT_CONTEXT~ um Koks zu verarbeiten', + ['press_sell_coke'] = 'drücke ~INPUT_CONTEXT~ um Koks zu verkaufen', + ['press_collect_meth'] = 'drücke ~INPUT_CONTEXT~ um Meth zu sammeln', + ['press_process_meth'] = 'drücke ~INPUT_CONTEXT~ um Meth zu verarbeiten', + ['press_sell_meth'] = 'drücke ~INPUT_CONTEXT~ um Meth zu verkaufen', + ['press_collect_weed'] = 'drücke ~INPUT_CONTEXT~ um Grass zu sammeln', + ['press_process_weed'] = 'drücke ~INPUT_CONTEXT~ um Grass zu verarbeiten', + ['press_sell_weed'] = 'drücke ~INPUT_CONTEXT~ um Grass zu verkaufen', + ['press_collect_opium'] = 'drücke ~INPUT_CONTEXT~ um Opium zu sammeln', + ['press_process_opium'] = 'drücke ~INPUT_CONTEXT~ um Opium zu verarbeiten', + ['press_sell_opium'] = 'drücke ~INPUT_CONTEXT~ um Opium zu verkaufen', + ['act_imp_police'] = 'aktion ~r~nihct möglich~s~, ~b~Polizisten~s~: ', + ['inv_full_coke'] = 'Du kannst nicht länger Koks sammeln, dein Inventar ist ~r~VOLL~s~', + ['pickup_in_prog'] = '~y~Sammeln im gange~s~...', + ['too_many_pouches'] = 'du hast zuviele Pakete', + ['not_enough_coke'] = 'du hast nicht genug Koks zum ~r~verpacken~s~', + ['packing_in_prog'] = '~y~Verarbeitung im gange~s~...', + ['no_pouchs_sale'] = 'Du hast nicht genug Portionen zum ~r~verkaufen~s~', + ['sold_one_coke'] = 'du verkaufst ~g~x1 Portion Koks~s~', + ['sale_in_prog'] = '~g~Verkauf im gange~s~...', + ['inv_full_meth'] = 'Du kannst nicht länger Meth sammeln, dein Inventar ist ~r~VOLL~s~', + ['not_enough_meth'] = 'du hast nicht genug Meth zum ~r~verpacken~s~', + ['sold_one_meth'] = 'du verkaufst ~g~x1 Portion Meth~s~', + ['inv_full_weed'] = 'Du kannst nicht länger Grass sammeln, dein Inventar ist ~r~VOLL~s~', + ['not_enough_weed'] = 'du hast nicht genug Grass zum ~r~verarbeiten~s~', + ['sold_one_weed'] = 'du verkaufst ~g~x1 Portion Grass~s~', + ['used_one_weed'] = 'du benutzt 1x ~b~Grass', + ['inv_full_opium'] = 'Du kannst nicht länger Opium sammeln, dein Inventar ist ~r~VOLL~s~', + ['not_enough_opium'] = 'du hast nicht genug Opium zum ~r~verarbeiten~s~', + ['sold_one_opium'] = 'du verkaufst ~g~x1 Portion Opium~s~', + ['used_one_opium'] = 'du benutzt 1x ~b~Opium', + +} \ No newline at end of file From a9b1ae1ed35118bccb529f23e509034542e0f05b Mon Sep 17 00:00:00 2001 From: Don Date: Fri, 8 Sep 2017 22:27:14 -0700 Subject: [PATCH 16/66] Fixed opium Fixed opium --- client/esx_drugs_cl.lua | 468 ++++++++++++++++++++-------------------- config.lua | 2 +- 2 files changed, 235 insertions(+), 235 deletions(-) diff --git a/client/esx_drugs_cl.lua b/client/esx_drugs_cl.lua index 9e5b8a7d..dcaa2119 100644 --- a/client/esx_drugs_cl.lua +++ b/client/esx_drugs_cl.lua @@ -1,13 +1,13 @@ 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 + ["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 PID = 0 @@ -22,7 +22,7 @@ local methQTE = 0 local meth_poochQTE = 0 local opiumQTE = 0 local opium_poochQTE = 0 -local myJob = nil +local myJob = nil local PlayerData = {} local GUI = {} local HasAlreadyEnteredMarker = false @@ -32,290 +32,290 @@ local CurrentActionMsg = '' local CurrentActionData = {} Citizen.CreateThread(function() - while ESX == nil do - TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) - Citizen.Wait(0) - end + while ESX == nil do + TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) + Citizen.Wait(0) + end end) AddEventHandler('esx_drugs:hasEnteredMarker', function(zone) - - ESX.UI.Menu.CloseAll() - - --coke - if zone == 'CokeFarm' then - if myJob ~= "police" then - CurrentAction = 'coke_harvest' - CurrentActionMsg = _U('press_collect_coke') - CurrentActionData = {} - end - end - if zone == 'CokeTreatment' then - if myJob ~= "police" then - if cokeQTE >= 5 then - CurrentAction = 'coke_treatment' - CurrentActionMsg = _U('press_process_coke') - CurrentActionData = {} + ESX.UI.Menu.CloseAll() + + --coke + if zone == 'CokeFarm' then + if myJob ~= "police" then + CurrentAction = 'coke_harvest' + CurrentActionMsg = _U('press_collect_coke') + CurrentActionData = {} end end - end - if zone == 'CokeResell' then - if myJob ~= "police" then - if coke_poochQTE >= 1 then - CurrentAction = 'coke_resell' - CurrentActionMsg = _U('press_sell_coke') - CurrentActionData = {} + if zone == 'CokeTreatment' then + if myJob ~= "police" then + if cokeQTE >= 5 then + CurrentAction = 'coke_treatment' + CurrentActionMsg = _U('press_process_coke') + CurrentActionData = {} + end end end - end - - --meth - if zone == 'MethFarm' then - if myJob ~= "police" then - CurrentAction = 'meth_harvest' - CurrentActionMsg = _U('press_collect_meth') - CurrentActionData = {} - end - end - if zone == 'MethTreatment' then - if myJob ~= "police" then - if methQTE >= 5 then - CurrentAction = 'meth_treatment' - CurrentActionMsg = _U('press_process_meth') - CurrentActionData = {} + if zone == 'CokeResell' then + if myJob ~= "police" then + if coke_poochQTE >= 1 then + CurrentAction = 'coke_resell' + CurrentActionMsg = _U('press_sell_coke') + CurrentActionData = {} + end end end - end - if zone == 'MethResell' then - if myJob ~= "police" then - if meth_poochQTE >= 1 then - CurrentAction = 'meth_resell' - CurrentActionMsg = _U('press_sell_meth') - CurrentActionData = {} + --meth + if zone == 'MethFarm' then + if myJob ~= "police" then + CurrentAction = 'meth_harvest' + CurrentActionMsg = _U('press_collect_meth') + CurrentActionData = {} end end - end - - --weed - if zone == 'WeedFarm' then - if myJob ~= "police" then - CurrentAction = 'weed_harvest' - CurrentActionMsg = _U('press_collect_weed') - CurrentActionData = {} - end - end - if zone == 'WeedTreatment' then - if myJob ~= "police" then - if weedQTE >= 5 then - CurrentAction = 'weed_treatment' - CurrentActionMsg = _U('press_process_weed') - CurrentActionData = {} + if zone == 'MethTreatment' then + if myJob ~= "police" then + if methQTE >= 5 then + CurrentAction = 'meth_treatment' + CurrentActionMsg = _U('press_process_meth') + CurrentActionData = {} + end end end - end - if zone == 'WeedResell' then - if myJob ~= "police" then - if weed_poochQTE >= 1 then - CurrentAction = 'weed_resell' - CurrentActionMsg = _U('press_sell_weed') - CurrentActionData = {} + if zone == 'MethResell' then + if myJob ~= "police" then + if meth_poochQTE >= 1 then + CurrentAction = 'meth_resell' + CurrentActionMsg = _U('press_sell_meth') + CurrentActionData = {} + end end end - end - - --opium - if zone == 'OpiumFarm' then - if myJob ~= "police" then - CurrentAction = 'opium_harvest' - CurrentActionMsg = _U('press_collect_opium') - CurrentActionData = {} - end - end - if zone == 'OpiumTreatment' then - if myJob ~= "police" then - if opiumQTE >= 5 then - CurrentAction = 'opium_treatment' - CurrentActionMsg = _U('press_process_opium') - CurrentActionData = {} + --weed + if zone == 'WeedFarm' then + if myJob ~= "police" then + CurrentAction = 'weed_harvest' + CurrentActionMsg = _U('press_collect_weed') + CurrentActionData = {} end end - end - if zone == 'OpiumResell' then - if myJob ~= "police" then - if opium_poochQTE >= 1 then - CurrentAction = 'opium_resell' - CurrentActionMsg = _U('press_sell_opium') - CurrentActionData = {} + if zone == 'WeedTreatment' then + if myJob ~= "police" then + if weedQTE >= 5 then + CurrentAction = 'weed_treatment' + CurrentActionMsg = _U('press_process_weed') + CurrentActionData = {} + end + end + end + + if zone == 'WeedResell' then + if myJob ~= "police" then + if weed_poochQTE >= 1 then + CurrentAction = 'weed_resell' + CurrentActionMsg = _U('press_sell_weed') + CurrentActionData = {} + end + end + end + + --opium + if zone == 'OpiumFarm' then + if myJob ~= "police" then + CurrentAction = 'opium_harvest' + CurrentActionMsg = _U('press_collect_opium') + CurrentActionData = {} + end + end + + if zone == 'OpiumTreatment' then + if myJob ~= "police" then + if opiumQTE >= 5 then + CurrentAction = 'opium_treatment' + CurrentActionMsg = _U('press_process_opium') + CurrentActionData = {} + end + end + end + + if zone == 'OpiumResell' then + if myJob ~= "police" then + if opium_poochQTE >= 1 then + CurrentAction = 'opium_resell' + CurrentActionMsg = _U('press_sell_opium') + CurrentActionData = {} + end end end - end end) AddEventHandler('esx_drugs:hasExitedMarker', function(zone) - CurrentAction = nil - ESX.UI.Menu.CloseAll() + CurrentAction = nil + ESX.UI.Menu.CloseAll() - TriggerServerEvent('esx_drugs:stopHarvestCoke') - TriggerServerEvent('esx_drugs:stopTransformCoke') - TriggerServerEvent('esx_drugs:stopSellCoke') - TriggerServerEvent('esx_drugs:stopHarvestMeth') - TriggerServerEvent('esx_drugs:stopTransformMeth') - TriggerServerEvent('esx_drugs:stopSellMeth') - TriggerServerEvent('esx_drugs:stopHarvestWeed') - TriggerServerEvent('esx_drugs:stopTransformWeed') - TriggerServerEvent('esx_drugs:stopSellWeed') - TriggerServerEvent('esx_drugs:stopHarvestOpium') - TriggerServerEvent('esx_drugs:stopTransformOpium') - TriggerServerEvent('esx_drugs:stopSellOpium') + TriggerServerEvent('esx_drugs:stopHarvestCoke') + TriggerServerEvent('esx_drugs:stopTransformCoke') + TriggerServerEvent('esx_drugs:stopSellCoke') + TriggerServerEvent('esx_drugs:stopHarvestMeth') + TriggerServerEvent('esx_drugs:stopTransformMeth') + TriggerServerEvent('esx_drugs:stopSellMeth') + TriggerServerEvent('esx_drugs:stopHarvestWeed') + TriggerServerEvent('esx_drugs:stopTransformWeed') + TriggerServerEvent('esx_drugs:stopSellWeed') + TriggerServerEvent('esx_drugs:stopHarvestOpium') + TriggerServerEvent('esx_drugs:stopTransformOpium') + TriggerServerEvent('esx_drugs:stopSellOpium') end) -- Weed Effect RegisterNetEvent('esx_drugs:onPot') AddEventHandler('esx_drugs:onPot', function() - RequestAnimSet("MOVE_M@DRUNK@SLIGHTLYDRUNK") + RequestAnimSet("MOVE_M@DRUNK@SLIGHTLYDRUNK") while not HasAnimSetLoaded("MOVE_M@DRUNK@SLIGHTLYDRUNK") do Citizen.Wait(0) end TaskStartScenarioInPlace(GetPlayerPed(-1), "WORLD_HUMAN_SMOKING_POT", 0, true) - Citizen.Wait(5000) - DoScreenFadeOut(1000) - Citizen.Wait(1000) - ClearPedTasksImmediately(GetPlayerPed(-1)) - SetTimecycleModifier("spectator5") - SetPedMotionBlur(GetPlayerPed(-1), true) - SetPedMovementClipset(GetPlayerPed(-1), "MOVE_M@DRUNK@SLIGHTLYDRUNK", true) - SetPedIsDrunk(GetPlayerPed(-1), true) - DoScreenFadeIn(1000) - Citizen.Wait(600000) - DoScreenFadeOut(1000) - Citizen.Wait(1000) - DoScreenFadeIn(1000) - ClearTimecycleModifier() - ResetScenarioTypesEnabled() - ResetPedMovementClipset(GetPlayerPed(-1), 0) - SetPedIsDrunk(GetPlayerPed(-1), false) - SetPedMotionBlur(GetPlayerPed(-1), false) + Citizen.Wait(5000) + DoScreenFadeOut(1000) + Citizen.Wait(1000) + ClearPedTasksImmediately(GetPlayerPed(-1)) + SetTimecycleModifier("spectator5") + SetPedMotionBlur(GetPlayerPed(-1), true) + SetPedMovementClipset(GetPlayerPed(-1), "MOVE_M@DRUNK@SLIGHTLYDRUNK", true) + SetPedIsDrunk(GetPlayerPed(-1), true) + DoScreenFadeIn(1000) + Citizen.Wait(600000) + DoScreenFadeOut(1000) + Citizen.Wait(1000) + DoScreenFadeIn(1000) + ClearTimecycleModifier() + ResetScenarioTypesEnabled() + ResetPedMovementClipset(GetPlayerPed(-1), 0) + SetPedIsDrunk(GetPlayerPed(-1), false) + SetPedMotionBlur(GetPlayerPed(-1), false) end) -- Render markers Citizen.CreateThread(function() - while true do - - Wait(0) - - local coords = GetEntityCoords(GetPlayerPed(-1)) - - for k,v in pairs(Config.Zones) do - if(GetDistanceBetweenCoords(coords, v.x, v.y, v.z, true) < Config.DrawDistance) then - DrawMarker(Config.MarkerType, v.x, v.y, v.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, Config.ZoneSize.x, Config.ZoneSize.y, Config.ZoneSize.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false) - end - end + while true do - end + Wait(0) + + local coords = GetEntityCoords(GetPlayerPed(-1)) + + for k,v in pairs(Config.Zones) do + if(GetDistanceBetweenCoords(coords, v.x, v.y, v.z, true) < Config.DrawDistance) then + DrawMarker(Config.MarkerType, v.x, v.y, v.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, Config.ZoneSize.x, Config.ZoneSize.y, Config.ZoneSize.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false) + end + end + + end end) -- RETURN NUMBER OF ITEMS FROM SERVER RegisterNetEvent('esx_drugs:ReturnInventory') -AddEventHandler('esx_drugs:ReturnInventory', function(cokeNbr, cokepNbr, methNbr, methpNbr, weedNbr, weedpNbr,opiumNbr, opiumpNbr, jobName, currentZone) - cokeQTE = cokeNbr - coke_poochQTE = cokepNbr - methQTE = methNbr - meth_poochQTE = methpNbr - weedQTE = weedNbr - weed_poochQTE = weedpNbr - opiumQTE = opiumbr - opium_poochQTE = opiumpNbr - myJob = jobName - TriggerEvent('esx_drugs:hasEnteredMarker', currentZone) +AddEventHandler('esx_drugs:ReturnInventory', function(cokeNbr, cokepNbr, methNbr, methpNbr, weedNbr, weedpNbr, opiumNbr, opiumpNbr, jobName, currentZone) + cokeQTE = cokeNbr + coke_poochQTE = cokepNbr + methQTE = methNbr + meth_poochQTE = methpNbr + weedQTE = weedNbr + weed_poochQTE = weedpNbr + opiumQTE = opiumNbr + opium_poochQTE = opiumpNbr + myJob = jobName + TriggerEvent('esx_drugs:hasEnteredMarker', currentZone) end) -- Activate menu when player is inside marker Citizen.CreateThread(function() - while true do - - Wait(0) - - local coords = GetEntityCoords(GetPlayerPed(-1)) - local isInMarker = false - local currentZone = nil + while true do - for k,v in pairs(Config.Zones) do - if(GetDistanceBetweenCoords(coords, v.x, v.y, v.z, true) < Config.ZoneSize.x / 2) then - isInMarker = true - currentZone = k - end - end + Wait(0) - if isInMarker and not hasAlreadyEnteredMarker then - hasAlreadyEnteredMarker = true - lastZone = currentZone - TriggerServerEvent('esx_drugs:GetUserInventory', currentZone) - end + local coords = GetEntityCoords(GetPlayerPed(-1)) + local isInMarker = false + local currentZone = nil - if not isInMarker and hasAlreadyEnteredMarker then - hasAlreadyEnteredMarker = false - TriggerEvent('esx_drugs:hasExitedMarker', lastZone) - end + for k,v in pairs(Config.Zones) do + if(GetDistanceBetweenCoords(coords, v.x, v.y, v.z, true) < Config.ZoneSize.x / 2) then + isInMarker = true + currentZone = k + end + end - end + if isInMarker and not hasAlreadyEnteredMarker then + hasAlreadyEnteredMarker = true + lastZone = currentZone + TriggerServerEvent('esx_drugs:GetUserInventory', currentZone) + end + + if not isInMarker and hasAlreadyEnteredMarker then + hasAlreadyEnteredMarker = false + TriggerEvent('esx_drugs:hasExitedMarker', lastZone) + end + + end end) -- Key Controls Citizen.CreateThread(function() - while true do - Citizen.Wait(0) - if CurrentAction ~= nil then - SetTextComponentFormat('STRING') - AddTextComponentString(CurrentActionMsg) - DisplayHelpTextFromStringLabel(0, 0, 1, -1) - if IsControlJustReleased(0, 38) then - if CurrentAction == 'coke_harvest' then - TriggerServerEvent('esx_drugs:startHarvestCoke') - end - if CurrentAction == 'coke_treatment' then - TriggerServerEvent('esx_drugs:startTransformCoke') - end - if CurrentAction == 'coke_resell' then - TriggerServerEvent('esx_drugs:startSellCoke') - end - if CurrentAction == 'meth_harvest' then - TriggerServerEvent('esx_drugs:startHarvestMeth') - end - if CurrentAction == 'meth_treatment' then - TriggerServerEvent('esx_drugs:startTransformMeth') - end - if CurrentAction == 'meth_resell' then - TriggerServerEvent('esx_drugs:startSellMeth') - end - if CurrentAction == 'weed_harvest' then - TriggerServerEvent('esx_drugs:startHarvestWeed') - end - if CurrentAction == 'weed_treatment' then - TriggerServerEvent('esx_drugs:startTransformWeed') - end - if CurrentAction == 'weed_resell' then - TriggerServerEvent('esx_drugs:startSellWeed') - end - if CurrentAction == 'opium_harvest' then - TriggerServerEvent('esx_drugs:startHarvestOpium') - end - if CurrentAction == 'opium_treatment' then - TriggerServerEvent('esx_drugs:startTransformOpium') - end - if CurrentAction == 'opium_resell' then - TriggerServerEvent('esx_drugs:startSellOpium') - end - CurrentAction = nil - end - end - end + while true do + Citizen.Wait(0) + if CurrentAction ~= nil then + SetTextComponentFormat('STRING') + AddTextComponentString(CurrentActionMsg) + DisplayHelpTextFromStringLabel(0, 0, 1, -1) + if IsControlJustReleased(0, 38) then + if CurrentAction == 'coke_harvest' then + TriggerServerEvent('esx_drugs:startHarvestCoke') + end + if CurrentAction == 'coke_treatment' then + TriggerServerEvent('esx_drugs:startTransformCoke') + end + if CurrentAction == 'coke_resell' then + TriggerServerEvent('esx_drugs:startSellCoke') + end + if CurrentAction == 'meth_harvest' then + TriggerServerEvent('esx_drugs:startHarvestMeth') + end + if CurrentAction == 'meth_treatment' then + TriggerServerEvent('esx_drugs:startTransformMeth') + end + if CurrentAction == 'meth_resell' then + TriggerServerEvent('esx_drugs:startSellMeth') + end + if CurrentAction == 'weed_harvest' then + TriggerServerEvent('esx_drugs:startHarvestWeed') + end + if CurrentAction == 'weed_treatment' then + TriggerServerEvent('esx_drugs:startTransformWeed') + end + if CurrentAction == 'weed_resell' then + TriggerServerEvent('esx_drugs:startSellWeed') + end + if CurrentAction == 'opium_harvest' then + TriggerServerEvent('esx_drugs:startHarvestOpium') + end + if CurrentAction == 'opium_treatment' then + TriggerServerEvent('esx_drugs:startTransformOpium') + end + if CurrentAction == 'opium_resell' then + TriggerServerEvent('esx_drugs:startSellOpium') + end + CurrentAction = nil + end + end + end end) diff --git a/config.lua b/config.lua index 7d660cd6..af0ea942 100644 --- a/config.lua +++ b/config.lua @@ -22,4 +22,4 @@ Config.Zones = { OpiumFarm = {x=1972.784790039, y=3819.3999023438, z=33.428722381592}, OpiumTreatment = {x=971.86499023438,y=-2157.61328125, z=28.475107192994}, OpiumResell = {x=2331.0881347656,y=2570.2250976562,z=46.681819915772} -} \ No newline at end of file +} From 38206e438ac5930338a36cfc1391d2da61ad2bd1 Mon Sep 17 00:00:00 2001 From: Coro Veneno Date: Tue, 12 Sep 2017 22:32:57 +0200 Subject: [PATCH 17/66] Create es.lua Added Spanish language Multi-language --- locales/es.lua | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 locales/es.lua diff --git a/locales/es.lua b/locales/es.lua new file mode 100644 index 00000000..d05f4e2b --- /dev/null +++ b/locales/es.lua @@ -0,0 +1,36 @@ +Locales['es'] = { + + ['press_collect_coke'] = 'Presiona ~INPUT_CONTEXT~ para cosechar la Coca', + ['press_process_coke'] = 'Presiona ~INPUT_CONTEXT~ para tratar la Coca', + ['press_sell_coke'] = 'Presiona ~INPUT_CONTEXT~ para vender la Coca', + ['press_collect_meth'] = 'Presiona ~INPUT_CONTEXT~ para recoger ingredientes del LSD', + ['press_process_meth'] = 'Presiona ~INPUT_CONTEXT~ para cocinar el LSD', + ['press_sell_meth'] = 'Presiona ~INPUT_CONTEXT~ para vender el LSD', + ['press_collect_weed'] = 'Presiona ~INPUT_CONTEXT~ para cosechar el Hierbón', + ['press_process_weed'] = 'Presiona ~INPUT_CONTEXT~ para embolsar el Hierbón', + ['press_sell_weed'] = 'Presiona ~INPUT_CONTEXT~ para vender el Hierbón', + ['press_collect_opium'] = "Presiona ~INPUT_CONTEXT~ para cosechar el Opio", + ['press_process_opium'] = "Presiona ~INPUT_CONTEXT~ para tratar el Opio", + ['press_sell_opium'] = "Presiona ~INPUT_CONTEXT~ para vender el Opio", + ['act_imp_police'] = 'Acción ~r~imposible~s~, ~b~policias~s~: ', + ['inv_full_coke'] = 'No puedes recoger mas cocaina, tu inventario está ~r~lleno~s~', + ['pickup_in_prog'] = '~y~Recogida en curso~s~...', + ['too_many_pouches'] = 'Tienes demasiadas bolsas', + ['not_enough_coke'] = 'No tienes suficiente hoja de coca para ~r~fabricar~s~', + ['packing_in_prog'] = '~y~Fabricación en curso~s~...', + ['no_pouches_sale'] = 'No tienes mas bolsas para ~r~vender~s~', + ['sold_one_coke'] = 'Has vendido ~g~1 Gramo de Coca~s~', + ['sale_in_prog'] = '~g~Venta en curso~s~...', + ['inv_full_meth'] = 'No puedes recoger mas ingredientes, tu inventario está ~r~lleno~s~', + ['not_enough_meth'] = 'No tienes suficientes ingredientes para ~r~fabricar~s~ mas LSD', + ['sold_one_meth'] = 'Has vendido ~g~1 Bote de LSD~s~', + ['inv_full_weed'] = 'No puedes recoger mas hierba, tu inventario está ~r~lleno~s~', + ['not_enough_weed'] = 'No tienes suficiente hierba para ~r~embolsar~s~', + ['sold_one_weed'] = 'Has vendido ~g~1 Bolsa de Hierbón~s~', + ['used_one_weed'] = 'Has gastado una bolsa de ~b~hierbón', + ['inv_full_opium'] = 'No puedes recoger mas hierba, tu inventario está ~r~lleno~s~', + ['not_enough_opium'] = 'No tienes sufiente Opio para ~r~fabricar~s~', + ['sold_one_opium'] = 'Has vendido ~g~1 Bolsa de Opio~s~', + ['used_one_opium'] = 'Has gastado una bolsa de ~b~Opio', + +} From 7ce1c507789a6bb088f63ac48608f1523ab7dee7 Mon Sep 17 00:00:00 2001 From: Coro Veneno Date: Tue, 12 Sep 2017 23:06:46 +0200 Subject: [PATCH 18/66] Update Spanish language Added Spanish Language --- __resource.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/__resource.lua b/__resource.lua index ac31d644..887b58ce 100644 --- a/__resource.lua +++ b/__resource.lua @@ -5,8 +5,9 @@ server_scripts { '@es_extended/locale.lua', 'locales/de.lua', 'locales/br.lua', - 'locales/en.lua', - 'locales/fr.lua', + 'locales/en.lua', + 'locales/fr.lua', + 'locales/es.lua', 'server/esx_drugs_sv.lua', 'config.lua' @@ -17,9 +18,10 @@ client_scripts { '@es_extended/locale.lua', 'locales/de.lua', 'locales/br.lua', - 'locales/en.lua', - 'locales/fr.lua', + 'locales/en.lua', + 'locales/fr.lua', + 'locales/es.lua', 'config.lua', 'client/esx_drugs_cl.lua' -} \ No newline at end of file +} From 9f3064199cc9f7086f0a3830d5c754705d68260d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Fri, 15 Sep 2017 15:24:32 +0200 Subject: [PATCH 19/66] chore(resource): Add version --- __resource.lua | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/__resource.lua b/__resource.lua index 887b58ce..428f3ac2 100644 --- a/__resource.lua +++ b/__resource.lua @@ -1,27 +1,29 @@ description 'esx_drugs' +version '1.0.0' + server_scripts { - '@es_extended/locale.lua', + '@es_extended/locale.lua', 'locales/de.lua', 'locales/br.lua', 'locales/en.lua', 'locales/fr.lua', 'locales/es.lua', - 'server/esx_drugs_sv.lua', - 'config.lua' + 'server/esx_drugs_sv.lua', + 'config.lua' } client_scripts { - '@es_extended/locale.lua', + '@es_extended/locale.lua', 'locales/de.lua', 'locales/br.lua', 'locales/en.lua', 'locales/fr.lua', 'locales/es.lua', - 'config.lua', - 'client/esx_drugs_cl.lua' + 'config.lua', + 'client/esx_drugs_cl.lua' } From 12b19088259c15847073f0cd8a0b37ba56de6209 Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 22 Feb 2018 01:59:22 +0100 Subject: [PATCH 20/66] Fix message pack Error --- server/esx_drugs_sv.lua | 268 +++++++++++++++++++++------------------- 1 file changed, 139 insertions(+), 129 deletions(-) diff --git a/server/esx_drugs_sv.lua b/server/esx_drugs_sv.lua index ba8606aa..46a12ef3 100644 --- a/server/esx_drugs_sv.lua +++ b/server/esx_drugs_sv.lua @@ -35,26 +35,26 @@ end CountCops() --coke -local function HarvestCoke(source) +local function HarvestCoke(_source) if CopsConnected < Config.RequiredCopsCoke then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsCoke) + TriggerClientEvent('esx:showNotification', _source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsCoke) return end SetTimeout(5000, function() - if PlayersHarvestingCoke[source] == true then + if PlayersHarvestingCoke[_source] == true then - local xPlayer = ESX.GetPlayerFromId(source) + local xPlayer = ESX.GetPlayerFromId(_source) local coke = xPlayer.getInventoryItem('coke') if coke.limit ~= -1 and coke.count >= coke.limit then - TriggerClientEvent('esx:showNotification', source, _U('inv_full_coke')) + TriggerClientEvent('esx:showNotification', _source, _U('inv_full_coke')) else xPlayer.addInventoryItem('coke', 1) - HarvestCoke(source) + HarvestCoke(_source) end end @@ -64,7 +64,7 @@ end RegisterServerEvent('esx_drugs:startHarvestCoke') AddEventHandler('esx_drugs:startHarvestCoke', function() - local _source = source + local _source = _source PlayersHarvestingCoke[_source] = true @@ -77,37 +77,38 @@ end) RegisterServerEvent('esx_drugs:stopHarvestCoke') AddEventHandler('esx_drugs:stopHarvestCoke', function() - local _source = source + local _source = _source PlayersHarvestingCoke[_source] = false end) -local function TransformCoke(source) +local function TransformCoke(_source) if CopsConnected < Config.RequiredCopsCoke then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsCoke) + TriggerClientEvent('esx:showNotification', _source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsCoke) return end SetTimeout(10000, function() - if PlayersTransformingCoke[source] == true then + if PlayersTransformingCoke[_source] == true then - local xPlayer = ESX.GetPlayerFromId(source) + local _source = _source + local xPlayer = ESX.GetPlayerFromId(_source) local cokeQuantity = xPlayer.getInventoryItem('coke').count local poochQuantity = xPlayer.getInventoryItem('coke_pooch').count if poochQuantity > 35 then - TriggerClientEvent('esx:showNotification', source, _U('too_many_pouches')) + TriggerClientEvent('esx:showNotification', _source, _U('too_many_pouches')) elseif cokeQuantity < 5 then - TriggerClientEvent('esx:showNotification', source, _U('not_enough_coke')) + TriggerClientEvent('esx:showNotification', _source, _U('not_enough_coke')) else xPlayer.removeInventoryItem('coke', 5) xPlayer.addInventoryItem('coke_pooch', 1) - TransformCoke(source) + TransformCoke(_source) end end @@ -117,7 +118,7 @@ end RegisterServerEvent('esx_drugs:startTransformCoke') AddEventHandler('esx_drugs:startTransformCoke', function() - local _source = source + local _source = _source PlayersTransformingCoke[_source] = true @@ -130,52 +131,53 @@ end) RegisterServerEvent('esx_drugs:stopTransformCoke') AddEventHandler('esx_drugs:stopTransformCoke', function() - local _source = source + local _source = _source PlayersTransformingCoke[_source] = false end) -local function SellCoke(source) +local function SellCoke(_source) if CopsConnected < Config.RequiredCopsCoke then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsCoke) + TriggerClientEvent('esx:showNotification', _source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsCoke) return end SetTimeout(7500, function() - if PlayersSellingCoke[source] == true then + if PlayersSellingCoke[_source] == true then - local xPlayer = ESX.GetPlayerFromId(source) + local _source = _source + local xPlayer = ESX.GetPlayerFromId(_source) local poochQuantity = xPlayer.getInventoryItem('coke_pooch').count if poochQuantity == 0 then - TriggerClientEvent('esx:showNotification', source, _U('no_pouches_sale')) + TriggerClientEvent('esx:showNotification', _source, _U('no_pouches_sale')) else xPlayer.removeInventoryItem('coke_pooch', 1) if CopsConnected == 0 then xPlayer.addAccountMoney('black_money', 198) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) + TriggerClientEvent('esx:showNotification', _source, _U('sold_one_coke')) elseif CopsConnected == 1 then xPlayer.addAccountMoney('black_money', 258) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) + TriggerClientEvent('esx:showNotification', _source, _U('sold_one_coke')) elseif CopsConnected == 2 then xPlayer.addAccountMoney('black_money', 308) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) + TriggerClientEvent('esx:showNotification', _source, _U('sold_one_coke')) elseif CopsConnected == 3 then xPlayer.addAccountMoney('black_money', 358) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) + TriggerClientEvent('esx:showNotification', _source, _U('sold_one_coke')) elseif CopsConnected == 4 then xPlayer.addAccountMoney('black_money', 396) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) + TriggerClientEvent('esx:showNotification', _source, _U('sold_one_coke')) elseif CopsConnected >= 5 then xPlayer.addAccountMoney('black_money', 428) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) + TriggerClientEvent('esx:showNotification', _source, _U('sold_one_coke')) end - SellCoke(source) + SellCoke(_source) end end @@ -185,7 +187,7 @@ end RegisterServerEvent('esx_drugs:startSellCoke') AddEventHandler('esx_drugs:startSellCoke', function() - local _source = source + local _source = _source PlayersSellingCoke[_source] = true @@ -198,33 +200,34 @@ end) RegisterServerEvent('esx_drugs:stopSellCoke') AddEventHandler('esx_drugs:stopSellCoke', function() - local _source = source + local _source = _source PlayersSellingCoke[_source] = false end) --meth -local function HarvestMeth(source) +local function HarvestMeth(_source) if CopsConnected < Config.RequiredCopsMeth then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsMeth) + TriggerClientEvent('esx:showNotification', _source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsMeth) return end SetTimeout(5000, function() - if PlayersHarvestingMeth[source] == true then + if PlayersHarvestingMeth[_source] == true then - local xPlayer = ESX.GetPlayerFromId(source) + local _source = _source + local xPlayer = ESX.GetPlayerFromId(_source) local meth = xPlayer.getInventoryItem('meth') if meth.limit ~= -1 and meth.count >= meth.limit then - TriggerClientEvent('esx:showNotification', source, _U('inv_full_meth')) + TriggerClientEvent('esx:showNotification', _source, _U('inv_full_meth')) else xPlayer.addInventoryItem('meth', 1) - HarvestMeth(source) + HarvestMeth(_source) end end @@ -234,7 +237,7 @@ end RegisterServerEvent('esx_drugs:startHarvestMeth') AddEventHandler('esx_drugs:startHarvestMeth', function() - local _source = source + local _source = _source PlayersHarvestingMeth[_source] = true @@ -247,37 +250,38 @@ end) RegisterServerEvent('esx_drugs:stopHarvestMeth') AddEventHandler('esx_drugs:stopHarvestMeth', function() - local _source = source + local _source = _source PlayersHarvestingMeth[_source] = false end) -local function TransformMeth(source) +local function TransformMeth(_source) if CopsConnected < Config.RequiredCopsMeth then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsMeth) + TriggerClientEvent('esx:showNotification', _source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsMeth) return end SetTimeout(12000, function() - if PlayersTransformingMeth[source] == true then + if PlayersTransformingMeth[_source] == true then - local xPlayer = ESX.GetPlayerFromId(source) + local _source = _source + local xPlayer = ESX.GetPlayerFromId(_source) local methQuantity = xPlayer.getInventoryItem('meth').count local poochQuantity = xPlayer.getInventoryItem('meth_pooch').count if poochQuantity > 35 then - TriggerClientEvent('esx:showNotification', source, _U('too_many_pouches')) + TriggerClientEvent('esx:showNotification', _source, _U('too_many_pouches')) elseif methQuantity < 5 then - TriggerClientEvent('esx:showNotification', source, _U('not_enough_meth')) + TriggerClientEvent('esx:showNotification', _source, _U('not_enough_meth')) else xPlayer.removeInventoryItem('meth', 5) xPlayer.addInventoryItem('meth_pooch', 1) - TransformMeth(source) + TransformMeth(_source) end end @@ -287,7 +291,7 @@ end RegisterServerEvent('esx_drugs:startTransformMeth') AddEventHandler('esx_drugs:startTransformMeth', function() - local _source = source + local _source = _source PlayersTransformingMeth[_source] = true @@ -300,55 +304,56 @@ end) RegisterServerEvent('esx_drugs:stopTransformMeth') AddEventHandler('esx_drugs:stopTransformMeth', function() - local _source = source + local _source = _source PlayersTransformingMeth[_source] = false end) -local function SellMeth(source) +local function SellMeth(_source) if CopsConnected < Config.RequiredCopsMeth then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsMeth) + TriggerClientEvent('esx:showNotification', _source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsMeth) return end SetTimeout(7500, function() - if PlayersSellingMeth[source] == true then + if PlayersSellingMeth[_source] == true then - local xPlayer = ESX.GetPlayerFromId(source) + local _source = _source + local xPlayer = ESX.GetPlayerFromId(_source) local poochQuantity = xPlayer.getInventoryItem('meth_pooch').count if poochQuantity == 0 then - TriggerClientEvent('esx:showNotification', source, _U('no_pouches_sale')) + TriggerClientEvent('esx:showNotification', _source, _U('no_pouches_sale')) else xPlayer.removeInventoryItem('meth_pooch', 1) if CopsConnected == 0 then xPlayer.addAccountMoney('black_money', 276) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) + TriggerClientEvent('esx:showNotification', _source, _U('sold_one_meth')) elseif CopsConnected == 1 then xPlayer.addAccountMoney('black_money', 374) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) + TriggerClientEvent('esx:showNotification', _source, _U('sold_one_meth')) elseif CopsConnected == 2 then xPlayer.addAccountMoney('black_money', 474) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) + TriggerClientEvent('esx:showNotification', _source, _U('sold_one_meth')) elseif CopsConnected == 3 then xPlayer.addAccountMoney('black_money', 552) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) + TriggerClientEvent('esx:showNotification', _source, _U('sold_one_meth')) elseif CopsConnected == 4 then xPlayer.addAccountMoney('black_money', 616) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) + TriggerClientEvent('esx:showNotification', _source, _U('sold_one_meth')) elseif CopsConnected == 5 then xPlayer.addAccountMoney('black_money', 654) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) + TriggerClientEvent('esx:showNotification', _source, _U('sold_one_meth')) elseif CopsConnected >= 6 then xPlayer.addAccountMoney('black_money', 686) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) + TriggerClientEvent('esx:showNotification', _source, _U('sold_one_meth')) end - SellMeth(source) + SellMeth(_source) end end @@ -358,7 +363,7 @@ end RegisterServerEvent('esx_drugs:startSellMeth') AddEventHandler('esx_drugs:startSellMeth', function() - local _source = source + local _source = _source PlayersSellingMeth[_source] = true @@ -371,33 +376,34 @@ end) RegisterServerEvent('esx_drugs:stopSellMeth') AddEventHandler('esx_drugs:stopSellMeth', function() - local _source = source + local _source = _source PlayersSellingMeth[_source] = false end) --weed -local function HarvestWeed(source) +local function HarvestWeed(_source) if CopsConnected < Config.RequiredCopsWeed then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsWeed) + TriggerClientEvent('esx:showNotification', _source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsWeed) return end SetTimeout(5000, function() - if PlayersHarvestingWeed[source] == true then + if PlayersHarvestingWeed[_source] == true then - local xPlayer = ESX.GetPlayerFromId(source) + local _source = _source + local xPlayer = ESX.GetPlayerFromId(_source) local weed = xPlayer.getInventoryItem('weed') if weed.limit ~= -1 and weed.count >= weed.limit then - TriggerClientEvent('esx:showNotification', source, _U('inv_full_weed')) + TriggerClientEvent('esx:showNotification', _source, _U('inv_full_weed')) else xPlayer.addInventoryItem('weed', 1) - HarvestWeed(source) + HarvestWeed(_source) end end @@ -407,7 +413,7 @@ end RegisterServerEvent('esx_drugs:startHarvestWeed') AddEventHandler('esx_drugs:startHarvestWeed', function() - local _source = source + local _source = _source PlayersHarvestingWeed[_source] = true @@ -420,37 +426,37 @@ end) RegisterServerEvent('esx_drugs:stopHarvestWeed') AddEventHandler('esx_drugs:stopHarvestWeed', function() - local _source = source + local _source = _source PlayersHarvestingWeed[_source] = false end) -local function TransformWeed(source) +local function TransformWeed(_source) if CopsConnected < Config.RequiredCopsWeed then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsWeed) + TriggerClientEvent('esx:showNotification', _source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsWeed) return end SetTimeout(7500, function() - if PlayersTransformingWeed[source] == true then - - local xPlayer = ESX.GetPlayerFromId(source) + if PlayersTransformingWeed[_source] == true then + local _source = _source + local xPlayer = ESX.GetPlayerFromId(_source) local weedQuantity = xPlayer.getInventoryItem('weed').count local poochQuantity = xPlayer.getInventoryItem('weed_pooch').count if poochQuantity > 35 then - TriggerClientEvent('esx:showNotification', source, _U('too_many_pouches')) + TriggerClientEvent('esx:showNotification', _source, _U('too_many_pouches')) elseif weedQuantity < 5 then - TriggerClientEvent('esx:showNotification', source, _U('not_enough_weed')) + TriggerClientEvent('esx:showNotification', _source, _U('not_enough_weed')) else xPlayer.removeInventoryItem('weed', 5) xPlayer.addInventoryItem('weed_pooch', 1) - TransformWeed(source) + TransformWeed(_source) end end @@ -460,7 +466,7 @@ end RegisterServerEvent('esx_drugs:startTransformWeed') AddEventHandler('esx_drugs:startTransformWeed', function() - local _source = source + local _source = _source PlayersTransformingWeed[_source] = true @@ -473,49 +479,50 @@ end) RegisterServerEvent('esx_drugs:stopTransformWeed') AddEventHandler('esx_drugs:stopTransformWeed', function() - local _source = source + local _source = _source PlayersTransformingWeed[_source] = false end) -local function SellWeed(source) +local function SellWeed(_source) if CopsConnected < Config.RequiredCopsWeed then - TriggerClientEvent('esx_weedjob:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsWeed) + TriggerClientEvent('esx_weedjob:showNotification', _source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsWeed) return end SetTimeout(7500, function() - if PlayersSellingWeed[source] == true then + if PlayersSellingWeed[_source] == true then - local xPlayer = ESX.GetPlayerFromId(source) + local _source = _source + local xPlayer = ESX.GetPlayerFromId(_source) local poochQuantity = xPlayer.getInventoryItem('weed_pooch').count if poochQuantity == 0 then - TriggerClientEvent('esx:showNotification', source, _U('no_pouches_sale')) + TriggerClientEvent('esx:showNotification', _source, _U('no_pouches_sale')) else xPlayer.removeInventoryItem('weed_pooch', 1) if CopsConnected == 0 then xPlayer.addAccountMoney('black_money', 108) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_weed')) + TriggerClientEvent('esx:showNotification', _source, _U('sold_one_weed')) elseif CopsConnected == 1 then xPlayer.addAccountMoney('black_money', 128) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_weed')) + TriggerClientEvent('esx:showNotification', _source, _U('sold_one_weed')) elseif CopsConnected == 2 then xPlayer.addAccountMoney('black_money', 152) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_weed')) + TriggerClientEvent('esx:showNotification', _source, _U('sold_one_weed')) elseif CopsConnected == 3 then xPlayer.addAccountMoney('black_money', 165) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_weed')) + TriggerClientEvent('esx:showNotification', _source, _U('sold_one_weed')) elseif CopsConnected >= 4 then xPlayer.addAccountMoney('black_money', 180) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_weed')) + TriggerClientEvent('esx:showNotification', _source, _U('sold_one_weed')) end - SellWeed(source) + SellWeed(_source) end end @@ -525,7 +532,7 @@ end RegisterServerEvent('esx_drugs:startSellWeed') AddEventHandler('esx_drugs:startSellWeed', function() - local _source = source + local _source = _source PlayersSellingWeed[_source] = true @@ -538,7 +545,7 @@ end) RegisterServerEvent('esx_drugs:stopSellWeed') AddEventHandler('esx_drugs:stopSellWeed', function() - local _source = source + local _source = _source PlayersSellingWeed[_source] = false @@ -547,26 +554,27 @@ end) --opium -local function HarvestOpium(source) +local function HarvestOpium(_source) if CopsConnected < Config.RequiredCopsOpium then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsOpium) + TriggerClientEvent('esx:showNotification', _source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsOpium) return end SetTimeout(5000, function() - if PlayersHarvestingOpium[source] == true then + if PlayersHarvestingOpium[_source] == true then - local xPlayer = ESX.GetPlayerFromId(source) + local _source = _source + local xPlayer = ESX.GetPlayerFromId(_source) local opium = xPlayer.getInventoryItem('opium') if opium.limit ~= -1 and opium.count >= opium.limit then - TriggerClientEvent('esx:showNotification', source, _U('inv_full_opium')) + TriggerClientEvent('esx:showNotification', _source, _U('inv_full_opium')) else xPlayer.addInventoryItem('opium', 1) - HarvestOpium(source) + HarvestOpium(_source) end end @@ -576,7 +584,7 @@ end RegisterServerEvent('esx_drugs:startHarvestOpium') AddEventHandler('esx_drugs:startHarvestOpium', function() - local _source = source + local _source = _source PlayersHarvestingOpium[_source] = true @@ -589,37 +597,38 @@ end) RegisterServerEvent('esx_drugs:stopHarvestOpium') AddEventHandler('esx_drugs:stopHarvestOpium', function() - local _source = source + local _source = _source PlayersHarvestingOpium[_source] = false end) -local function TransformOpium(source) +local function TransformOpium(_source) if CopsConnected < Config.RequiredCopsOpium then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsOpium) + TriggerClientEvent('esx:showNotification', _source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsOpium) return end SetTimeout(10000, function() - if PlayersTransformingOpium[source] == true then + if PlayersTransformingOpium[_source] == true then - local xPlayer = ESX.GetPlayerFromId(source) + local _source = _source + local xPlayer = ESX.GetPlayerFromId(_source) local opiumQuantity = xPlayer.getInventoryItem('opium').count local poochQuantity = xPlayer.getInventoryItem('opium_pooch').count if poochQuantity > 35 then - TriggerClientEvent('esx:showNotification', source, _U('too_many_pouches')) + TriggerClientEvent('esx:showNotification', _source, _U('too_many_pouches')) elseif opiumQuantity < 5 then - TriggerClientEvent('esx:showNotification', source, _U('not_enough_opium')) + TriggerClientEvent('esx:showNotification', _source, _U('not_enough_opium')) else xPlayer.removeInventoryItem('opium', 5) xPlayer.addInventoryItem('opium_pooch', 1) - TransformOpium(source) + TransformOpium(_source) end end @@ -629,7 +638,7 @@ end RegisterServerEvent('esx_drugs:startTransformOpium') AddEventHandler('esx_drugs:startTransformOpium', function() - local _source = source + local _source = _source PlayersTransformingOpium[_source] = true @@ -642,52 +651,53 @@ end) RegisterServerEvent('esx_drugs:stopTransformOpium') AddEventHandler('esx_drugs:stopTransformOpium', function() - local _source = source + local _source = _source PlayersTransformingOpium[_source] = false end) -local function SellOpium(source) +local function SellOpium(_source) if CopsConnected < Config.RequiredCopsOpium then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsOpium) + TriggerClientEvent('esx:showNotification', _source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsOpium) return end SetTimeout(7500, function() - if PlayersSellingOpium[source] == true then + if PlayersSellingOpium[_source] == true then - local xPlayer = ESX.GetPlayerFromId(source) + local _source = _source + local xPlayer = ESX.GetPlayerFromId(_source) local poochQuantity = xPlayer.getInventoryItem('opium_pooch').count if poochQuantity == 0 then - TriggerClientEvent('esx:showNotification', source, _U('no_pouches_sale')) + TriggerClientEvent('esx:showNotification', _source, _U('no_pouches_sale')) else xPlayer.removeInventoryItem('opium_pooch', 1) if CopsConnected == 0 then xPlayer.addAccountMoney('black_money', 300) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) + TriggerClientEvent('esx:showNotification', _source, _U('sold_one_opium')) elseif CopsConnected == 1 then xPlayer.addAccountMoney('black_money', 500) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) + TriggerClientEvent('esx:showNotification', _source, _U('sold_one_opium')) elseif CopsConnected == 2 then xPlayer.addAccountMoney('black_money', 700) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) + TriggerClientEvent('esx:showNotification', _source, _U('sold_one_opium')) elseif CopsConnected == 3 then xPlayer.addAccountMoney('black_money', 800) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) + TriggerClientEvent('esx:showNotification', _source, _U('sold_one_opium')) elseif CopsConnected == 4 then xPlayer.addAccountMoney('black_money', 900) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) + TriggerClientEvent('esx:showNotification', _source, _U('sold_one_opium')) elseif CopsConnected >= 5 then xPlayer.addAccountMoney('black_money', 1000) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) + TriggerClientEvent('esx:showNotification', _source, _U('sold_one_opium')) end - SellOpium(source) + SellOpium(_source) end end @@ -697,7 +707,7 @@ end RegisterServerEvent('esx_drugs:startSellOpium') AddEventHandler('esx_drugs:startSellOpium', function() - local _source = source + local _source = _source PlayersSellingOpium[_source] = true @@ -710,7 +720,7 @@ end) RegisterServerEvent('esx_drugs:stopSellOpium') AddEventHandler('esx_drugs:stopSellOpium', function() - local _source = source + local _source = _source PlayersSellingOpium[_source] = false @@ -720,7 +730,7 @@ end) -- RETURN INVENTORY TO CLIENT RegisterServerEvent('esx_drugs:GetUserInventory') AddEventHandler('esx_drugs:GetUserInventory', function(currentZone) - local _source = source + local _source = _source local xPlayer = ESX.GetPlayerFromId(_source) TriggerClientEvent('esx_drugs:ReturnInventory', _source, @@ -738,10 +748,10 @@ AddEventHandler('esx_drugs:GetUserInventory', function(currentZone) end) -- Register Usable Item -ESX.RegisterUsableItem('weed', function(source) +ESX.RegisterUsableItem('weed', function(_source) - local _source = source - local xPlayer = ESX.GetPlayerFromId(source) + local _source = _source + local xPlayer = ESX.GetPlayerFromId(_source) xPlayer.removeInventoryItem('weed', 1) From 7381a69d2d326906eaddab3aeee8b6b0108e7958 Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 22 Feb 2018 02:05:45 +0100 Subject: [PATCH 21/66] fix v2 --- server/esx_drugs_sv.lua | 254 ++++++++++++++++++++-------------------- 1 file changed, 127 insertions(+), 127 deletions(-) diff --git a/server/esx_drugs_sv.lua b/server/esx_drugs_sv.lua index 46a12ef3..2e660177 100644 --- a/server/esx_drugs_sv.lua +++ b/server/esx_drugs_sv.lua @@ -35,26 +35,26 @@ end CountCops() --coke -local function HarvestCoke(_source) +local function HarvestCoke(source) if CopsConnected < Config.RequiredCopsCoke then - TriggerClientEvent('esx:showNotification', _source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsCoke) + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsCoke) return end SetTimeout(5000, function() - if PlayersHarvestingCoke[_source] == true then + if PlayersHarvestingCoke[source] == true then - local xPlayer = ESX.GetPlayerFromId(_source) + local xPlayer = ESX.GetPlayerFromId(source) local coke = xPlayer.getInventoryItem('coke') if coke.limit ~= -1 and coke.count >= coke.limit then - TriggerClientEvent('esx:showNotification', _source, _U('inv_full_coke')) + TriggerClientEvent('esx:showNotification', source, _U('inv_full_coke')) else xPlayer.addInventoryItem('coke', 1) - HarvestCoke(_source) + HarvestCoke(source) end end @@ -64,7 +64,7 @@ end RegisterServerEvent('esx_drugs:startHarvestCoke') AddEventHandler('esx_drugs:startHarvestCoke', function() - local _source = _source + local _source = source PlayersHarvestingCoke[_source] = true @@ -77,38 +77,38 @@ end) RegisterServerEvent('esx_drugs:stopHarvestCoke') AddEventHandler('esx_drugs:stopHarvestCoke', function() - local _source = _source + local _source = source PlayersHarvestingCoke[_source] = false end) -local function TransformCoke(_source) +local function TransformCoke(source) if CopsConnected < Config.RequiredCopsCoke then - TriggerClientEvent('esx:showNotification', _source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsCoke) + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsCoke) return end SetTimeout(10000, function() - if PlayersTransformingCoke[_source] == true then + if PlayersTransformingCoke[source] == true then - local _source = _source + local _source = source local xPlayer = ESX.GetPlayerFromId(_source) local cokeQuantity = xPlayer.getInventoryItem('coke').count local poochQuantity = xPlayer.getInventoryItem('coke_pooch').count if poochQuantity > 35 then - TriggerClientEvent('esx:showNotification', _source, _U('too_many_pouches')) + TriggerClientEvent('esx:showNotification', source, _U('too_many_pouches')) elseif cokeQuantity < 5 then - TriggerClientEvent('esx:showNotification', _source, _U('not_enough_coke')) + TriggerClientEvent('esx:showNotification', source, _U('not_enough_coke')) else xPlayer.removeInventoryItem('coke', 5) xPlayer.addInventoryItem('coke_pooch', 1) - TransformCoke(_source) + TransformCoke(source) end end @@ -118,7 +118,7 @@ end RegisterServerEvent('esx_drugs:startTransformCoke') AddEventHandler('esx_drugs:startTransformCoke', function() - local _source = _source + local _source = source PlayersTransformingCoke[_source] = true @@ -131,53 +131,53 @@ end) RegisterServerEvent('esx_drugs:stopTransformCoke') AddEventHandler('esx_drugs:stopTransformCoke', function() - local _source = _source + local _source = source PlayersTransformingCoke[_source] = false end) -local function SellCoke(_source) +local function SellCoke(source) if CopsConnected < Config.RequiredCopsCoke then - TriggerClientEvent('esx:showNotification', _source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsCoke) + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsCoke) return end SetTimeout(7500, function() - if PlayersSellingCoke[_source] == true then + if PlayersSellingCoke[source] == true then - local _source = _source + local _source = source local xPlayer = ESX.GetPlayerFromId(_source) local poochQuantity = xPlayer.getInventoryItem('coke_pooch').count if poochQuantity == 0 then - TriggerClientEvent('esx:showNotification', _source, _U('no_pouches_sale')) + TriggerClientEvent('esx:showNotification', source, _U('no_pouches_sale')) else xPlayer.removeInventoryItem('coke_pooch', 1) if CopsConnected == 0 then xPlayer.addAccountMoney('black_money', 198) - TriggerClientEvent('esx:showNotification', _source, _U('sold_one_coke')) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) elseif CopsConnected == 1 then xPlayer.addAccountMoney('black_money', 258) - TriggerClientEvent('esx:showNotification', _source, _U('sold_one_coke')) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) elseif CopsConnected == 2 then xPlayer.addAccountMoney('black_money', 308) - TriggerClientEvent('esx:showNotification', _source, _U('sold_one_coke')) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) elseif CopsConnected == 3 then xPlayer.addAccountMoney('black_money', 358) - TriggerClientEvent('esx:showNotification', _source, _U('sold_one_coke')) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) elseif CopsConnected == 4 then xPlayer.addAccountMoney('black_money', 396) - TriggerClientEvent('esx:showNotification', _source, _U('sold_one_coke')) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) elseif CopsConnected >= 5 then xPlayer.addAccountMoney('black_money', 428) - TriggerClientEvent('esx:showNotification', _source, _U('sold_one_coke')) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) end - SellCoke(_source) + SellCoke(source) end end @@ -187,7 +187,7 @@ end RegisterServerEvent('esx_drugs:startSellCoke') AddEventHandler('esx_drugs:startSellCoke', function() - local _source = _source + local _source = source PlayersSellingCoke[_source] = true @@ -200,34 +200,34 @@ end) RegisterServerEvent('esx_drugs:stopSellCoke') AddEventHandler('esx_drugs:stopSellCoke', function() - local _source = _source + local _source = source PlayersSellingCoke[_source] = false end) --meth -local function HarvestMeth(_source) +local function HarvestMeth(source) if CopsConnected < Config.RequiredCopsMeth then - TriggerClientEvent('esx:showNotification', _source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsMeth) + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsMeth) return end SetTimeout(5000, function() - if PlayersHarvestingMeth[_source] == true then + if PlayersHarvestingMeth[source] == true then - local _source = _source + local _source = source local xPlayer = ESX.GetPlayerFromId(_source) local meth = xPlayer.getInventoryItem('meth') if meth.limit ~= -1 and meth.count >= meth.limit then - TriggerClientEvent('esx:showNotification', _source, _U('inv_full_meth')) + TriggerClientEvent('esx:showNotification', source, _U('inv_full_meth')) else xPlayer.addInventoryItem('meth', 1) - HarvestMeth(_source) + HarvestMeth(source) end end @@ -237,7 +237,7 @@ end RegisterServerEvent('esx_drugs:startHarvestMeth') AddEventHandler('esx_drugs:startHarvestMeth', function() - local _source = _source + local _source = source PlayersHarvestingMeth[_source] = true @@ -250,38 +250,38 @@ end) RegisterServerEvent('esx_drugs:stopHarvestMeth') AddEventHandler('esx_drugs:stopHarvestMeth', function() - local _source = _source + local _source = source PlayersHarvestingMeth[_source] = false end) -local function TransformMeth(_source) +local function TransformMeth(source) if CopsConnected < Config.RequiredCopsMeth then - TriggerClientEvent('esx:showNotification', _source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsMeth) + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsMeth) return end SetTimeout(12000, function() - if PlayersTransformingMeth[_source] == true then + if PlayersTransformingMeth[source] == true then - local _source = _source + local _source = source local xPlayer = ESX.GetPlayerFromId(_source) local methQuantity = xPlayer.getInventoryItem('meth').count local poochQuantity = xPlayer.getInventoryItem('meth_pooch').count if poochQuantity > 35 then - TriggerClientEvent('esx:showNotification', _source, _U('too_many_pouches')) + TriggerClientEvent('esx:showNotification', source, _U('too_many_pouches')) elseif methQuantity < 5 then - TriggerClientEvent('esx:showNotification', _source, _U('not_enough_meth')) + TriggerClientEvent('esx:showNotification', source, _U('not_enough_meth')) else xPlayer.removeInventoryItem('meth', 5) xPlayer.addInventoryItem('meth_pooch', 1) - TransformMeth(_source) + TransformMeth(source) end end @@ -291,7 +291,7 @@ end RegisterServerEvent('esx_drugs:startTransformMeth') AddEventHandler('esx_drugs:startTransformMeth', function() - local _source = _source + local _source = source PlayersTransformingMeth[_source] = true @@ -304,24 +304,24 @@ end) RegisterServerEvent('esx_drugs:stopTransformMeth') AddEventHandler('esx_drugs:stopTransformMeth', function() - local _source = _source + local _source = source PlayersTransformingMeth[_source] = false end) -local function SellMeth(_source) +local function SellMeth(source) if CopsConnected < Config.RequiredCopsMeth then - TriggerClientEvent('esx:showNotification', _source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsMeth) + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsMeth) return end SetTimeout(7500, function() - if PlayersSellingMeth[_source] == true then + if PlayersSellingMeth[source] == true then - local _source = _source + local _source = source local xPlayer = ESX.GetPlayerFromId(_source) local poochQuantity = xPlayer.getInventoryItem('meth_pooch').count @@ -332,28 +332,28 @@ local function SellMeth(_source) xPlayer.removeInventoryItem('meth_pooch', 1) if CopsConnected == 0 then xPlayer.addAccountMoney('black_money', 276) - TriggerClientEvent('esx:showNotification', _source, _U('sold_one_meth')) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) elseif CopsConnected == 1 then xPlayer.addAccountMoney('black_money', 374) - TriggerClientEvent('esx:showNotification', _source, _U('sold_one_meth')) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) elseif CopsConnected == 2 then xPlayer.addAccountMoney('black_money', 474) - TriggerClientEvent('esx:showNotification', _source, _U('sold_one_meth')) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) elseif CopsConnected == 3 then xPlayer.addAccountMoney('black_money', 552) - TriggerClientEvent('esx:showNotification', _source, _U('sold_one_meth')) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) elseif CopsConnected == 4 then xPlayer.addAccountMoney('black_money', 616) - TriggerClientEvent('esx:showNotification', _source, _U('sold_one_meth')) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) elseif CopsConnected == 5 then xPlayer.addAccountMoney('black_money', 654) - TriggerClientEvent('esx:showNotification', _source, _U('sold_one_meth')) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) elseif CopsConnected >= 6 then xPlayer.addAccountMoney('black_money', 686) - TriggerClientEvent('esx:showNotification', _source, _U('sold_one_meth')) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) end - SellMeth(_source) + SellMeth(source) end end @@ -363,7 +363,7 @@ end RegisterServerEvent('esx_drugs:startSellMeth') AddEventHandler('esx_drugs:startSellMeth', function() - local _source = _source + local _source = source PlayersSellingMeth[_source] = true @@ -376,34 +376,34 @@ end) RegisterServerEvent('esx_drugs:stopSellMeth') AddEventHandler('esx_drugs:stopSellMeth', function() - local _source = _source + local _source = source PlayersSellingMeth[_source] = false end) --weed -local function HarvestWeed(_source) +local function HarvestWeed(source) if CopsConnected < Config.RequiredCopsWeed then - TriggerClientEvent('esx:showNotification', _source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsWeed) + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsWeed) return end SetTimeout(5000, function() - if PlayersHarvestingWeed[_source] == true then + if PlayersHarvestingWeed[source] == true then - local _source = _source + local _source = source local xPlayer = ESX.GetPlayerFromId(_source) local weed = xPlayer.getInventoryItem('weed') if weed.limit ~= -1 and weed.count >= weed.limit then - TriggerClientEvent('esx:showNotification', _source, _U('inv_full_weed')) + TriggerClientEvent('esx:showNotification', source, _U('inv_full_weed')) else xPlayer.addInventoryItem('weed', 1) - HarvestWeed(_source) + HarvestWeed(source) end end @@ -413,7 +413,7 @@ end RegisterServerEvent('esx_drugs:startHarvestWeed') AddEventHandler('esx_drugs:startHarvestWeed', function() - local _source = _source + local _source = source PlayersHarvestingWeed[_source] = true @@ -426,37 +426,37 @@ end) RegisterServerEvent('esx_drugs:stopHarvestWeed') AddEventHandler('esx_drugs:stopHarvestWeed', function() - local _source = _source + local _source = source PlayersHarvestingWeed[_source] = false end) -local function TransformWeed(_source) +local function TransformWeed(source) if CopsConnected < Config.RequiredCopsWeed then - TriggerClientEvent('esx:showNotification', _source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsWeed) + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsWeed) return end SetTimeout(7500, function() - if PlayersTransformingWeed[_source] == true then + if PlayersTransformingWeed[source] == true then - local _source = _source + local _source = source local xPlayer = ESX.GetPlayerFromId(_source) local weedQuantity = xPlayer.getInventoryItem('weed').count local poochQuantity = xPlayer.getInventoryItem('weed_pooch').count if poochQuantity > 35 then - TriggerClientEvent('esx:showNotification', _source, _U('too_many_pouches')) + TriggerClientEvent('esx:showNotification', source, _U('too_many_pouches')) elseif weedQuantity < 5 then - TriggerClientEvent('esx:showNotification', _source, _U('not_enough_weed')) + TriggerClientEvent('esx:showNotification', source, _U('not_enough_weed')) else xPlayer.removeInventoryItem('weed', 5) xPlayer.addInventoryItem('weed_pooch', 1) - TransformWeed(_source) + TransformWeed(source) end end @@ -466,7 +466,7 @@ end RegisterServerEvent('esx_drugs:startTransformWeed') AddEventHandler('esx_drugs:startTransformWeed', function() - local _source = _source + local _source = source PlayersTransformingWeed[_source] = true @@ -479,50 +479,50 @@ end) RegisterServerEvent('esx_drugs:stopTransformWeed') AddEventHandler('esx_drugs:stopTransformWeed', function() - local _source = _source + local _source = source PlayersTransformingWeed[_source] = false end) -local function SellWeed(_source) +local function SellWeed(source) if CopsConnected < Config.RequiredCopsWeed then - TriggerClientEvent('esx_weedjob:showNotification', _source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsWeed) + TriggerClientEvent('esx_weedjob:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsWeed) return end SetTimeout(7500, function() - if PlayersSellingWeed[_source] == true then + if PlayersSellingWeed[source] == true then - local _source = _source + local _source = source local xPlayer = ESX.GetPlayerFromId(_source) local poochQuantity = xPlayer.getInventoryItem('weed_pooch').count if poochQuantity == 0 then - TriggerClientEvent('esx:showNotification', _source, _U('no_pouches_sale')) + TriggerClientEvent('esx:showNotification', source, _U('no_pouches_sale')) else xPlayer.removeInventoryItem('weed_pooch', 1) if CopsConnected == 0 then xPlayer.addAccountMoney('black_money', 108) - TriggerClientEvent('esx:showNotification', _source, _U('sold_one_weed')) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_weed')) elseif CopsConnected == 1 then xPlayer.addAccountMoney('black_money', 128) - TriggerClientEvent('esx:showNotification', _source, _U('sold_one_weed')) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_weed')) elseif CopsConnected == 2 then xPlayer.addAccountMoney('black_money', 152) - TriggerClientEvent('esx:showNotification', _source, _U('sold_one_weed')) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_weed')) elseif CopsConnected == 3 then xPlayer.addAccountMoney('black_money', 165) - TriggerClientEvent('esx:showNotification', _source, _U('sold_one_weed')) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_weed')) elseif CopsConnected >= 4 then xPlayer.addAccountMoney('black_money', 180) - TriggerClientEvent('esx:showNotification', _source, _U('sold_one_weed')) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_weed')) end - SellWeed(_source) + SellWeed(source) end end @@ -532,7 +532,7 @@ end RegisterServerEvent('esx_drugs:startSellWeed') AddEventHandler('esx_drugs:startSellWeed', function() - local _source = _source + local _source = source PlayersSellingWeed[_source] = true @@ -545,7 +545,7 @@ end) RegisterServerEvent('esx_drugs:stopSellWeed') AddEventHandler('esx_drugs:stopSellWeed', function() - local _source = _source + local _source = source PlayersSellingWeed[_source] = false @@ -554,27 +554,27 @@ end) --opium -local function HarvestOpium(_source) +local function HarvestOpium(source) if CopsConnected < Config.RequiredCopsOpium then - TriggerClientEvent('esx:showNotification', _source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsOpium) + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsOpium) return end SetTimeout(5000, function() - if PlayersHarvestingOpium[_source] == true then + if PlayersHarvestingOpium[source] == true then - local _source = _source + local _source = source local xPlayer = ESX.GetPlayerFromId(_source) local opium = xPlayer.getInventoryItem('opium') if opium.limit ~= -1 and opium.count >= opium.limit then - TriggerClientEvent('esx:showNotification', _source, _U('inv_full_opium')) + TriggerClientEvent('esx:showNotification', source, _U('inv_full_opium')) else xPlayer.addInventoryItem('opium', 1) - HarvestOpium(_source) + HarvestOpium(source) end end @@ -584,7 +584,7 @@ end RegisterServerEvent('esx_drugs:startHarvestOpium') AddEventHandler('esx_drugs:startHarvestOpium', function() - local _source = _source + local _source = source PlayersHarvestingOpium[_source] = true @@ -597,38 +597,38 @@ end) RegisterServerEvent('esx_drugs:stopHarvestOpium') AddEventHandler('esx_drugs:stopHarvestOpium', function() - local _source = _source + local _source = source PlayersHarvestingOpium[_source] = false end) -local function TransformOpium(_source) +local function TransformOpium(source) if CopsConnected < Config.RequiredCopsOpium then - TriggerClientEvent('esx:showNotification', _source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsOpium) + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsOpium) return end SetTimeout(10000, function() - if PlayersTransformingOpium[_source] == true then + if PlayersTransformingOpium[source] == true then - local _source = _source + local _source = source local xPlayer = ESX.GetPlayerFromId(_source) local opiumQuantity = xPlayer.getInventoryItem('opium').count local poochQuantity = xPlayer.getInventoryItem('opium_pooch').count if poochQuantity > 35 then - TriggerClientEvent('esx:showNotification', _source, _U('too_many_pouches')) + TriggerClientEvent('esx:showNotification', source, _U('too_many_pouches')) elseif opiumQuantity < 5 then - TriggerClientEvent('esx:showNotification', _source, _U('not_enough_opium')) + TriggerClientEvent('esx:showNotification', source, _U('not_enough_opium')) else xPlayer.removeInventoryItem('opium', 5) xPlayer.addInventoryItem('opium_pooch', 1) - TransformOpium(_source) + TransformOpium(source) end end @@ -638,7 +638,7 @@ end RegisterServerEvent('esx_drugs:startTransformOpium') AddEventHandler('esx_drugs:startTransformOpium', function() - local _source = _source + local _source = source PlayersTransformingOpium[_source] = true @@ -651,53 +651,53 @@ end) RegisterServerEvent('esx_drugs:stopTransformOpium') AddEventHandler('esx_drugs:stopTransformOpium', function() - local _source = _source + local _source = source PlayersTransformingOpium[_source] = false end) -local function SellOpium(_source) +local function SellOpium(source) if CopsConnected < Config.RequiredCopsOpium then - TriggerClientEvent('esx:showNotification', _source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsOpium) + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsOpium) return end SetTimeout(7500, function() - if PlayersSellingOpium[_source] == true then + if PlayersSellingOpium[source] == true then - local _source = _source + local _source = source local xPlayer = ESX.GetPlayerFromId(_source) local poochQuantity = xPlayer.getInventoryItem('opium_pooch').count if poochQuantity == 0 then - TriggerClientEvent('esx:showNotification', _source, _U('no_pouches_sale')) + TriggerClientEvent('esx:showNotification', source, _U('no_pouches_sale')) else xPlayer.removeInventoryItem('opium_pooch', 1) if CopsConnected == 0 then xPlayer.addAccountMoney('black_money', 300) - TriggerClientEvent('esx:showNotification', _source, _U('sold_one_opium')) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) elseif CopsConnected == 1 then xPlayer.addAccountMoney('black_money', 500) - TriggerClientEvent('esx:showNotification', _source, _U('sold_one_opium')) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) elseif CopsConnected == 2 then xPlayer.addAccountMoney('black_money', 700) - TriggerClientEvent('esx:showNotification', _source, _U('sold_one_opium')) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) elseif CopsConnected == 3 then xPlayer.addAccountMoney('black_money', 800) - TriggerClientEvent('esx:showNotification', _source, _U('sold_one_opium')) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) elseif CopsConnected == 4 then xPlayer.addAccountMoney('black_money', 900) - TriggerClientEvent('esx:showNotification', _source, _U('sold_one_opium')) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) elseif CopsConnected >= 5 then xPlayer.addAccountMoney('black_money', 1000) - TriggerClientEvent('esx:showNotification', _source, _U('sold_one_opium')) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) end - SellOpium(_source) + SellOpium(source) end end @@ -707,7 +707,7 @@ end RegisterServerEvent('esx_drugs:startSellOpium') AddEventHandler('esx_drugs:startSellOpium', function() - local _source = _source + local _source = source PlayersSellingOpium[_source] = true @@ -720,7 +720,7 @@ end) RegisterServerEvent('esx_drugs:stopSellOpium') AddEventHandler('esx_drugs:stopSellOpium', function() - local _source = _source + local _source = source PlayersSellingOpium[_source] = false @@ -730,7 +730,7 @@ end) -- RETURN INVENTORY TO CLIENT RegisterServerEvent('esx_drugs:GetUserInventory') AddEventHandler('esx_drugs:GetUserInventory', function(currentZone) - local _source = _source + local _source = source local xPlayer = ESX.GetPlayerFromId(_source) TriggerClientEvent('esx_drugs:ReturnInventory', _source, @@ -748,10 +748,10 @@ AddEventHandler('esx_drugs:GetUserInventory', function(currentZone) end) -- Register Usable Item -ESX.RegisterUsableItem('weed', function(_source) +ESX.RegisterUsableItem('weed', function(source) - local _source = _source - local xPlayer = ESX.GetPlayerFromId(_source) + local _source = source + local xPlayer = ESX.GetPlayerFromId(source) xPlayer.removeInventoryItem('weed', 1) From ef543d68327b37a89d1e6d2e642b977f404a90e6 Mon Sep 17 00:00:00 2001 From: MHL1337 Date: Sat, 14 Apr 2018 20:11:29 +0200 Subject: [PATCH 22/66] Added Swedish translation -Added Swedish translation in locales -Added Swedish translation in sv_esx_drugs.sql -Updated __rescource.lua --- __resource.lua | 2 ++ locales/sv.lua | 36 ++++++++++++++++++++++++++++++++++++ sv_esx_drugs.sql | 10 ++++++++++ 3 files changed, 48 insertions(+) create mode 100644 locales/sv.lua create mode 100644 sv_esx_drugs.sql diff --git a/__resource.lua b/__resource.lua index 428f3ac2..0c585200 100644 --- a/__resource.lua +++ b/__resource.lua @@ -10,6 +10,7 @@ server_scripts { 'locales/en.lua', 'locales/fr.lua', 'locales/es.lua', + 'locales/sv.lua', 'server/esx_drugs_sv.lua', 'config.lua' @@ -23,6 +24,7 @@ client_scripts { 'locales/en.lua', 'locales/fr.lua', 'locales/es.lua', + 'locales/sv.lua', 'config.lua', 'client/esx_drugs_cl.lua' diff --git a/locales/sv.lua b/locales/sv.lua new file mode 100644 index 00000000..0794d6ba --- /dev/null +++ b/locales/sv.lua @@ -0,0 +1,36 @@ +Locales['en'] = { + + ['press_collect_coke'] = 'klicka ~INPUT_CONTEXT~ för att plocka coke', + ['press_process_coke'] = 'klicka ~INPUT_CONTEXT~ för att bearbeta coke', + ['press_sell_coke'] = 'klicka ~INPUT_CONTEXT~ för att sälja coke', + ['press_collect_meth'] = 'klicka ~INPUT_CONTEXT~ för att plocka meth', + ['press_process_meth'] = 'klicka ~INPUT_CONTEXT~ för att bearbeta meth', + ['press_sell_meth'] = 'klicka ~INPUT_CONTEXT~ för att sälja meth', + ['press_collect_weed'] = 'klicka ~INPUT_CONTEXT~ för att plocka weed', + ['press_process_weed'] = 'klicka ~INPUT_CONTEXT~ för att bearbeta weed', + ['press_sell_weed'] = 'klicka ~INPUT_CONTEXT~ för att sälja weed', + ['press_collect_opium'] = 'klicka ~INPUT_CONTEXT~ för att plocka opium', + ['press_process_opium'] = 'klicka ~INPUT_CONTEXT~ för att bearbeta opium', + ['press_sell_opium'] = 'klicka ~INPUT_CONTEXT~ för att sälja opium', + ['act_imp_police'] = 'handling ~r~omöjlig~s~, ~b~polis~s~: ', + ['inv_full_coke'] = 'Du kan inte längre plocka coke, ditt inventory är ~r~fullt~s~', + ['pickup_in_prog'] = '~y~Plockning pågår~s~...', + ['too_many_pouches'] = 'Du har för många väskor', + ['not_enough_coke'] = 'Du har inte tillräckligt coke för att ~r~bearbeta~s~', + ['packing_in_prog'] = '~y~Förpackning pågår~s~...', + ['no_pouchs_sale'] = 'Du har inga mer väskor att ~r~sälja~s~', + ['sold_one_coke'] = 'Du har sålt ~g~x1 väska med coke~s~', + ['sale_in_prog'] = '~g~Försäljning pågår~s~...', + ['inv_full_meth'] = 'Du kan inte längre plocka Meth ditt inventory är ~r~fullt~s~', + ['not_enough_meth'] = 'Du har inte tillräckligt Meth för att ~r~bearbeta~s~', + ['sold_one_meth'] = 'Du har sålt ~g~x1 väska med meth~s~', + ['inv_full_weed'] = 'Du kan inte längre plocka Meth, ditt inventory är ~r~fullt~s~', + ['not_enough_weed'] = 'Du har inte tillräckligt med weed för att ~r~bearbeta~s~', + ['sold_one_weed'] = 'Du har sålt ~g~x1 väska med weed~s~', + ['used_one_weed'] = 'Du använde 1 väska ~b~weed', + ['inv_full_opium'] = 'Du kan inte längre plocka opium, ditt inventory är ~r~fullt~s~', + ['not_enough_opium'] = 'Du har inte tillräckligt opium för att ~r~bearbeta~s~', + ['sold_one_opium'] = 'Du har sålt ~g~x1 väska med opium~s~', + ['used_one_opium'] = 'Du använde 1 väska ~b~opium', + +} \ No newline at end of file diff --git a/sv_esx_drugs.sql b/sv_esx_drugs.sql new file mode 100644 index 00000000..4c2bc2fc --- /dev/null +++ b/sv_esx_drugs.sql @@ -0,0 +1,10 @@ +INSERT INTO `items` (name, label) VALUES + ('weed', 'Weed'), + ('weed_pooch', 'Väska med weed'), + ('coke', 'Coke'), + ('coke_pooch', 'väska med coke'), + ('meth', 'Meth'), + ('meth_pooch', 'väska med meth'), + ('opium', 'Opium'), + ('opium_pooch', 'väska med opium') +; \ No newline at end of file From 3dcad2e1dc4a23264d856441437d5db2519bcdb0 Mon Sep 17 00:00:00 2001 From: MHL1337 Date: Sat, 14 Apr 2018 20:20:59 +0200 Subject: [PATCH 23/66] updated sv.lua Forgot to update Locales['sv'] --- locales/sv.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locales/sv.lua b/locales/sv.lua index 0794d6ba..65fc42c7 100644 --- a/locales/sv.lua +++ b/locales/sv.lua @@ -1,4 +1,4 @@ -Locales['en'] = { +Locales['sv'] = { ['press_collect_coke'] = 'klicka ~INPUT_CONTEXT~ för att plocka coke', ['press_process_coke'] = 'klicka ~INPUT_CONTEXT~ för att bearbeta coke', @@ -33,4 +33,4 @@ Locales['en'] = { ['sold_one_opium'] = 'Du har sålt ~g~x1 väska med opium~s~', ['used_one_opium'] = 'Du använde 1 väska ~b~opium', -} \ No newline at end of file +} From a32713439fd3f690621d2c1dd7905bb3bedaac6a Mon Sep 17 00:00:00 2001 From: MHL1337 Date: Sat, 14 Apr 2018 21:14:18 +0200 Subject: [PATCH 24/66] changed some stuff --- sv_esx_drugs.sql | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sv_esx_drugs.sql b/sv_esx_drugs.sql index 4c2bc2fc..9af53a32 100644 --- a/sv_esx_drugs.sql +++ b/sv_esx_drugs.sql @@ -1,10 +1,10 @@ INSERT INTO `items` (name, label) VALUES - ('weed', 'Weed'), - ('weed_pooch', 'Väska med weed'), - ('coke', 'Coke'), - ('coke_pooch', 'väska med coke'), + ('weed', 'Cannabis'), + ('weed_pooch', 'Väska med cannabis'), + ('coke', 'Kokain'), + ('coke_pooch', 'Väska med kokain'), ('meth', 'Meth'), - ('meth_pooch', 'väska med meth'), + ('meth_pooch', 'Väska med meth'), ('opium', 'Opium'), - ('opium_pooch', 'väska med opium') -; \ No newline at end of file + ('opium_pooch', 'Väska med opium') +; From aa2563e47a252bd843d61ca9ec3e53afd43d610a Mon Sep 17 00:00:00 2001 From: MHL1337 Date: Sat, 14 Apr 2018 22:52:33 +0200 Subject: [PATCH 25/66] Updated some weird translations --- locales/sv.lua | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/locales/sv.lua b/locales/sv.lua index 65fc42c7..6b6e14bb 100644 --- a/locales/sv.lua +++ b/locales/sv.lua @@ -1,36 +1,36 @@ Locales['sv'] = { - ['press_collect_coke'] = 'klicka ~INPUT_CONTEXT~ för att plocka coke', - ['press_process_coke'] = 'klicka ~INPUT_CONTEXT~ för att bearbeta coke', + ['press_collect_coke'] = 'klicka ~INPUT_CONTEXT~ för att plocka kokain', + ['press_process_coke'] = 'klicka ~INPUT_CONTEXT~ för att bearbeta kokain', ['press_sell_coke'] = 'klicka ~INPUT_CONTEXT~ för att sälja coke', ['press_collect_meth'] = 'klicka ~INPUT_CONTEXT~ för att plocka meth', ['press_process_meth'] = 'klicka ~INPUT_CONTEXT~ för att bearbeta meth', ['press_sell_meth'] = 'klicka ~INPUT_CONTEXT~ för att sälja meth', - ['press_collect_weed'] = 'klicka ~INPUT_CONTEXT~ för att plocka weed', - ['press_process_weed'] = 'klicka ~INPUT_CONTEXT~ för att bearbeta weed', - ['press_sell_weed'] = 'klicka ~INPUT_CONTEXT~ för att sälja weed', + ['press_collect_weed'] = 'klicka ~INPUT_CONTEXT~ för att plocka cannabis', + ['press_process_weed'] = 'klicka ~INPUT_CONTEXT~ för att bearbeta cannabis', + ['press_sell_weed'] = 'klicka ~INPUT_CONTEXT~ för att sälja cannabis', ['press_collect_opium'] = 'klicka ~INPUT_CONTEXT~ för att plocka opium', ['press_process_opium'] = 'klicka ~INPUT_CONTEXT~ för att bearbeta opium', ['press_sell_opium'] = 'klicka ~INPUT_CONTEXT~ för att sälja opium', - ['act_imp_police'] = 'handling ~r~omöjlig~s~, ~b~polis~s~: ', - ['inv_full_coke'] = 'Du kan inte längre plocka coke, ditt inventory är ~r~fullt~s~', + ['act_imp_police'] = 'Kan inte genomföra ~r~handling~s~, ~b~noll poliser inne~s~: ', + ['inv_full_coke'] = 'Du kan inte längre plocka kokain, du har inte plats ~r~fullt~s~', ['pickup_in_prog'] = '~y~Plockning pågår~s~...', ['too_many_pouches'] = 'Du har för många väskor', - ['not_enough_coke'] = 'Du har inte tillräckligt coke för att ~r~bearbeta~s~', + ['not_enough_coke'] = 'Du har inte tillräckligt med kokain för att ~r~bearbeta~s~', ['packing_in_prog'] = '~y~Förpackning pågår~s~...', ['no_pouchs_sale'] = 'Du har inga mer väskor att ~r~sälja~s~', - ['sold_one_coke'] = 'Du har sålt ~g~x1 väska med coke~s~', + ['sold_one_coke'] = 'du har sålt ~y~1x~s~ ~b~väska med kokain~s~',, ['sale_in_prog'] = '~g~Försäljning pågår~s~...', - ['inv_full_meth'] = 'Du kan inte längre plocka Meth ditt inventory är ~r~fullt~s~', - ['not_enough_meth'] = 'Du har inte tillräckligt Meth för att ~r~bearbeta~s~', - ['sold_one_meth'] = 'Du har sålt ~g~x1 väska med meth~s~', - ['inv_full_weed'] = 'Du kan inte längre plocka Meth, ditt inventory är ~r~fullt~s~', - ['not_enough_weed'] = 'Du har inte tillräckligt med weed för att ~r~bearbeta~s~', - ['sold_one_weed'] = 'Du har sålt ~g~x1 väska med weed~s~', - ['used_one_weed'] = 'Du använde 1 väska ~b~weed', - ['inv_full_opium'] = 'Du kan inte längre plocka opium, ditt inventory är ~r~fullt~s~', - ['not_enough_opium'] = 'Du har inte tillräckligt opium för att ~r~bearbeta~s~', - ['sold_one_opium'] = 'Du har sålt ~g~x1 väska med opium~s~', + ['inv_full_meth'] = 'Du kan inte längre plocka meth, du har inte plats ~r~fullt~s~', + ['not_enough_meth'] = 'Du har inte tillräckligt med meth för att ~r~bearbeta~s~', + ['sold_one_meth'] = 'du har sålt ~y~1x~s~ ~b~väska med meth~s~', + ['inv_full_weed'] = 'Du kan inte längre plocka cannabis, du har inte plats ~r~fullt~s~', + ['not_enough_weed'] = 'Du har inte tillräckligt med annabis för att ~r~bearbeta~s~', + ['sold_one_weed'] = 'du har sålt ~y~1x~s~ ~b~väska med cannabis~s~', + ['used_one_weed'] = 'Du använde 1 väska ~b~cannabis', + ['inv_full_opium'] = 'Du kan inte längre plocka opium, du har inte plats ~r~fullt~s~', + ['not_enough_opium'] = 'Du har inte tillräckligt med opium för att ~r~bearbeta~s~', + ['sold_one_opium'] = 'du har sålt ~y~1x~s~ ~b~väska med opium~s~', ['used_one_opium'] = 'Du använde 1 väska ~b~opium', } From a76b1582a8c66c717efbbfdfc9335a075a3b6c37 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sun, 15 Apr 2018 20:56:19 +0200 Subject: [PATCH 26/66] (i18n) Moved hardcoded strings to formatted --- locales/br.lua | 2 +- locales/de.lua | 2 +- locales/en.lua | 60 ++++++++++++++++++++--------------------- locales/es.lua | 2 +- locales/fr.lua | 2 +- server/esx_drugs_sv.lua | 24 ++++++++--------- 6 files changed, 46 insertions(+), 46 deletions(-) diff --git a/locales/br.lua b/locales/br.lua index fdad1ed5..ad9c5401 100644 --- a/locales/br.lua +++ b/locales/br.lua @@ -12,7 +12,7 @@ Locales['br'] = { ['press_collect_opium'] = 'Pressione ~INPUT_CONTEXT~ para coletar ópio', ['press_process_opium'] = 'Pressione ~INPUT_CONTEXT~ para processar ópio', ['press_sell_weed'] = 'Pressione ~INPUT_CONTEXT~ para vender erva', - ['act_imp_police'] = 'Ação ~r~impossivel~s~, ~b~polícia~s~: ', + ['act_imp_police'] = 'Ação ~r~impossivel~s~, ~b~polícia~s~: ~o~%s~s~/~y~%s~s~ online', ['inv_full_coke'] = 'Você não pode mais coletar a Cocaína, seu estoque está ~r~cheio~s~', ['pickup_in_prog'] = '~y~Colheita em progresso~s~...', ['too_many_pouches'] = 'Você tem muitas trouxinhas', diff --git a/locales/de.lua b/locales/de.lua index 4cbdbfe6..a4451407 100644 --- a/locales/de.lua +++ b/locales/de.lua @@ -12,7 +12,7 @@ Locales['de'] = { ['press_collect_opium'] = 'drücke ~INPUT_CONTEXT~ um Opium zu sammeln', ['press_process_opium'] = 'drücke ~INPUT_CONTEXT~ um Opium zu verarbeiten', ['press_sell_opium'] = 'drücke ~INPUT_CONTEXT~ um Opium zu verkaufen', - ['act_imp_police'] = 'aktion ~r~nihct möglich~s~, ~b~Polizisten~s~: ', + ['act_imp_police'] = 'aktion ~r~nihct möglich~s~, ~b~Polizisten~s~: ~o~%s~s~/~y~%s~s~ online', ['inv_full_coke'] = 'Du kannst nicht länger Koks sammeln, dein Inventar ist ~r~VOLL~s~', ['pickup_in_prog'] = '~y~Sammeln im gange~s~...', ['too_many_pouches'] = 'du hast zuviele Pakete', diff --git a/locales/en.lua b/locales/en.lua index 3852ef36..0de5362c 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -1,36 +1,36 @@ Locales['en'] = { - ['press_collect_coke'] = 'press ~INPUT_CONTEXT~ to collect coke', - ['press_process_coke'] = 'press ~INPUT_CONTEXT~ to process coke', - ['press_sell_coke'] = 'press ~INPUT_CONTEXT~ to sell coke', - ['press_collect_meth'] = 'press ~INPUT_CONTEXT~ to collect meth', - ['press_process_meth'] = 'press ~INPUT_CONTEXT~ to process meth', - ['press_sell_meth'] = 'press ~INPUT_CONTEXT~ to sell meth', - ['press_collect_weed'] = 'press ~INPUT_CONTEXT~ to collect weed', - ['press_process_weed'] = 'press ~INPUT_CONTEXT~ to process weed', - ['press_sell_weed'] = 'press ~INPUT_CONTEXT~ to sell weed', + ['press_collect_coke'] = 'press ~INPUT_CONTEXT~ to collect coke', + ['press_process_coke'] = 'press ~INPUT_CONTEXT~ to process coke', + ['press_sell_coke'] = 'press ~INPUT_CONTEXT~ to sell coke', + ['press_collect_meth'] = 'press ~INPUT_CONTEXT~ to collect meth', + ['press_process_meth'] = 'press ~INPUT_CONTEXT~ to process meth', + ['press_sell_meth'] = 'press ~INPUT_CONTEXT~ to sell meth', + ['press_collect_weed'] = 'press ~INPUT_CONTEXT~ to collect weed', + ['press_process_weed'] = 'press ~INPUT_CONTEXT~ to process weed', + ['press_sell_weed'] = 'press ~INPUT_CONTEXT~ to sell weed', ['press_collect_opium'] = 'press ~INPUT_CONTEXT~ to collect opium', - ['press_process_opium'] = 'press ~INPUT_CONTEXT~ to process opium', - ['press_sell_opium'] = 'press ~INPUT_CONTEXT~ to sell opium', - ['act_imp_police'] = 'action ~r~impossible~s~, ~b~police~s~: ', - ['inv_full_coke'] = 'you can no longer collect Cocaine, your inventory is ~r~full~s~', - ['pickup_in_prog'] = '~y~Pickup in progress~s~...', - ['too_many_pouches'] = 'you have too many pouches', - ['not_enough_coke'] = 'you do not have enough coca leaf to ~r~pack~s~', - ['packing_in_prog'] = '~y~Packaging in progress~s~...', - ['no_pouchs_sale'] = 'You have no more pouches for ~r~sale~s~', - ['sold_one_coke'] = 'you\'ve sold ~g~x1 Coke Pouch~s~', - ['sale_in_prog'] = '~g~Sale in progress~s~...', - ['inv_full_meth'] = 'you can no longer collect Meth, your inventory is ~r~full~s~', - ['not_enough_meth'] = 'you do not have enough Meth to ~r~pack~s~', - ['sold_one_meth'] = 'you\'ve sold ~g~x1 Meth Pouch~s~', - ['inv_full_weed'] = 'you can no longer collect Weed, your inventory is ~r~full~s~', - ['not_enough_weed'] = 'you do not have enough Weed to ~r~pack~s~', - ['sold_one_weed'] = 'you\'ve sold ~g~x1 Weed Pouch~s~', - ['used_one_weed'] = 'you used 1 pouch of ~b~weed', + ['press_process_opium'] = 'press ~INPUT_CONTEXT~ to process opium', + ['press_sell_opium'] = 'press ~INPUT_CONTEXT~ to sell opium', + ['act_imp_police'] = 'you cannot participate illegal activities unless there\'s enough cops online (~o~%s~s~/~y~%s~s~ online)', + ['inv_full_coke'] = 'you can no longer collect Cocaine, your inventory is ~r~full~s~', + ['pickup_in_prog'] = '~y~Pickup in progress~s~...', + ['too_many_pouches'] = 'you have too many pouches', + ['not_enough_coke'] = 'you do not have enough coca leaf to ~r~pack~s~', + ['packing_in_prog'] = '~y~Packaging in progress~s~...', + ['no_pouchs_sale'] = 'You have no more pouches for ~r~sale~s~', + ['sold_one_coke'] = 'you\'ve sold ~g~x1 Coke Pouch~s~', + ['sale_in_prog'] = '~g~Sale in progress~s~...', + ['inv_full_meth'] = 'you can no longer collect Meth, your inventory is ~r~full~s~', + ['not_enough_meth'] = 'you do not have enough Meth to ~r~pack~s~', + ['sold_one_meth'] = 'you\'ve sold ~g~x1 Meth Pouch~s~', + ['inv_full_weed'] = 'you can no longer collect Weed, your inventory is ~r~full~s~', + ['not_enough_weed'] = 'you do not have enough Weed to ~r~pack~s~', + ['sold_one_weed'] = 'you\'ve sold ~g~x1 Weed Pouch~s~', + ['used_one_weed'] = 'you used 1 pouch of ~b~weed', ['inv_full_opium'] = 'you can no longer collect opium, your inventory is ~r~full~s~', - ['not_enough_opium'] = 'you do not have enough opium to ~r~pack~s~', - ['sold_one_opium'] = 'you\'ve sold ~g~x1 opium Pouch~s~', - ['used_one_opium'] = 'you used 1 pouch of ~b~opium', + ['not_enough_opium'] = 'you do not have enough opium to ~r~pack~s~', + ['sold_one_opium'] = 'you\'ve sold ~g~x1 opium Pouch~s~', + ['used_one_opium'] = 'you used 1 pouch of ~b~opium', } \ No newline at end of file diff --git a/locales/es.lua b/locales/es.lua index d05f4e2b..47a27a94 100644 --- a/locales/es.lua +++ b/locales/es.lua @@ -12,7 +12,7 @@ Locales['es'] = { ['press_collect_opium'] = "Presiona ~INPUT_CONTEXT~ para cosechar el Opio", ['press_process_opium'] = "Presiona ~INPUT_CONTEXT~ para tratar el Opio", ['press_sell_opium'] = "Presiona ~INPUT_CONTEXT~ para vender el Opio", - ['act_imp_police'] = 'Acción ~r~imposible~s~, ~b~policias~s~: ', + ['act_imp_police'] = 'Acción ~r~imposible~s~, ~b~policias~s~: ~o~%s~s~/~y~%s~s~ online', ['inv_full_coke'] = 'No puedes recoger mas cocaina, tu inventario está ~r~lleno~s~', ['pickup_in_prog'] = '~y~Recogida en curso~s~...', ['too_many_pouches'] = 'Tienes demasiadas bolsas', diff --git a/locales/fr.lua b/locales/fr.lua index 55d455e3..423cfd1c 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -12,7 +12,7 @@ Locales['fr'] = { ['press_collect_opium'] = "appuyez sur ~INPUT_CONTEXT~ pour récolter l'opium", ['press_process_opium'] = "appuyez sur ~INPUT_CONTEXT~ pour traiter l'opium", ['press_sell_opium'] = "appuyez sur ~INPUT_CONTEXT~ pour vendre l'opium", - ['act_imp_police'] = 'action ~r~impossible~s~, ~b~policiers~s~: ', + ['act_imp_police'] = 'action ~r~impossible~s~, ~b~policiers~s~: ~o~%s~s~/~y~%s~s~ online', ['inv_full_coke'] = 'vous ne pouvez plus ramasser de Cocaine, votre inventaire est ~r~plein~s~', ['pickup_in_prog'] = '~y~Ramassage en cours~s~...', ['too_many_pouches'] = 'vous avez trop de pochons', diff --git a/server/esx_drugs_sv.lua b/server/esx_drugs_sv.lua index 2e660177..20371a3e 100644 --- a/server/esx_drugs_sv.lua +++ b/server/esx_drugs_sv.lua @@ -38,7 +38,7 @@ CountCops() local function HarvestCoke(source) if CopsConnected < Config.RequiredCopsCoke then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsCoke) + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsCoke)) return end @@ -86,7 +86,7 @@ end) local function TransformCoke(source) if CopsConnected < Config.RequiredCopsCoke then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsCoke) + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsCoke)) return end @@ -140,7 +140,7 @@ end) local function SellCoke(source) if CopsConnected < Config.RequiredCopsCoke then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsCoke) + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsCoke)) return end @@ -210,7 +210,7 @@ end) local function HarvestMeth(source) if CopsConnected < Config.RequiredCopsMeth then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsMeth) + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsMeth)) return end @@ -259,7 +259,7 @@ end) local function TransformMeth(source) if CopsConnected < Config.RequiredCopsMeth then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsMeth) + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsMeth)) return end @@ -313,7 +313,7 @@ end) local function SellMeth(source) if CopsConnected < Config.RequiredCopsMeth then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsMeth) + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsMeth)) return end @@ -386,7 +386,7 @@ end) local function HarvestWeed(source) if CopsConnected < Config.RequiredCopsWeed then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsWeed) + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsWeed)) return end @@ -435,7 +435,7 @@ end) local function TransformWeed(source) if CopsConnected < Config.RequiredCopsWeed then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsWeed) + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsWeed)) return end @@ -488,7 +488,7 @@ end) local function SellWeed(source) if CopsConnected < Config.RequiredCopsWeed then - TriggerClientEvent('esx_weedjob:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsWeed) + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsWeed)) return end @@ -557,7 +557,7 @@ end) local function HarvestOpium(source) if CopsConnected < Config.RequiredCopsOpium then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsOpium) + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsOpium)) return end @@ -606,7 +606,7 @@ end) local function TransformOpium(source) if CopsConnected < Config.RequiredCopsOpium then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsOpium) + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsOpium)) return end @@ -660,7 +660,7 @@ end) local function SellOpium(source) if CopsConnected < Config.RequiredCopsOpium then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police') .. CopsConnected .. '/' .. Config.RequiredCopsOpium) + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsOpium)) return end From 4dea98df83c038773957cb7dd55473321b82003c Mon Sep 17 00:00:00 2001 From: MHL1337 Date: Sun, 15 Apr 2018 21:05:19 +0200 Subject: [PATCH 27/66] updated some weird translations --- locales/sv.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locales/sv.lua b/locales/sv.lua index 6b6e14bb..b6bed27c 100644 --- a/locales/sv.lua +++ b/locales/sv.lua @@ -12,7 +12,7 @@ Locales['sv'] = { ['press_collect_opium'] = 'klicka ~INPUT_CONTEXT~ för att plocka opium', ['press_process_opium'] = 'klicka ~INPUT_CONTEXT~ för att bearbeta opium', ['press_sell_opium'] = 'klicka ~INPUT_CONTEXT~ för att sälja opium', - ['act_imp_police'] = 'Kan inte genomföra ~r~handling~s~, ~b~noll poliser inne~s~: ', + ['act_imp_police'] = 'Du kan inte delta i olagliga aktiviteter om det inte finns tillräckligt med poliser (~o~%s~s~/~y~%s~s~ online)', ['inv_full_coke'] = 'Du kan inte längre plocka kokain, du har inte plats ~r~fullt~s~', ['pickup_in_prog'] = '~y~Plockning pågår~s~...', ['too_many_pouches'] = 'Du har för många väskor', From 9bd14818f0529366a4c1c1b0b202583d1531642e Mon Sep 17 00:00:00 2001 From: Samuel Date: Wed, 18 Apr 2018 21:33:52 +0200 Subject: [PATCH 28/66] Fixed invalid lua, closes #21 --- locales/sv.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locales/sv.lua b/locales/sv.lua index b6bed27c..c1dcd666 100644 --- a/locales/sv.lua +++ b/locales/sv.lua @@ -19,7 +19,7 @@ Locales['sv'] = { ['not_enough_coke'] = 'Du har inte tillräckligt med kokain för att ~r~bearbeta~s~', ['packing_in_prog'] = '~y~Förpackning pågår~s~...', ['no_pouchs_sale'] = 'Du har inga mer väskor att ~r~sälja~s~', - ['sold_one_coke'] = 'du har sålt ~y~1x~s~ ~b~väska med kokain~s~',, + ['sold_one_coke'] = 'du har sålt ~y~1x~s~ ~b~väska med kokain~s~', ['sale_in_prog'] = '~g~Försäljning pågår~s~...', ['inv_full_meth'] = 'Du kan inte längre plocka meth, du har inte plats ~r~fullt~s~', ['not_enough_meth'] = 'Du har inte tillräckligt med meth för att ~r~bearbeta~s~', From 5ab0371373c6a29112ffd358a07a9cdce4aaa4b7 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Thu, 19 Apr 2018 20:57:14 +0200 Subject: [PATCH 29/66] Removed majority of decimals in config, fixed missing marker config --- __resource.lua | 22 ++++++++++------------ config.lua | 26 +++++++++++++------------- 2 files changed, 23 insertions(+), 25 deletions(-) diff --git a/__resource.lua b/__resource.lua index 0c585200..46063791 100644 --- a/__resource.lua +++ b/__resource.lua @@ -1,31 +1,29 @@ -description 'esx_drugs' +resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937' -version '1.0.0' +description 'ESX Drugs' + +version '1.0.1' server_scripts { - - '@es_extended/locale.lua', + '@es_extended/locale.lua', 'locales/de.lua', 'locales/br.lua', 'locales/en.lua', 'locales/fr.lua', 'locales/es.lua', 'locales/sv.lua', - 'server/esx_drugs_sv.lua', - 'config.lua' - + 'server/esx_drugs_sv.lua', + 'config.lua' } client_scripts { - - '@es_extended/locale.lua', + '@es_extended/locale.lua', 'locales/de.lua', 'locales/br.lua', 'locales/en.lua', 'locales/fr.lua', 'locales/es.lua', 'locales/sv.lua', - 'config.lua', - 'client/esx_drugs_cl.lua' - + 'config.lua', + 'client/esx_drugs_cl.lua' } diff --git a/config.lua b/config.lua index af0ea942..9364e73a 100644 --- a/config.lua +++ b/config.lua @@ -2,7 +2,7 @@ Config = {} Config.MarkerType = 1 Config.DrawDistance = 100.0 Config.ZoneSize = {x = 5.0, y = 5.0, z = 3.0} ---Config.MarkerColor = {r = 100, g = 204, b = 100} +Config.MarkerColor = {r = 100, g = 204, b = 100} Config.RequiredCopsCoke = 2 Config.RequiredCopsMeth = 2 Config.RequiredCopsWeed = 0 @@ -10,16 +10,16 @@ Config.RequiredCopsOpium = 3 Config.Locale = 'fr' Config.Zones = { - CokeFarm = {x=2448.9228515625, y=-1836.8076171875, z=51.953701019287}, - CokeTreatment = {x=-458.13967895508, y=-2278.6174316406, z=7.5158290863037}, - CokeResell = {x=-1756.1984863281, y=427.31674194336, z=126.68292999268}, - MethFarm = {x=1525.298828125, y=1710.0217285156, z=109.00956726074}, - MethTreatment = {x=-1001.4151611328, y=4848.0087890625, z=274.00686645508}, - MethResell = {x=-63.592178344727, y=-1224.0709228516, z=27.768648147583}, - WeedFarm = {x=1609.125, y=6663.5942382813, z=20.961572647095}, - WeedTreatment = {x=91.061386108398, y=3750.0380859375, z=39.77326965332}, - WeedResell = {x=-54.249694824219, y=-1443.3666992188, z=31.068626403809}, - OpiumFarm = {x=1972.784790039, y=3819.3999023438, z=33.428722381592}, - OpiumTreatment = {x=971.86499023438,y=-2157.61328125, z=28.475107192994}, - OpiumResell = {x=2331.0881347656,y=2570.2250976562,z=46.681819915772} + CokeFarm = {x = 2448.92, y = -1836.80, z=51.95}, + CokeTreatment = {x = -458.13, y=-2278.61, z=7.51}, + CokeResell = {x = -1756.19, y=427.31, z=126.68}, + MethFarm = {x = 1525.29, y=1710.02, z=109.00}, + MethTreatment = {x = -1001.41, y=4848.00, z=274.00}, + MethResell = {x = -63.59, y=-1224.07, z=27.76}, + WeedFarm = {x = 1609.12, y=6663.59, z=20.96}, + WeedTreatment = {x = 91.06, y=3750.03, z=39.77}, + WeedResell = {x = -54.24, y=-1443.36, z=31.06}, + OpiumFarm = {x = 1972.78, y=3819.39, z=33.42}, + OpiumTreatment = {x = 971.86, y=-2157.61, z=28.47}, + OpiumResell = {x = 2331.08, y = 2570.22, z=46.68} } From 171813e357e0adae53ca7def547cce826e9c138a Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Thu, 3 May 2018 22:08:18 +0200 Subject: [PATCH 30/66] Fixed famous #18 exploit, added blips - Added blips for all zones - Improved code - Fixed #18 exploit where if you quickly and repeatly enter & leave the zone, and spam press E you'll get loads of stuff very quickly. - Tab indents - Added missing SQL information (items max size) - Improved README - General improvements & Cleanup --- README.md | 49 ++-- __resource.lua | 2 +- client/esx_drugs_cl.lua | 501 +++++++++++++++++----------------- config.lua | 38 +-- de_esx_drugs.sql | 10 - esx_drugs.sql | 18 +- locales/br.lua | 76 +++--- locales/de.lua | 76 +++--- locales/en.lua | 28 +- locales/es.lua | 82 +++--- locales/fr.lua | 76 +++--- locales/sv.lua | 16 +- localization/de_esx_drugs.sql | 10 + localization/en_esx_drugs.sql | 10 + localization/sv_esx_drugs.sql | 10 + server/esx_drugs_sv.lua | 216 +++++++-------- sv_esx_drugs.sql | 10 - 17 files changed, 658 insertions(+), 570 deletions(-) delete mode 100644 de_esx_drugs.sql create mode 100644 localization/de_esx_drugs.sql create mode 100644 localization/en_esx_drugs.sql create mode 100644 localization/sv_esx_drugs.sql delete mode 100644 sv_esx_drugs.sql diff --git a/README.md b/README.md index e1873b00..5e453382 100644 --- a/README.md +++ b/README.md @@ -1,36 +1,39 @@ -# fxserver-esx_drugs -FXserver ESX Drugs +# esx_drugs +## Requirements + - [esx_policejob](https://github.com/ESX-Org/esx_policejob) -[REQUIREMENTS] +## Download & Installation - * esx_policejob => https://github.com/FXServer-ESX/fxserver-esx_policejob - - - [UPDATE] - to install opium : +### Using [fvm](https://github.com/qlaffont/fvm-installer) ``` -INSERT INTO `items` (name, label) VALUES - ('opium', 'Opium'), - ('opium_pooch', 'Pochon de opium') -; +fvm install --save --folder=esx esx-org/esx_drugs ``` - - [INSTALLATION] -1) CD in your resources/[esx] folder -2) Clone the repository +### Using Git ``` -git clone https://github.com/FXServer-ESX/fxserver-esx_drugs esx_drugs +cd resources +git clone https://github.com/ESX-Org/esx_drugs [esx]/esx_drugs ``` -3) * Import esx_drugs.sql in your database -4) Add this in your server.cfg : +### Manually +- Download https://github.com/ESX-Org/esx_drugs/archive/master.zip +- Put it in the `[esx]` directory + +- Import `esx_drugs.sql` in your database +- Add this in your `server.cfg`: ``` start esx_drugs ``` -[FEATURES] -* Use weed -* Cops can't see or interact with the drugs zones -* In the config.lua change the Config.RequiredCop to block the drugs zone in function of the cops count conected +# Legal +### License +esx_drugs - drugs job + +Copyright (C) 2015-2018 Jérémie N'gadi + +This program Is free software: you can redistribute it And/Or modify it under the terms Of the GNU General Public License As published by the Free Software Foundation, either version 3 Of the License, Or (at your option) any later version. + +This program Is distributed In the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty Of MERCHANTABILITY Or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License For more details. + +You should have received a copy Of the GNU General Public License along with this program. If Not, see http://www.gnu.org/licenses/. \ No newline at end of file diff --git a/__resource.lua b/__resource.lua index 46063791..e10b721b 100644 --- a/__resource.lua +++ b/__resource.lua @@ -2,7 +2,7 @@ resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937' description 'ESX Drugs' -version '1.0.1' +version '1.0.2' server_scripts { '@es_extended/locale.lua', diff --git a/client/esx_drugs_cl.lua b/client/esx_drugs_cl.lua index dcaa2119..1dcba016 100644 --- a/client/esx_drugs_cl.lua +++ b/client/esx_drugs_cl.lua @@ -1,20 +1,17 @@ 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 + ["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 PID = 0 -local GUI = {} local cokeQTE = 0 ESX = nil -GUI.Time = 0 local coke_poochQTE = 0 local weedQTE = 0 local weed_poochQTE = 0 @@ -23,299 +20,305 @@ local meth_poochQTE = 0 local opiumQTE = 0 local opium_poochQTE = 0 local myJob = nil -local PlayerData = {} -local GUI = {} local HasAlreadyEnteredMarker = false local LastZone = nil +local isInZone = false local CurrentAction = nil local CurrentActionMsg = '' local CurrentActionData = {} Citizen.CreateThread(function() - while ESX == nil do - TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) - Citizen.Wait(0) - end + while ESX == nil do + TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) + Citizen.Wait(0) + end end) AddEventHandler('esx_drugs:hasEnteredMarker', function(zone) + if myJob == 'police' or myJob == 'ambulance' then + return + end - ESX.UI.Menu.CloseAll() + ESX.UI.Menu.CloseAll() + + if zone == 'exitMarker' then + CurrentAction = zone + CurrentActionMsg = _U('exit_marker') + CurrentActionData = {} + end + + if zone == 'CokeField' then + CurrentAction = zone + CurrentActionMsg = _U('press_collect_coke') + CurrentActionData = {} + end - --coke - if zone == 'CokeFarm' then - if myJob ~= "police" then - CurrentAction = 'coke_harvest' - CurrentActionMsg = _U('press_collect_coke') - CurrentActionData = {} - end - end + if zone == 'CokeProcessing' then + if cokeQTE >= 5 then + CurrentAction = zone + CurrentActionMsg = _U('press_process_coke') + CurrentActionData = {} + end + end - if zone == 'CokeTreatment' then - if myJob ~= "police" then - if cokeQTE >= 5 then - CurrentAction = 'coke_treatment' - CurrentActionMsg = _U('press_process_coke') - CurrentActionData = {} - end - end - end + if zone == 'CokeDealer' then + if coke_poochQTE >= 1 then + CurrentAction = zone + CurrentActionMsg = _U('press_sell_coke') + CurrentActionData = {} + end + end - if zone == 'CokeResell' then - if myJob ~= "police" then - if coke_poochQTE >= 1 then - CurrentAction = 'coke_resell' - CurrentActionMsg = _U('press_sell_coke') - CurrentActionData = {} - end - end - end + if zone == 'MethField' then + CurrentAction = zone + CurrentActionMsg = _U('press_collect_meth') + CurrentActionData = {} + end - --meth - if zone == 'MethFarm' then - if myJob ~= "police" then - CurrentAction = 'meth_harvest' - CurrentActionMsg = _U('press_collect_meth') - CurrentActionData = {} - end - end + if zone == 'MethProcessing' then + if methQTE >= 5 then + CurrentAction = zone + CurrentActionMsg = _U('press_process_meth') + CurrentActionData = {} + end + end - if zone == 'MethTreatment' then - if myJob ~= "police" then - if methQTE >= 5 then - CurrentAction = 'meth_treatment' - CurrentActionMsg = _U('press_process_meth') - CurrentActionData = {} - end - end - end + if zone == 'MethDealer' then + if meth_poochQTE >= 1 then + CurrentAction = zone + CurrentActionMsg = _U('press_sell_meth') + CurrentActionData = {} + end + end - if zone == 'MethResell' then - if myJob ~= "police" then - if meth_poochQTE >= 1 then - CurrentAction = 'meth_resell' - CurrentActionMsg = _U('press_sell_meth') - CurrentActionData = {} - end - end - end + if zone == 'WeedField' then + CurrentAction = zone + CurrentActionMsg = _U('press_collect_weed') + CurrentActionData = {} + end - --weed - if zone == 'WeedFarm' then - if myJob ~= "police" then - CurrentAction = 'weed_harvest' - CurrentActionMsg = _U('press_collect_weed') - CurrentActionData = {} - end - end + if zone == 'WeedProcessing' then + if weedQTE >= 5 then + CurrentAction = zone + CurrentActionMsg = _U('press_process_weed') + CurrentActionData = {} + end + end - if zone == 'WeedTreatment' then - if myJob ~= "police" then - if weedQTE >= 5 then - CurrentAction = 'weed_treatment' - CurrentActionMsg = _U('press_process_weed') - CurrentActionData = {} - end - end - end + if zone == 'WeedDealer' then + if weed_poochQTE >= 1 then + CurrentAction = zone + CurrentActionMsg = _U('press_sell_weed') + CurrentActionData = {} + end + end - if zone == 'WeedResell' then - if myJob ~= "police" then - if weed_poochQTE >= 1 then - CurrentAction = 'weed_resell' - CurrentActionMsg = _U('press_sell_weed') - CurrentActionData = {} - end - end - end + if zone == 'OpiumField' then + CurrentAction = zone + CurrentActionMsg = _U('press_collect_opium') + CurrentActionData = {} + end - --opium - if zone == 'OpiumFarm' then - if myJob ~= "police" then - CurrentAction = 'opium_harvest' - CurrentActionMsg = _U('press_collect_opium') - CurrentActionData = {} - end - end + if zone == 'OpiumProcessing' then + if opiumQTE >= 5 then + CurrentAction = zone + CurrentActionMsg = _U('press_process_opium') + CurrentActionData = {} + end + end - if zone == 'OpiumTreatment' then - if myJob ~= "police" then - if opiumQTE >= 5 then - CurrentAction = 'opium_treatment' - CurrentActionMsg = _U('press_process_opium') - CurrentActionData = {} - end - end - end - - if zone == 'OpiumResell' then - if myJob ~= "police" then - if opium_poochQTE >= 1 then - CurrentAction = 'opium_resell' - CurrentActionMsg = _U('press_sell_opium') - CurrentActionData = {} - end - end - end + if zone == 'OpiumDealer' then + if opium_poochQTE >= 1 then + CurrentAction = zone + CurrentActionMsg = _U('press_sell_opium') + CurrentActionData = {} + end + end end) AddEventHandler('esx_drugs:hasExitedMarker', function(zone) + CurrentAction = nil + ESX.UI.Menu.CloseAll() - CurrentAction = nil - ESX.UI.Menu.CloseAll() - - TriggerServerEvent('esx_drugs:stopHarvestCoke') - TriggerServerEvent('esx_drugs:stopTransformCoke') - TriggerServerEvent('esx_drugs:stopSellCoke') - TriggerServerEvent('esx_drugs:stopHarvestMeth') - TriggerServerEvent('esx_drugs:stopTransformMeth') - TriggerServerEvent('esx_drugs:stopSellMeth') - TriggerServerEvent('esx_drugs:stopHarvestWeed') - TriggerServerEvent('esx_drugs:stopTransformWeed') - TriggerServerEvent('esx_drugs:stopSellWeed') - TriggerServerEvent('esx_drugs:stopHarvestOpium') - TriggerServerEvent('esx_drugs:stopTransformOpium') - TriggerServerEvent('esx_drugs:stopSellOpium') + TriggerServerEvent('esx_drugs:stopHarvestCoke') + TriggerServerEvent('esx_drugs:stopTransformCoke') + TriggerServerEvent('esx_drugs:stopSellCoke') + TriggerServerEvent('esx_drugs:stopHarvestMeth') + TriggerServerEvent('esx_drugs:stopTransformMeth') + TriggerServerEvent('esx_drugs:stopSellMeth') + TriggerServerEvent('esx_drugs:stopHarvestWeed') + TriggerServerEvent('esx_drugs:stopTransformWeed') + TriggerServerEvent('esx_drugs:stopSellWeed') + TriggerServerEvent('esx_drugs:stopHarvestOpium') + TriggerServerEvent('esx_drugs:stopTransformOpium') + TriggerServerEvent('esx_drugs:stopSellOpium') end) -- Weed Effect RegisterNetEvent('esx_drugs:onPot') AddEventHandler('esx_drugs:onPot', function() - RequestAnimSet("MOVE_M@DRUNK@SLIGHTLYDRUNK") - while not HasAnimSetLoaded("MOVE_M@DRUNK@SLIGHTLYDRUNK") do - Citizen.Wait(0) - end - TaskStartScenarioInPlace(GetPlayerPed(-1), "WORLD_HUMAN_SMOKING_POT", 0, true) - Citizen.Wait(5000) - DoScreenFadeOut(1000) - Citizen.Wait(1000) - ClearPedTasksImmediately(GetPlayerPed(-1)) - SetTimecycleModifier("spectator5") - SetPedMotionBlur(GetPlayerPed(-1), true) - SetPedMovementClipset(GetPlayerPed(-1), "MOVE_M@DRUNK@SLIGHTLYDRUNK", true) - SetPedIsDrunk(GetPlayerPed(-1), true) - DoScreenFadeIn(1000) - Citizen.Wait(600000) - DoScreenFadeOut(1000) - Citizen.Wait(1000) - DoScreenFadeIn(1000) - ClearTimecycleModifier() - ResetScenarioTypesEnabled() - ResetPedMovementClipset(GetPlayerPed(-1), 0) - SetPedIsDrunk(GetPlayerPed(-1), false) - SetPedMotionBlur(GetPlayerPed(-1), false) + RequestAnimSet("MOVE_M@DRUNK@SLIGHTLYDRUNK") + while not HasAnimSetLoaded("MOVE_M@DRUNK@SLIGHTLYDRUNK") do + Citizen.Wait(0) + end + TaskStartScenarioInPlace(GetPlayerPed(-1), "WORLD_HUMAN_SMOKING_POT", 0, true) + Citizen.Wait(5000) + DoScreenFadeOut(1000) + Citizen.Wait(1000) + ClearPedTasksImmediately(GetPlayerPed(-1)) + SetTimecycleModifier("spectator5") + SetPedMotionBlur(GetPlayerPed(-1), true) + SetPedMovementClipset(GetPlayerPed(-1), "MOVE_M@DRUNK@SLIGHTLYDRUNK", true) + SetPedIsDrunk(GetPlayerPed(-1), true) + DoScreenFadeIn(1000) + Citizen.Wait(600000) + DoScreenFadeOut(1000) + Citizen.Wait(1000) + DoScreenFadeIn(1000) + ClearTimecycleModifier() + ResetScenarioTypesEnabled() + ResetPedMovementClipset(GetPlayerPed(-1), 0) + SetPedIsDrunk(GetPlayerPed(-1), false) + SetPedMotionBlur(GetPlayerPed(-1), false) end) -- Render markers Citizen.CreateThread(function() - while true do + while true do - Wait(0) + Citizen.Wait(0) - local coords = GetEntityCoords(GetPlayerPed(-1)) + local coords = GetEntityCoords(GetPlayerPed(-1)) - for k,v in pairs(Config.Zones) do - if(GetDistanceBetweenCoords(coords, v.x, v.y, v.z, true) < Config.DrawDistance) then - DrawMarker(Config.MarkerType, v.x, v.y, v.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, Config.ZoneSize.x, Config.ZoneSize.y, Config.ZoneSize.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false) - end - end + for k,v in pairs(Config.Zones) do + if(GetDistanceBetweenCoords(coords, v.x, v.y, v.z, true) < Config.DrawDistance) then + DrawMarker(Config.MarkerType, v.x, v.y, v.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, Config.ZoneSize.x, Config.ZoneSize.y, Config.ZoneSize.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false) + end + end - end + end +end) + +-- Create blips +Citizen.CreateThread(function() + for k,v in pairs(Config.Zones) do + local blip = AddBlipForCoord(v.x, v.y, v.z) + + SetBlipSprite (blip, v.sprite) + SetBlipDisplay(blip, 4) + SetBlipScale (blip, 0.9) + SetBlipColour (blip, v.color) + SetBlipAsShortRange(blip, true) + + BeginTextCommandSetBlipName("STRING") + AddTextComponentString(v.name) + EndTextCommandSetBlipName(blip) + end end) -- RETURN NUMBER OF ITEMS FROM SERVER RegisterNetEvent('esx_drugs:ReturnInventory') AddEventHandler('esx_drugs:ReturnInventory', function(cokeNbr, cokepNbr, methNbr, methpNbr, weedNbr, weedpNbr, opiumNbr, opiumpNbr, jobName, currentZone) - cokeQTE = cokeNbr - coke_poochQTE = cokepNbr - methQTE = methNbr - meth_poochQTE = methpNbr - weedQTE = weedNbr - weed_poochQTE = weedpNbr - opiumQTE = opiumNbr - opium_poochQTE = opiumpNbr - myJob = jobName - TriggerEvent('esx_drugs:hasEnteredMarker', currentZone) + cokeQTE = cokeNbr + coke_poochQTE = cokepNbr + methQTE = methNbr + meth_poochQTE = methpNbr + weedQTE = weedNbr + weed_poochQTE = weedpNbr + opiumQTE = opiumNbr + opium_poochQTE = opiumpNbr + myJob = jobName + TriggerEvent('esx_drugs:hasEnteredMarker', currentZone) end) -- Activate menu when player is inside marker Citizen.CreateThread(function() - while true do + while true do - Wait(0) + Citizen.Wait(0) - local coords = GetEntityCoords(GetPlayerPed(-1)) - local isInMarker = false - local currentZone = nil + local coords = GetEntityCoords(GetPlayerPed(-1)) + local isInMarker = false + local currentZone = nil - for k,v in pairs(Config.Zones) do - if(GetDistanceBetweenCoords(coords, v.x, v.y, v.z, true) < Config.ZoneSize.x / 2) then - isInMarker = true - currentZone = k - end - end + for k,v in pairs(Config.Zones) do + if(GetDistanceBetweenCoords(coords, v.x, v.y, v.z, true) < Config.ZoneSize.x / 2) then + isInMarker = true + currentZone = k + end + end - if isInMarker and not hasAlreadyEnteredMarker then - hasAlreadyEnteredMarker = true - lastZone = currentZone - TriggerServerEvent('esx_drugs:GetUserInventory', currentZone) - end + if isInMarker and not hasAlreadyEnteredMarker then + hasAlreadyEnteredMarker = true + lastZone = currentZone + TriggerServerEvent('esx_drugs:GetUserInventory', currentZone) + end - if not isInMarker and hasAlreadyEnteredMarker then - hasAlreadyEnteredMarker = false - TriggerEvent('esx_drugs:hasExitedMarker', lastZone) - end + if not isInMarker and hasAlreadyEnteredMarker then + hasAlreadyEnteredMarker = false + TriggerEvent('esx_drugs:hasExitedMarker', lastZone) + end - end + if isInMarker and isInZone then + TriggerEvent('esx_drugs:hasEnteredMarker', 'exitMarker') + end + end end) -- Key Controls Citizen.CreateThread(function() - while true do - Citizen.Wait(0) - if CurrentAction ~= nil then - SetTextComponentFormat('STRING') - AddTextComponentString(CurrentActionMsg) - DisplayHelpTextFromStringLabel(0, 0, 1, -1) - if IsControlJustReleased(0, 38) then - if CurrentAction == 'coke_harvest' then - TriggerServerEvent('esx_drugs:startHarvestCoke') - end - if CurrentAction == 'coke_treatment' then - TriggerServerEvent('esx_drugs:startTransformCoke') - end - if CurrentAction == 'coke_resell' then - TriggerServerEvent('esx_drugs:startSellCoke') - end - if CurrentAction == 'meth_harvest' then - TriggerServerEvent('esx_drugs:startHarvestMeth') - end - if CurrentAction == 'meth_treatment' then - TriggerServerEvent('esx_drugs:startTransformMeth') - end - if CurrentAction == 'meth_resell' then - TriggerServerEvent('esx_drugs:startSellMeth') - end - if CurrentAction == 'weed_harvest' then - TriggerServerEvent('esx_drugs:startHarvestWeed') - end - if CurrentAction == 'weed_treatment' then - TriggerServerEvent('esx_drugs:startTransformWeed') - end - if CurrentAction == 'weed_resell' then - TriggerServerEvent('esx_drugs:startSellWeed') - end - if CurrentAction == 'opium_harvest' then - TriggerServerEvent('esx_drugs:startHarvestOpium') - end - if CurrentAction == 'opium_treatment' then - TriggerServerEvent('esx_drugs:startTransformOpium') - end - if CurrentAction == 'opium_resell' then - TriggerServerEvent('esx_drugs:startSellOpium') - end - CurrentAction = nil - end - end - end + while true do + Citizen.Wait(10) + if CurrentAction ~= nil then + SetTextComponentFormat('STRING') + AddTextComponentString(CurrentActionMsg) + DisplayHelpTextFromStringLabel(0, 0, 1, -1) + if IsControlJustReleased(0, Keys['E']) then + isInZone = true -- unless we set this boolean to false, we will always freeze the user + if CurrentAction == 'exitMarker' then + isInZone = false -- do not freeze user + TriggerEvent('esx_drugs:freezePlayer', false) + TriggerEvent('esx_drugs:hasExitedMarker', lastZone) + Citizen.Wait(15000) + elseif CurrentAction == 'CokeField' then + TriggerServerEvent('esx_drugs:startHarvestCoke') + elseif CurrentAction == 'CokeProcessing' then + TriggerServerEvent('esx_drugs:startTransformCoke') + elseif CurrentAction == 'CokeDealer' then + TriggerServerEvent('esx_drugs:startSellCoke') + elseif CurrentAction == 'MethField' then + TriggerServerEvent('esx_drugs:startHarvestMeth') + elseif CurrentAction == 'MethProcessing' then + TriggerServerEvent('esx_drugs:startTransformMeth') + elseif CurrentAction == 'MethDealer' then + TriggerServerEvent('esx_drugs:startSellMeth') + elseif CurrentAction == 'WeedField' then + TriggerServerEvent('esx_drugs:startHarvestWeed') + elseif CurrentAction == 'WeedProcessing' then + TriggerServerEvent('esx_drugs:startTransformWeed') + elseif CurrentAction == 'WeedDealer' then + TriggerServerEvent('esx_drugs:startSellWeed') + elseif CurrentAction == 'OpiumField' then + TriggerServerEvent('esx_drugs:startHarvestOpium') + elseif CurrentAction == 'OpiumProcessing' then + TriggerServerEvent('esx_drugs:startTransformOpium') + elseif CurrentAction == 'OpiumDealer' then + TriggerServerEvent('esx_drugs:startSellOpium') + else + isInZone = false -- not a esx_drugs zone + end + + if isInZone then + TriggerEvent('esx_drugs:freezePlayer', true) + end + + CurrentAction = nil + end + end + end +end) + +RegisterNetEvent('esx_drugs:freezePlayer') +AddEventHandler('esx_drugs:freezePlayer', function(freeze) + FreezeEntityPosition(GetPlayerPed(-1), freeze) end) diff --git a/config.lua b/config.lua index 9364e73a..08740a3a 100644 --- a/config.lua +++ b/config.lua @@ -3,23 +3,29 @@ Config.MarkerType = 1 Config.DrawDistance = 100.0 Config.ZoneSize = {x = 5.0, y = 5.0, z = 3.0} Config.MarkerColor = {r = 100, g = 204, b = 100} -Config.RequiredCopsCoke = 2 -Config.RequiredCopsMeth = 2 -Config.RequiredCopsWeed = 0 -Config.RequiredCopsOpium = 3 + +Config.RequiredCopsCoke = 2 +Config.RequiredCopsMeth = 2 +Config.RequiredCopsWeed = 2 +Config.RequiredCopsOpium = 2 + +Config.TimeToFarm = 17 * 1000 +Config.TimeToProcess = 46 * 1000 +Config.TimeToSell = 5 * 1000 + Config.Locale = 'fr' Config.Zones = { - CokeFarm = {x = 2448.92, y = -1836.80, z=51.95}, - CokeTreatment = {x = -458.13, y=-2278.61, z=7.51}, - CokeResell = {x = -1756.19, y=427.31, z=126.68}, - MethFarm = {x = 1525.29, y=1710.02, z=109.00}, - MethTreatment = {x = -1001.41, y=4848.00, z=274.00}, - MethResell = {x = -63.59, y=-1224.07, z=27.76}, - WeedFarm = {x = 1609.12, y=6663.59, z=20.96}, - WeedTreatment = {x = 91.06, y=3750.03, z=39.77}, - WeedResell = {x = -54.24, y=-1443.36, z=31.06}, - OpiumFarm = {x = 1972.78, y=3819.39, z=33.42}, - OpiumTreatment = {x = 971.86, y=-2157.61, z=28.47}, - OpiumResell = {x = 2331.08, y = 2570.22, z=46.68} + CokeField = {x = 2448.92, y = -1836.80, z = 51.95, name = _U('coke_field'), sprite = 501, color = 40}, + CokeProcessing = {x = -458.13, y = -2278.61, z = 7.51, name = _U('coke_processing'), sprite = 478, color = 40}, + CokeDealer = {x = -1756.19, y = 427.31, z =126.68, name = _U('coke_dealer'), sprite = 500, color = 75}, + MethField = {x = 1525.29, y = 1710.02, z = 109.00, name = _U('meth_field'), sprite = 499, color = 26}, + MethProcessing = {x = -1001.41, y = 4848.00, z = 274.00, name = _U('meth_processing'), sprite = 499, color = 26}, + MethDealer = {x = -63.59, y = -1224.07, z = 27.76, name = _U('meth_dealer'), sprite = 500, color = 75}, + WeedField = {x = 1609.12, y = 6663.59, z = 20.96, name = _U('weed_field'), sprite = 496, color = 52}, + WeedProcessing = {x = 91.06, y = 3750.03, z = 39.77, name = _U('weed_processing'), sprite = 496, color = 52}, + WeedDealer = {x = -54.24, y = -1443.36, z = 31.06, name = _U('weed_dealer'), sprite = 500, color = 75}, + OpiumField = {x = 1972.78, y = 3819.39, z = 32.50, name = _U('opium_field'), sprite = 51, color = 60}, + OpiumProcessing = {x = 971.86, y = -2157.00, z = 28.47, name = _U('opium_processing'), sprite = 51, color = 60}, + OpiumDealer = {x = 2331.08, y = 2570.22, z = 46.68, name = _U('opium_dealer'), sprite = 500, color = 75} } diff --git a/de_esx_drugs.sql b/de_esx_drugs.sql deleted file mode 100644 index 5ffb3e66..00000000 --- a/de_esx_drugs.sql +++ /dev/null @@ -1,10 +0,0 @@ -INSERT INTO `items` (name, label) VALUES - ('weed', 'Grass'), - ('weed_pooch', 'Portion Grass'), - ('coke', 'Koks'), - ('coke_pooch', 'Portion Koks'), - ('meth', 'Meth'), - ('meth_pooch', 'Portion Meth'), - ('opium', 'Opium'), - ('opium_pooch', 'Portion Opium') -; \ No newline at end of file diff --git a/esx_drugs.sql b/esx_drugs.sql index 17d92a2d..2c29fb45 100644 --- a/esx_drugs.sql +++ b/esx_drugs.sql @@ -1,10 +1,10 @@ -INSERT INTO `items` (name, label) VALUES - ('weed', 'Weed'), - ('weed_pooch', 'Pochon de weed'), - ('coke', 'Coke'), - ('coke_pooch', 'Pochon de coke'), - ('meth', 'Meth'), - ('meth_pooch', 'Pochon de meth'), - ('opium', 'Opium'), - ('opium_pooch', 'Pochon de opium') +INSERT INTO `items` (name, label, `limit`) VALUES + ('weed', 'Weed', 50), + ('weed_pooch', 'Pochon de weed', 10), + ('coke', 'Coke', 50), + ('coke_pooch', 'Pochon de coke', 10), + ('meth', 'Meth', 50), + ('meth_pooch', 'Pochon de meth', 10), + ('opium', 'Opium', 50), + ('opium_pooch', 'Pochon de opium', 10) ; \ No newline at end of file diff --git a/locales/br.lua b/locales/br.lua index ad9c5401..e2e0f942 100644 --- a/locales/br.lua +++ b/locales/br.lua @@ -1,36 +1,48 @@ Locales['br'] = { - - ['press_collect_coke'] = 'Pressione ~INPUT_CONTEXT~ para coletar coca', - ['press_process_coke'] = 'Pressione ~INPUT_CONTEXT~ para processar a coca', - ['press_sell_coke'] = 'Pressione ~INPUT_CONTEXT~ para vender coca', - ['press_collect_meth'] = 'Pressione ~INPUT_CONTEXT~ para coletar metanfetamina', - ['press_process_meth'] = 'Pressione ~INPUT_CONTEXT~ para processar metanfetamina', - ['press_sell_meth'] = 'Pressione ~INPUT_CONTEXT~ para vender metanfetamina', - ['press_collect_weed'] = 'Pressione ~INPUT_CONTEXT~ para coletar erva', - ['press_process_weed'] = 'Pressione ~INPUT_CONTEXT~ para processar erva', - ['press_sell_opium'] = 'Pressione ~INPUT_CONTEXT~ para vender ópio', + ['press_collect_coke'] = 'Pressione ~INPUT_CONTEXT~ para coletar coca', + ['press_process_coke'] = 'Pressione ~INPUT_CONTEXT~ para processar a coca', + ['press_sell_coke'] = 'Pressione ~INPUT_CONTEXT~ para vender coca', + ['press_collect_meth'] = 'Pressione ~INPUT_CONTEXT~ para coletar metanfetamina', + ['press_process_meth'] = 'Pressione ~INPUT_CONTEXT~ para processar metanfetamina', + ['press_sell_meth'] = 'Pressione ~INPUT_CONTEXT~ para vender metanfetamina', + ['press_collect_weed'] = 'Pressione ~INPUT_CONTEXT~ para coletar erva', + ['press_process_weed'] = 'Pressione ~INPUT_CONTEXT~ para processar erva', + ['press_sell_opium'] = 'Pressione ~INPUT_CONTEXT~ para vender ópio', ['press_collect_opium'] = 'Pressione ~INPUT_CONTEXT~ para coletar ópio', - ['press_process_opium'] = 'Pressione ~INPUT_CONTEXT~ para processar ópio', - ['press_sell_weed'] = 'Pressione ~INPUT_CONTEXT~ para vender erva', - ['act_imp_police'] = 'Ação ~r~impossivel~s~, ~b~polícia~s~: ~o~%s~s~/~y~%s~s~ online', - ['inv_full_coke'] = 'Você não pode mais coletar a Cocaína, seu estoque está ~r~cheio~s~', - ['pickup_in_prog'] = '~y~Colheita em progresso~s~...', - ['too_many_pouches'] = 'Você tem muitas trouxinhas', - ['not_enough_coke'] = 'Você não tem folha de coca suficiente para ~r~empacotar~s~', - ['packing_in_prog'] = '~y~Empacotamento em progresso~s~...', - ['no_pouchs_sale'] = 'Você não tem mais trouxinhas para ~r~vender~s~', - ['sold_one_coke'] = 'Você vendeu ~g~x1 Trouxinha de Cocaína~s~', - ['sale_in_prog'] = '~g~Venda em progresso~s~...', - ['inv_full_meth'] = 'Você não pode mais coletar metanfetamina, seu inventário está ~r~cheio~s~', - ['not_enough_meth'] = 'Você não tem metanfetamina suficiente para ~r~embalar~s~', - ['sold_one_meth'] = 'Você vendeu ~g~x1 Trouxinha de Metanfetamina~s~', - ['inv_full_weed'] = 'Você não pode mais coletar erva, seu inventário está ~r~cheio~s~', - ['not_enough_weed'] = 'Você não tem erva suficiente para ~r~embalar~s~', - ['sold_one_weed'] = 'Você vendeu ~g~x1 Trouxinha de erva~s~', - ['used_one_weed'] = 'Você usou 1 trouxinha de ~b~erva', + ['press_process_opium'] = 'Pressione ~INPUT_CONTEXT~ para processar ópio', + ['press_sell_weed'] = 'Pressione ~INPUT_CONTEXT~ para vender erva', + ['act_imp_police'] = 'Ação ~r~impossivel~s~, ~b~polícia~s~: ~o~%s~s~/~y~%s~s~ online', + ['inv_full_coke'] = 'Você não pode mais coletar a Cocaína, seu estoque está ~r~cheio~s~', + ['pickup_in_prog'] = '~y~Colheita em progresso~s~...', + ['too_many_pouches'] = 'Você tem muitas trouxinhas', + ['not_enough_coke'] = 'Você não tem folha de coca suficiente para ~r~empacotar~s~', + ['packing_in_prog'] = '~y~Empacotamento em progresso~s~...', + ['no_pouchs_sale'] = 'Você não tem mais trouxinhas para ~r~vender~s~', + ['sold_one_coke'] = 'Você vendeu ~g~x1 Trouxinha de Cocaína~s~', + ['sale_in_prog'] = '~g~Venda em progresso~s~...', + ['inv_full_meth'] = 'Você não pode mais coletar metanfetamina, seu inventário está ~r~cheio~s~', + ['not_enough_meth'] = 'Você não tem metanfetamina suficiente para ~r~embalar~s~', + ['sold_one_meth'] = 'Você vendeu ~g~x1 Trouxinha de Metanfetamina~s~', + ['inv_full_weed'] = 'Você não pode mais coletar erva, seu inventário está ~r~cheio~s~', + ['not_enough_weed'] = 'Você não tem erva suficiente para ~r~embalar~s~', + ['sold_one_weed'] = 'Você vendeu ~g~x1 Trouxinha de erva~s~', + ['used_one_weed'] = 'Você usou 1 trouxinha de ~b~erva', ['inv_full_opium'] = 'Você não pode mais coletar ópio, seu inventário está ~r~cheio~s~', - ['not_enough_opium'] = 'Você não tem ópio suficiente para ~r~embalar~s~', - ['sold_one_opium'] = 'Você vendeu ~g~x1 Trouxinha de ópio~s~', - ['used_one_opium'] = 'Você usou 1 trouxinha de ~b~ópio', - + ['not_enough_opium'] = 'Você não tem ópio suficiente para ~r~embalar~s~', + ['sold_one_opium'] = 'Você vendeu ~g~x1 Trouxinha de ópio~s~', + ['used_one_opium'] = 'Você usou 1 trouxinha de ~b~ópio', + ['exit_marker'] = 'press ~INPUT_CONTEXT~ to cancel the ~y~process~s~', + -- Blips + ['coke_field'] = 'cocaine Field', + ['coke_processing'] = 'cocaine Processing', + ['coke_dealer'] = 'cocaine Dealer', + ['meth_field'] = 'meth Field', + ['meth_processing'] = 'meth Processing', + ['meth_dealer'] = 'meth Dealer', + ['weed_field'] = 'weed Field', + ['weed_processing'] = 'weed Processing', + ['weed_dealer'] = 'weed Dealer', + ['opium_field'] = 'opium Field', + ['opium_processing'] = 'opium Processing', + ['opium_dealer'] = 'opium Dealer', } \ No newline at end of file diff --git a/locales/de.lua b/locales/de.lua index a4451407..2c1d9143 100644 --- a/locales/de.lua +++ b/locales/de.lua @@ -1,36 +1,48 @@ Locales['de'] = { - - ['press_collect_coke'] = 'drücke ~INPUT_CONTEXT~ um Koks zu sammeln', - ['press_process_coke'] = 'drücke ~INPUT_CONTEXT~ um Koks zu verarbeiten', - ['press_sell_coke'] = 'drücke ~INPUT_CONTEXT~ um Koks zu verkaufen', - ['press_collect_meth'] = 'drücke ~INPUT_CONTEXT~ um Meth zu sammeln', - ['press_process_meth'] = 'drücke ~INPUT_CONTEXT~ um Meth zu verarbeiten', - ['press_sell_meth'] = 'drücke ~INPUT_CONTEXT~ um Meth zu verkaufen', - ['press_collect_weed'] = 'drücke ~INPUT_CONTEXT~ um Grass zu sammeln', - ['press_process_weed'] = 'drücke ~INPUT_CONTEXT~ um Grass zu verarbeiten', - ['press_sell_weed'] = 'drücke ~INPUT_CONTEXT~ um Grass zu verkaufen', + ['press_collect_coke'] = 'drücke ~INPUT_CONTEXT~ um Koks zu sammeln', + ['press_process_coke'] = 'drücke ~INPUT_CONTEXT~ um Koks zu verarbeiten', + ['press_sell_coke'] = 'drücke ~INPUT_CONTEXT~ um Koks zu verkaufen', + ['press_collect_meth'] = 'drücke ~INPUT_CONTEXT~ um Meth zu sammeln', + ['press_process_meth'] = 'drücke ~INPUT_CONTEXT~ um Meth zu verarbeiten', + ['press_sell_meth'] = 'drücke ~INPUT_CONTEXT~ um Meth zu verkaufen', + ['press_collect_weed'] = 'drücke ~INPUT_CONTEXT~ um Grass zu sammeln', + ['press_process_weed'] = 'drücke ~INPUT_CONTEXT~ um Grass zu verarbeiten', + ['press_sell_weed'] = 'drücke ~INPUT_CONTEXT~ um Grass zu verkaufen', ['press_collect_opium'] = 'drücke ~INPUT_CONTEXT~ um Opium zu sammeln', - ['press_process_opium'] = 'drücke ~INPUT_CONTEXT~ um Opium zu verarbeiten', - ['press_sell_opium'] = 'drücke ~INPUT_CONTEXT~ um Opium zu verkaufen', - ['act_imp_police'] = 'aktion ~r~nihct möglich~s~, ~b~Polizisten~s~: ~o~%s~s~/~y~%s~s~ online', - ['inv_full_coke'] = 'Du kannst nicht länger Koks sammeln, dein Inventar ist ~r~VOLL~s~', - ['pickup_in_prog'] = '~y~Sammeln im gange~s~...', - ['too_many_pouches'] = 'du hast zuviele Pakete', - ['not_enough_coke'] = 'du hast nicht genug Koks zum ~r~verpacken~s~', - ['packing_in_prog'] = '~y~Verarbeitung im gange~s~...', - ['no_pouchs_sale'] = 'Du hast nicht genug Portionen zum ~r~verkaufen~s~', - ['sold_one_coke'] = 'du verkaufst ~g~x1 Portion Koks~s~', - ['sale_in_prog'] = '~g~Verkauf im gange~s~...', - ['inv_full_meth'] = 'Du kannst nicht länger Meth sammeln, dein Inventar ist ~r~VOLL~s~', - ['not_enough_meth'] = 'du hast nicht genug Meth zum ~r~verpacken~s~', - ['sold_one_meth'] = 'du verkaufst ~g~x1 Portion Meth~s~', - ['inv_full_weed'] = 'Du kannst nicht länger Grass sammeln, dein Inventar ist ~r~VOLL~s~', - ['not_enough_weed'] = 'du hast nicht genug Grass zum ~r~verarbeiten~s~', - ['sold_one_weed'] = 'du verkaufst ~g~x1 Portion Grass~s~', - ['used_one_weed'] = 'du benutzt 1x ~b~Grass', + ['press_process_opium'] = 'drücke ~INPUT_CONTEXT~ um Opium zu verarbeiten', + ['press_sell_opium'] = 'drücke ~INPUT_CONTEXT~ um Opium zu verkaufen', + ['act_imp_police'] = 'aktion ~r~nihct möglich~s~, ~b~Polizisten~s~: ~o~%s~s~/~y~%s~s~ online', + ['inv_full_coke'] = 'Du kannst nicht länger Koks sammeln, dein Inventar ist ~r~VOLL~s~', + ['pickup_in_prog'] = '~y~Sammeln im gange~s~...', + ['too_many_pouches'] = 'du hast zuviele Pakete', + ['not_enough_coke'] = 'du hast nicht genug Koks zum ~r~verpacken~s~', + ['packing_in_prog'] = '~y~Verarbeitung im gange~s~...', + ['no_pouchs_sale'] = 'Du hast nicht genug Portionen zum ~r~verkaufen~s~', + ['sold_one_coke'] = 'du verkaufst ~g~x1 Portion Koks~s~', + ['sale_in_prog'] = '~g~Verkauf im gange~s~...', + ['inv_full_meth'] = 'Du kannst nicht länger Meth sammeln, dein Inventar ist ~r~VOLL~s~', + ['not_enough_meth'] = 'du hast nicht genug Meth zum ~r~verpacken~s~', + ['sold_one_meth'] = 'du verkaufst ~g~x1 Portion Meth~s~', + ['inv_full_weed'] = 'Du kannst nicht länger Grass sammeln, dein Inventar ist ~r~VOLL~s~', + ['not_enough_weed'] = 'du hast nicht genug Grass zum ~r~verarbeiten~s~', + ['sold_one_weed'] = 'du verkaufst ~g~x1 Portion Grass~s~', + ['used_one_weed'] = 'du benutzt 1x ~b~Grass', ['inv_full_opium'] = 'Du kannst nicht länger Opium sammeln, dein Inventar ist ~r~VOLL~s~', - ['not_enough_opium'] = 'du hast nicht genug Opium zum ~r~verarbeiten~s~', - ['sold_one_opium'] = 'du verkaufst ~g~x1 Portion Opium~s~', - ['used_one_opium'] = 'du benutzt 1x ~b~Opium', - + ['not_enough_opium'] = 'du hast nicht genug Opium zum ~r~verarbeiten~s~', + ['sold_one_opium'] = 'du verkaufst ~g~x1 Portion Opium~s~', + ['used_one_opium'] = 'du benutzt 1x ~b~Opium', + ['exit_marker'] = 'press ~INPUT_CONTEXT~ to cancel the ~y~process~s~', + -- Blips + ['coke_field'] = 'cocaine Field', + ['coke_processing'] = 'cocaine Processing', + ['coke_dealer'] = 'cocaine Dealer', + ['meth_field'] = 'meth Field', + ['meth_processing'] = 'meth Processing', + ['meth_dealer'] = 'meth Dealer', + ['weed_field'] = 'weed Field', + ['weed_processing'] = 'weed Processing', + ['weed_dealer'] = 'weed Dealer', + ['opium_field'] = 'opium Field', + ['opium_processing'] = 'opium Processing', + ['opium_dealer'] = 'opium Dealer', } \ No newline at end of file diff --git a/locales/en.lua b/locales/en.lua index 0de5362c..1358430f 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -1,8 +1,7 @@ Locales['en'] = { - - ['press_collect_coke'] = 'press ~INPUT_CONTEXT~ to collect coke', - ['press_process_coke'] = 'press ~INPUT_CONTEXT~ to process coke', - ['press_sell_coke'] = 'press ~INPUT_CONTEXT~ to sell coke', + ['press_collect_coke'] = 'press ~INPUT_CONTEXT~ to collect cocaine', + ['press_process_coke'] = 'press ~INPUT_CONTEXT~ to process cocaine', + ['press_sell_coke'] = 'press ~INPUT_CONTEXT~ to sell cocaine', ['press_collect_meth'] = 'press ~INPUT_CONTEXT~ to collect meth', ['press_process_meth'] = 'press ~INPUT_CONTEXT~ to process meth', ['press_sell_meth'] = 'press ~INPUT_CONTEXT~ to sell meth', @@ -12,14 +11,14 @@ Locales['en'] = { ['press_collect_opium'] = 'press ~INPUT_CONTEXT~ to collect opium', ['press_process_opium'] = 'press ~INPUT_CONTEXT~ to process opium', ['press_sell_opium'] = 'press ~INPUT_CONTEXT~ to sell opium', - ['act_imp_police'] = 'you cannot participate illegal activities unless there\'s enough cops online (~o~%s~s~/~y~%s~s~ online)', + ['act_imp_police'] = 'you cannot participate illegal activities unless there\'s enough cops online: ~o~%s~s~/~y~%s~s~ online', ['inv_full_coke'] = 'you can no longer collect Cocaine, your inventory is ~r~full~s~', ['pickup_in_prog'] = '~y~Pickup in progress~s~...', ['too_many_pouches'] = 'you have too many pouches', - ['not_enough_coke'] = 'you do not have enough coca leaf to ~r~pack~s~', + ['not_enough_coke'] = 'you do not have enough coke to ~r~pack~s~', ['packing_in_prog'] = '~y~Packaging in progress~s~...', ['no_pouchs_sale'] = 'You have no more pouches for ~r~sale~s~', - ['sold_one_coke'] = 'you\'ve sold ~g~x1 Coke Pouch~s~', + ['sold_one_coke'] = 'you\'ve sold ~y~x1~s~ ~y~Cocaine Pouch~s~', ['sale_in_prog'] = '~g~Sale in progress~s~...', ['inv_full_meth'] = 'you can no longer collect Meth, your inventory is ~r~full~s~', ['not_enough_meth'] = 'you do not have enough Meth to ~r~pack~s~', @@ -32,5 +31,18 @@ Locales['en'] = { ['not_enough_opium'] = 'you do not have enough opium to ~r~pack~s~', ['sold_one_opium'] = 'you\'ve sold ~g~x1 opium Pouch~s~', ['used_one_opium'] = 'you used 1 pouch of ~b~opium', - + ['exit_marker'] = 'press ~INPUT_CONTEXT~ to cancel the ~y~process~s~', + -- Blips + ['coke_field'] = 'cocaine Field', + ['coke_processing'] = 'cocaine Processing', + ['coke_dealer'] = 'cocaine Dealer', + ['meth_field'] = 'meth Field', + ['meth_processing'] = 'meth Processing', + ['meth_dealer'] = 'meth Dealer', + ['weed_field'] = 'weed Field', + ['weed_processing'] = 'weed Processing', + ['weed_dealer'] = 'weed Dealer', + ['opium_field'] = 'opium Field', + ['opium_processing'] = 'opium Processing', + ['opium_dealer'] = 'opium Dealer', } \ No newline at end of file diff --git a/locales/es.lua b/locales/es.lua index 47a27a94..60625a26 100644 --- a/locales/es.lua +++ b/locales/es.lua @@ -1,36 +1,48 @@ Locales['es'] = { - - ['press_collect_coke'] = 'Presiona ~INPUT_CONTEXT~ para cosechar la Coca', - ['press_process_coke'] = 'Presiona ~INPUT_CONTEXT~ para tratar la Coca', - ['press_sell_coke'] = 'Presiona ~INPUT_CONTEXT~ para vender la Coca', - ['press_collect_meth'] = 'Presiona ~INPUT_CONTEXT~ para recoger ingredientes del LSD', - ['press_process_meth'] = 'Presiona ~INPUT_CONTEXT~ para cocinar el LSD', - ['press_sell_meth'] = 'Presiona ~INPUT_CONTEXT~ para vender el LSD', - ['press_collect_weed'] = 'Presiona ~INPUT_CONTEXT~ para cosechar el Hierbón', - ['press_process_weed'] = 'Presiona ~INPUT_CONTEXT~ para embolsar el Hierbón', - ['press_sell_weed'] = 'Presiona ~INPUT_CONTEXT~ para vender el Hierbón', - ['press_collect_opium'] = "Presiona ~INPUT_CONTEXT~ para cosechar el Opio", - ['press_process_opium'] = "Presiona ~INPUT_CONTEXT~ para tratar el Opio", - ['press_sell_opium'] = "Presiona ~INPUT_CONTEXT~ para vender el Opio", - ['act_imp_police'] = 'Acción ~r~imposible~s~, ~b~policias~s~: ~o~%s~s~/~y~%s~s~ online', - ['inv_full_coke'] = 'No puedes recoger mas cocaina, tu inventario está ~r~lleno~s~', - ['pickup_in_prog'] = '~y~Recogida en curso~s~...', - ['too_many_pouches'] = 'Tienes demasiadas bolsas', - ['not_enough_coke'] = 'No tienes suficiente hoja de coca para ~r~fabricar~s~', - ['packing_in_prog'] = '~y~Fabricación en curso~s~...', - ['no_pouches_sale'] = 'No tienes mas bolsas para ~r~vender~s~', - ['sold_one_coke'] = 'Has vendido ~g~1 Gramo de Coca~s~', - ['sale_in_prog'] = '~g~Venta en curso~s~...', - ['inv_full_meth'] = 'No puedes recoger mas ingredientes, tu inventario está ~r~lleno~s~', - ['not_enough_meth'] = 'No tienes suficientes ingredientes para ~r~fabricar~s~ mas LSD', - ['sold_one_meth'] = 'Has vendido ~g~1 Bote de LSD~s~', - ['inv_full_weed'] = 'No puedes recoger mas hierba, tu inventario está ~r~lleno~s~', - ['not_enough_weed'] = 'No tienes suficiente hierba para ~r~embolsar~s~', - ['sold_one_weed'] = 'Has vendido ~g~1 Bolsa de Hierbón~s~', - ['used_one_weed'] = 'Has gastado una bolsa de ~b~hierbón', - ['inv_full_opium'] = 'No puedes recoger mas hierba, tu inventario está ~r~lleno~s~', - ['not_enough_opium'] = 'No tienes sufiente Opio para ~r~fabricar~s~', - ['sold_one_opium'] = 'Has vendido ~g~1 Bolsa de Opio~s~', - ['used_one_opium'] = 'Has gastado una bolsa de ~b~Opio', - -} + ['press_collect_coke'] = 'Presiona ~INPUT_CONTEXT~ para cosechar la Coca', + ['press_process_coke'] = 'Presiona ~INPUT_CONTEXT~ para tratar la Coca', + ['press_sell_coke'] = 'Presiona ~INPUT_CONTEXT~ para vender la Coca', + ['press_collect_meth'] = 'Presiona ~INPUT_CONTEXT~ para recoger ingredientes del LSD', + ['press_process_meth'] = 'Presiona ~INPUT_CONTEXT~ para cocinar el LSD', + ['press_sell_meth'] = 'Presiona ~INPUT_CONTEXT~ para vender el LSD', + ['press_collect_weed'] = 'Presiona ~INPUT_CONTEXT~ para cosechar el Hierbón', + ['press_process_weed'] = 'Presiona ~INPUT_CONTEXT~ para embolsar el Hierbón', + ['press_sell_weed'] = 'Presiona ~INPUT_CONTEXT~ para vender el Hierbón', + ['press_collect_opium'] = "Presiona ~INPUT_CONTEXT~ para cosechar el Opio", + ['press_process_opium'] = "Presiona ~INPUT_CONTEXT~ para tratar el Opio", + ['press_sell_opium'] = "Presiona ~INPUT_CONTEXT~ para vender el Opio", + ['act_imp_police'] = 'Acción ~r~imposible~s~, ~b~policias~s~: ~o~%s~s~/~y~%s~s~ online', + ['inv_full_coke'] = 'No puedes recoger mas cocaina, tu inventario está ~r~lleno~s~', + ['pickup_in_prog'] = '~y~Recogida en curso~s~...', + ['too_many_pouches'] = 'Tienes demasiadas bolsas', + ['not_enough_coke'] = 'No tienes suficiente hoja de coca para ~r~fabricar~s~', + ['packing_in_prog'] = '~y~Fabricación en curso~s~...', + ['no_pouches_sale'] = 'No tienes mas bolsas para ~r~vender~s~', + ['sold_one_coke'] = 'Has vendido ~g~1 Gramo de Coca~s~', + ['sale_in_prog'] = '~g~Venta en curso~s~...', + ['inv_full_meth'] = 'No puedes recoger mas ingredientes, tu inventario está ~r~lleno~s~', + ['not_enough_meth'] = 'No tienes suficientes ingredientes para ~r~fabricar~s~ mas LSD', + ['sold_one_meth'] = 'Has vendido ~g~1 Bote de LSD~s~', + ['inv_full_weed'] = 'No puedes recoger mas hierba, tu inventario está ~r~lleno~s~', + ['not_enough_weed'] = 'No tienes suficiente hierba para ~r~embolsar~s~', + ['sold_one_weed'] = 'Has vendido ~g~1 Bolsa de Hierbón~s~', + ['used_one_weed'] = 'Has gastado una bolsa de ~b~hierbón', + ['inv_full_opium'] = 'No puedes recoger mas hierba, tu inventario está ~r~lleno~s~', + ['not_enough_opium'] = 'No tienes sufiente Opio para ~r~fabricar~s~', + ['sold_one_opium'] = 'Has vendido ~g~1 Bolsa de Opio~s~', + ['used_one_opium'] = 'Has gastado una bolsa de ~b~Opio', + ['exit_marker'] = 'press ~INPUT_CONTEXT~ to cancel the ~y~process~s~', + -- Blips + ['coke_field'] = 'cocaine Field', + ['coke_processing'] = 'cocaine Processing', + ['coke_dealer'] = 'cocaine Dealer', + ['meth_field'] = 'meth Field', + ['meth_processing'] = 'meth Processing', + ['meth_dealer'] = 'meth Dealer', + ['weed_field'] = 'weed Field', + ['weed_processing'] = 'weed Processing', + ['weed_dealer'] = 'weed Dealer', + ['opium_field'] = 'opium Field', + ['opium_processing'] = 'opium Processing', + ['opium_dealer'] = 'opium Dealer', +} \ No newline at end of file diff --git a/locales/fr.lua b/locales/fr.lua index 423cfd1c..e7cdcf5a 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -1,36 +1,48 @@ Locales['fr'] = { - - ['press_collect_coke'] = 'appuyez sur ~INPUT_CONTEXT~ pour récolter la coke', - ['press_process_coke'] = 'appuyez sur ~INPUT_CONTEXT~ pour traiter la coke', - ['press_sell_coke'] = 'appuyez sur ~INPUT_CONTEXT~ pour vendre la coke', - ['press_collect_meth'] = 'appuyez sur ~INPUT_CONTEXT~ pour récolter la meth', - ['press_process_meth'] = 'appuyez sur ~INPUT_CONTEXT~ pour traiter la meth', - ['press_sell_meth'] = 'appuyez sur ~INPUT_CONTEXT~ pour vendre la meth', - ['press_collect_weed'] = 'appuyez sur ~INPUT_CONTEXT~ pour récolter la weed', - ['press_process_weed'] = 'appuyez sur ~INPUT_CONTEXT~ pour traiter la weed', - ['press_sell_weed'] = 'appuyez sur ~INPUT_CONTEXT~ pour vendre la weed', + ['press_collect_coke'] = 'appuyez sur ~INPUT_CONTEXT~ pour récolter la coke', + ['press_process_coke'] = 'appuyez sur ~INPUT_CONTEXT~ pour traiter la coke', + ['press_sell_coke'] = 'appuyez sur ~INPUT_CONTEXT~ pour vendre la coke', + ['press_collect_meth'] = 'appuyez sur ~INPUT_CONTEXT~ pour récolter la meth', + ['press_process_meth'] = 'appuyez sur ~INPUT_CONTEXT~ pour traiter la meth', + ['press_sell_meth'] = 'appuyez sur ~INPUT_CONTEXT~ pour vendre la meth', + ['press_collect_weed'] = 'appuyez sur ~INPUT_CONTEXT~ pour récolter la weed', + ['press_process_weed'] = 'appuyez sur ~INPUT_CONTEXT~ pour traiter la weed', + ['press_sell_weed'] = 'appuyez sur ~INPUT_CONTEXT~ pour vendre la weed', ['press_collect_opium'] = "appuyez sur ~INPUT_CONTEXT~ pour récolter l'opium", - ['press_process_opium'] = "appuyez sur ~INPUT_CONTEXT~ pour traiter l'opium", - ['press_sell_opium'] = "appuyez sur ~INPUT_CONTEXT~ pour vendre l'opium", - ['act_imp_police'] = 'action ~r~impossible~s~, ~b~policiers~s~: ~o~%s~s~/~y~%s~s~ online', - ['inv_full_coke'] = 'vous ne pouvez plus ramasser de Cocaine, votre inventaire est ~r~plein~s~', - ['pickup_in_prog'] = '~y~Ramassage en cours~s~...', - ['too_many_pouches'] = 'vous avez trop de pochons', - ['not_enough_coke'] = 'vous n\'avez pas assez de feuille de coca à ~r~conditionner~s~', - ['packing_in_prog'] = '~y~Conditonnement en cours~s~...', - ['no_pouches_sale'] = 'vous n\'avez plus de pochons à ~r~vendre~s~', - ['sold_one_coke'] = 'vous avez vendu ~g~x1 Pochon de coke~s~', - ['sale_in_prog'] = '~g~Vente en cours~s~...', - ['inv_full_meth'] = 'vous ne pouvez plus ramasser de Meth, votre inventaire est ~r~plein~s~', - ['not_enough_meth'] = 'vous n\'avez pas assez de Meth à ~r~conditionner~s~', - ['sold_one_meth'] = 'vous avez vendu ~g~x1 Pochon de meth~s~', - ['inv_full_weed'] = 'vous ne pouvez plus ramasser de weed, votre inventaire est ~r~plein~s~', - ['not_enough_weed'] = 'vous n\'avez pas assez de weed à ~r~conditionner~s~', - ['sold_one_weed'] = 'vous avez vendu ~g~x1 Pochon de weed~s~', - ['used_one_weed'] = 'Vous avez utilisé 1 Pochon de ~b~weed', + ['press_process_opium'] = "appuyez sur ~INPUT_CONTEXT~ pour traiter l'opium", + ['press_sell_opium'] = "appuyez sur ~INPUT_CONTEXT~ pour vendre l'opium", + ['act_imp_police'] = 'action ~r~impossible~s~, ~b~policiers~s~: ~o~%s~s~/~y~%s~s~ online', + ['inv_full_coke'] = 'vous ne pouvez plus ramasser de Cocaine, votre inventaire est ~r~plein~s~', + ['pickup_in_prog'] = '~y~Ramassage en cours~s~...', + ['too_many_pouches'] = 'vous avez trop de pochons', + ['not_enough_coke'] = 'vous n\'avez pas assez de feuille de coca à ~r~conditionner~s~', + ['packing_in_prog'] = '~y~Conditonnement en cours~s~...', + ['no_pouches_sale'] = 'vous n\'avez plus de pochons à ~r~vendre~s~', + ['sold_one_coke'] = 'vous avez vendu ~g~x1 Pochon de coke~s~', + ['sale_in_prog'] = '~g~Vente en cours~s~...', + ['inv_full_meth'] = 'vous ne pouvez plus ramasser de Meth, votre inventaire est ~r~plein~s~', + ['not_enough_meth'] = 'vous n\'avez pas assez de Meth à ~r~conditionner~s~', + ['sold_one_meth'] = 'vous avez vendu ~g~x1 Pochon de meth~s~', + ['inv_full_weed'] = 'vous ne pouvez plus ramasser de weed, votre inventaire est ~r~plein~s~', + ['not_enough_weed'] = 'vous n\'avez pas assez de weed à ~r~conditionner~s~', + ['sold_one_weed'] = 'vous avez vendu ~g~x1 Pochon de weed~s~', + ['used_one_weed'] = 'Vous avez utilisé 1 Pochon de ~b~weed', ['inv_full_opium'] = 'vous ne pouvez plus ramasser de weed, votre inventaire est ~r~plein~s~', - ['not_enough_opium'] = 'vous n\'avez pas assez de opium à ~r~conditionner~s~', - ['sold_one_opium'] = 'vous avez vendu ~g~x1 Pochon de opium~s~', - ['used_one_opium'] = 'Vous avez utilisé 1 Pochon de ~b~opium', - + ['not_enough_opium'] = 'vous n\'avez pas assez de opium à ~r~conditionner~s~', + ['sold_one_opium'] = 'vous avez vendu ~g~x1 Pochon de opium~s~', + ['used_one_opium'] = 'Vous avez utilisé 1 Pochon de ~b~opium', + ['exit_marker'] = 'press ~INPUT_CONTEXT~ to cancel the ~y~process~s~', + -- Blips + ['coke_field'] = 'cocaine Field', + ['coke_processing'] = 'cocaine Processing', + ['coke_dealer'] = 'cocaine Dealer', + ['meth_field'] = 'meth Field', + ['meth_processing'] = 'meth Processing', + ['meth_dealer'] = 'meth Dealer', + ['weed_field'] = 'weed Field', + ['weed_processing'] = 'weed Processing', + ['weed_dealer'] = 'weed Dealer', + ['opium_field'] = 'opium Field', + ['opium_processing'] = 'opium Processing', + ['opium_dealer'] = 'opium Dealer', } \ No newline at end of file diff --git a/locales/sv.lua b/locales/sv.lua index c1dcd666..07a9b65f 100644 --- a/locales/sv.lua +++ b/locales/sv.lua @@ -1,5 +1,4 @@ Locales['sv'] = { - ['press_collect_coke'] = 'klicka ~INPUT_CONTEXT~ för att plocka kokain', ['press_process_coke'] = 'klicka ~INPUT_CONTEXT~ för att bearbeta kokain', ['press_sell_coke'] = 'klicka ~INPUT_CONTEXT~ för att sälja coke', @@ -32,5 +31,18 @@ Locales['sv'] = { ['not_enough_opium'] = 'Du har inte tillräckligt med opium för att ~r~bearbeta~s~', ['sold_one_opium'] = 'du har sålt ~y~1x~s~ ~b~väska med opium~s~', ['used_one_opium'] = 'Du använde 1 väska ~b~opium', - + ['exit_marker'] = 'tryck ~INPUT_CONTEXT~ för att avbryta pågående process', + -- Blips + ['coke_field'] = 'coke field', + ['coke_processing'] = 'coke processing', + ['coke_dealer'] = 'coke dealer', + ['meth_field'] = 'meth field', + ['meth_processing'] = 'meth processing', + ['meth_dealer'] = 'meth dealer', + ['weed_field'] = 'weed field', + ['weed_processing'] = 'weed processing', + ['weed_dealer'] = 'weed dealer', + ['opium_field'] = 'opium field', + ['opium_processing'] = 'opium processing', + ['opium_dealer'] = 'opium dealer', } diff --git a/localization/de_esx_drugs.sql b/localization/de_esx_drugs.sql new file mode 100644 index 00000000..cb7a11f8 --- /dev/null +++ b/localization/de_esx_drugs.sql @@ -0,0 +1,10 @@ +INSERT INTO `items` (name, label, `limit`) VALUES + ('weed', 'Grass', 50), + ('weed_pooch', 'Portion Grass', 10), + ('coke', 'Koks', 50), + ('coke_pooch', 'Portion Koks', 10), + ('meth', 'Meth', 50), + ('meth_pooch', 'Portion Meth', 10), + ('opium', 'Opium', 50), + ('opium_pooch', 'Portion Opium', 10) +; \ No newline at end of file diff --git a/localization/en_esx_drugs.sql b/localization/en_esx_drugs.sql new file mode 100644 index 00000000..a445c073 --- /dev/null +++ b/localization/en_esx_drugs.sql @@ -0,0 +1,10 @@ +INSERT INTO `items` (name, label, `limit`) VALUES + ('weed', 'Weed', 50), + ('weed_pooch', 'Bag of weed', 10), + ('coke', 'Cocaine', 50), + ('coke_pooch', 'Bag of cocaine', 10), + ('meth', 'Meth', 50), + ('meth_pooch', 'Bag of meth', 10), + ('opium', 'Opium', 50), + ('opium_pooch', 'Bag of opium', 10) +; diff --git a/localization/sv_esx_drugs.sql b/localization/sv_esx_drugs.sql new file mode 100644 index 00000000..3c7dd2a6 --- /dev/null +++ b/localization/sv_esx_drugs.sql @@ -0,0 +1,10 @@ +INSERT INTO `items` (name, label, `limit`) VALUES + ('weed', 'Cannabis', 50), + ('weed_pooch', 'Väska med cannabis', 10), + ('coke', 'Kokain', 50), + ('coke_pooch', 'Väska med kokain', 10), + ('meth', 'Meth', 50), + ('meth_pooch', 'Väska med meth', 10), + ('opium', 'Opium', 50), + ('opium_pooch', 'Väska med opium', 10) +; diff --git a/server/esx_drugs_sv.lua b/server/esx_drugs_sv.lua index 20371a3e..b5518db8 100644 --- a/server/esx_drugs_sv.lua +++ b/server/esx_drugs_sv.lua @@ -28,8 +28,7 @@ function CountCops() end end - SetTimeout(5000, CountCops) - + SetTimeout(120 * 1000, CountCops) end CountCops() @@ -42,7 +41,7 @@ local function HarvestCoke(source) return end - SetTimeout(5000, function() + SetTimeout(Config.TimeToFarm, function() if PlayersHarvestingCoke[source] == true then @@ -90,12 +89,12 @@ local function TransformCoke(source) return end - SetTimeout(10000, function() + SetTimeout(Config.TimeToProcess, function() if PlayersTransformingCoke[source] == true then - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) + local _source = source + local xPlayer = ESX.GetPlayerFromId(_source) local cokeQuantity = xPlayer.getInventoryItem('coke').count local poochQuantity = xPlayer.getInventoryItem('coke_pooch').count @@ -144,12 +143,12 @@ local function SellCoke(source) return end - SetTimeout(7500, function() + SetTimeout(Config.TimeToSell, function() if PlayersSellingCoke[source] == true then - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) + local _source = source + local xPlayer = ESX.GetPlayerFromId(_source) local poochQuantity = xPlayer.getInventoryItem('coke_pooch').count @@ -158,24 +157,24 @@ local function SellCoke(source) else xPlayer.removeInventoryItem('coke_pooch', 1) if CopsConnected == 0 then - xPlayer.addAccountMoney('black_money', 198) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) - elseif CopsConnected == 1 then - xPlayer.addAccountMoney('black_money', 258) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) - elseif CopsConnected == 2 then - xPlayer.addAccountMoney('black_money', 308) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) - elseif CopsConnected == 3 then - xPlayer.addAccountMoney('black_money', 358) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) - elseif CopsConnected == 4 then - xPlayer.addAccountMoney('black_money', 396) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) - elseif CopsConnected >= 5 then - xPlayer.addAccountMoney('black_money', 428) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) - end + xPlayer.addAccountMoney('black_money', 198) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) + elseif CopsConnected == 1 then + xPlayer.addAccountMoney('black_money', 258) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) + elseif CopsConnected == 2 then + xPlayer.addAccountMoney('black_money', 308) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) + elseif CopsConnected == 3 then + xPlayer.addAccountMoney('black_money', 358) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) + elseif CopsConnected == 4 then + xPlayer.addAccountMoney('black_money', 396) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) + elseif CopsConnected >= 5 then + xPlayer.addAccountMoney('black_money', 428) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) + end SellCoke(source) end @@ -214,12 +213,12 @@ local function HarvestMeth(source) return end - SetTimeout(5000, function() + SetTimeout(Config.TimeToFarm, function() if PlayersHarvestingMeth[source] == true then - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) + local _source = source + local xPlayer = ESX.GetPlayerFromId(_source) local meth = xPlayer.getInventoryItem('meth') @@ -263,12 +262,12 @@ local function TransformMeth(source) return end - SetTimeout(12000, function() + SetTimeout(Config.TimeToProcess, function() if PlayersTransformingMeth[source] == true then - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) + local _source = source + local xPlayer = ESX.GetPlayerFromId(_source) local methQuantity = xPlayer.getInventoryItem('meth').count local poochQuantity = xPlayer.getInventoryItem('meth_pooch').count @@ -317,12 +316,12 @@ local function SellMeth(source) return end - SetTimeout(7500, function() + SetTimeout(Config.TimeToSell, function() if PlayersSellingMeth[source] == true then - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) + local _source = source + local xPlayer = ESX.GetPlayerFromId(_source) local poochQuantity = xPlayer.getInventoryItem('meth_pooch').count @@ -331,27 +330,27 @@ local function SellMeth(source) else xPlayer.removeInventoryItem('meth_pooch', 1) if CopsConnected == 0 then - xPlayer.addAccountMoney('black_money', 276) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) - elseif CopsConnected == 1 then - xPlayer.addAccountMoney('black_money', 374) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) - elseif CopsConnected == 2 then - xPlayer.addAccountMoney('black_money', 474) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) - elseif CopsConnected == 3 then - xPlayer.addAccountMoney('black_money', 552) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) - elseif CopsConnected == 4 then - xPlayer.addAccountMoney('black_money', 616) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) - elseif CopsConnected == 5 then - xPlayer.addAccountMoney('black_money', 654) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) - elseif CopsConnected >= 6 then - xPlayer.addAccountMoney('black_money', 686) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) - end + xPlayer.addAccountMoney('black_money', 276) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) + elseif CopsConnected == 1 then + xPlayer.addAccountMoney('black_money', 374) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) + elseif CopsConnected == 2 then + xPlayer.addAccountMoney('black_money', 474) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) + elseif CopsConnected == 3 then + xPlayer.addAccountMoney('black_money', 552) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) + elseif CopsConnected == 4 then + xPlayer.addAccountMoney('black_money', 616) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) + elseif CopsConnected == 5 then + xPlayer.addAccountMoney('black_money', 654) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) + elseif CopsConnected >= 6 then + xPlayer.addAccountMoney('black_money', 686) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) + end SellMeth(source) end @@ -390,12 +389,12 @@ local function HarvestWeed(source) return end - SetTimeout(5000, function() + SetTimeout(Config.TimeToFarm, function() if PlayersHarvestingWeed[source] == true then local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) + local xPlayer = ESX.GetPlayerFromId(_source) local weed = xPlayer.getInventoryItem('weed') @@ -439,7 +438,7 @@ local function TransformWeed(source) return end - SetTimeout(7500, function() + SetTimeout(Config.TimeToProcess, function() if PlayersTransformingWeed[source] == true then @@ -492,7 +491,7 @@ local function SellWeed(source) return end - SetTimeout(7500, function() + SetTimeout(Config.TimeToSell, function() if PlayersSellingWeed[source] == true then @@ -505,22 +504,22 @@ local function SellWeed(source) TriggerClientEvent('esx:showNotification', source, _U('no_pouches_sale')) else xPlayer.removeInventoryItem('weed_pooch', 1) - if CopsConnected == 0 then - xPlayer.addAccountMoney('black_money', 108) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_weed')) - elseif CopsConnected == 1 then - xPlayer.addAccountMoney('black_money', 128) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_weed')) - elseif CopsConnected == 2 then - xPlayer.addAccountMoney('black_money', 152) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_weed')) - elseif CopsConnected == 3 then - xPlayer.addAccountMoney('black_money', 165) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_weed')) - elseif CopsConnected >= 4 then - xPlayer.addAccountMoney('black_money', 180) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_weed')) - end + if CopsConnected == 0 then + xPlayer.addAccountMoney('black_money', 108) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_weed')) + elseif CopsConnected == 1 then + xPlayer.addAccountMoney('black_money', 128) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_weed')) + elseif CopsConnected == 2 then + xPlayer.addAccountMoney('black_money', 152) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_weed')) + elseif CopsConnected == 3 then + xPlayer.addAccountMoney('black_money', 165) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_weed')) + elseif CopsConnected >= 4 then + xPlayer.addAccountMoney('black_money', 180) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_weed')) + end SellWeed(source) end @@ -561,12 +560,12 @@ local function HarvestOpium(source) return end - SetTimeout(5000, function() + SetTimeout(Config.TimeToFarm, function() if PlayersHarvestingOpium[source] == true then local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) + local xPlayer = ESX.GetPlayerFromId(_source) local opium = xPlayer.getInventoryItem('opium') @@ -610,7 +609,7 @@ local function TransformOpium(source) return end - SetTimeout(10000, function() + SetTimeout(Config.TimeToProcess, function() if PlayersTransformingOpium[source] == true then @@ -664,7 +663,7 @@ local function SellOpium(source) return end - SetTimeout(7500, function() + SetTimeout(Config.TimeToSell, function() if PlayersSellingOpium[source] == true then @@ -678,24 +677,24 @@ local function SellOpium(source) else xPlayer.removeInventoryItem('opium_pooch', 1) if CopsConnected == 0 then - xPlayer.addAccountMoney('black_money', 300) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) - elseif CopsConnected == 1 then - xPlayer.addAccountMoney('black_money', 500) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) - elseif CopsConnected == 2 then - xPlayer.addAccountMoney('black_money', 700) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) - elseif CopsConnected == 3 then - xPlayer.addAccountMoney('black_money', 800) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) - elseif CopsConnected == 4 then - xPlayer.addAccountMoney('black_money', 900) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) - elseif CopsConnected >= 5 then - xPlayer.addAccountMoney('black_money', 1000) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) - end + xPlayer.addAccountMoney('black_money', 300) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) + elseif CopsConnected == 1 then + xPlayer.addAccountMoney('black_money', 500) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) + elseif CopsConnected == 2 then + xPlayer.addAccountMoney('black_money', 700) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) + elseif CopsConnected == 3 then + xPlayer.addAccountMoney('black_money', 800) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) + elseif CopsConnected == 4 then + xPlayer.addAccountMoney('black_money', 900) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) + elseif CopsConnected >= 5 then + xPlayer.addAccountMoney('black_money', 1000) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) + end SellOpium(source) end @@ -726,15 +725,13 @@ AddEventHandler('esx_drugs:stopSellOpium', function() end) - --- RETURN INVENTORY TO CLIENT RegisterServerEvent('esx_drugs:GetUserInventory') AddEventHandler('esx_drugs:GetUserInventory', function(currentZone) local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) - TriggerClientEvent('esx_drugs:ReturnInventory', - _source, - xPlayer.getInventoryItem('coke').count, + local xPlayer = ESX.GetPlayerFromId(_source) + TriggerClientEvent('esx_drugs:ReturnInventory', + _source, + xPlayer.getInventoryItem('coke').count, xPlayer.getInventoryItem('coke_pooch').count, xPlayer.getInventoryItem('meth').count, xPlayer.getInventoryItem('meth_pooch').count, @@ -744,18 +741,15 @@ AddEventHandler('esx_drugs:GetUserInventory', function(currentZone) xPlayer.getInventoryItem('opium_pooch').count, xPlayer.job.name, currentZone - ) + ) end) --- Register Usable Item ESX.RegisterUsableItem('weed', function(source) - local _source = source - local xPlayer = ESX.GetPlayerFromId(source) + local xPlayer = ESX.GetPlayerFromId(_source) xPlayer.removeInventoryItem('weed', 1) TriggerClientEvent('esx_drugs:onPot', _source) - TriggerClientEvent('esx:showNotification', _source, _U('used_one_weed')) - + TriggerClientEvent('esx:showNotification', _source, _U('used_one_weed')) end) diff --git a/sv_esx_drugs.sql b/sv_esx_drugs.sql deleted file mode 100644 index 9af53a32..00000000 --- a/sv_esx_drugs.sql +++ /dev/null @@ -1,10 +0,0 @@ -INSERT INTO `items` (name, label) VALUES - ('weed', 'Cannabis'), - ('weed_pooch', 'Väska med cannabis'), - ('coke', 'Kokain'), - ('coke_pooch', 'Väska med kokain'), - ('meth', 'Meth'), - ('meth_pooch', 'Väska med meth'), - ('opium', 'Opium'), - ('opium_pooch', 'Väska med opium') -; From 15fce592fb82cb5f2469527116466c2bcf41c47d Mon Sep 17 00:00:00 2001 From: Samuel Date: Sun, 1 Jul 2018 21:23:57 +0200 Subject: [PATCH 31/66] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5e453382..6061a3f0 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ git clone https://github.com/ESX-Org/esx_drugs [esx]/esx_drugs - Download https://github.com/ESX-Org/esx_drugs/archive/master.zip - Put it in the `[esx]` directory +## Installation - Import `esx_drugs.sql` in your database - Add this in your `server.cfg`: @@ -36,4 +37,4 @@ This program Is free software: you can redistribute it And/Or modify it under th This program Is distributed In the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty Of MERCHANTABILITY Or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License For more details. -You should have received a copy Of the GNU General Public License along with this program. If Not, see http://www.gnu.org/licenses/. \ No newline at end of file +You should have received a copy Of the GNU General Public License along with this program. If Not, see http://www.gnu.org/licenses/. From fb76a2a928a324460cfb3ae296bbf166139ed1c9 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sun, 29 Jul 2018 15:46:43 +0200 Subject: [PATCH 32/66] Minor fixes, misspelled strings --- config.lua | 2 +- locales/br.lua | 2 +- locales/de.lua | 2 +- locales/en.lua | 2 +- locales/sv.lua | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/config.lua b/config.lua index 08740a3a..e2fc6d33 100644 --- a/config.lua +++ b/config.lua @@ -27,5 +27,5 @@ Config.Zones = { WeedDealer = {x = -54.24, y = -1443.36, z = 31.06, name = _U('weed_dealer'), sprite = 500, color = 75}, OpiumField = {x = 1972.78, y = 3819.39, z = 32.50, name = _U('opium_field'), sprite = 51, color = 60}, OpiumProcessing = {x = 971.86, y = -2157.00, z = 28.47, name = _U('opium_processing'), sprite = 51, color = 60}, - OpiumDealer = {x = 2331.08, y = 2570.22, z = 46.68, name = _U('opium_dealer'), sprite = 500, color = 75} + OpiumDealer = {x = 2331.08, y = 2570.22, z = 45.30, name = _U('opium_dealer'), sprite = 500, color = 75} } diff --git a/locales/br.lua b/locales/br.lua index e2e0f942..baf400b8 100644 --- a/locales/br.lua +++ b/locales/br.lua @@ -17,7 +17,7 @@ Locales['br'] = { ['too_many_pouches'] = 'Você tem muitas trouxinhas', ['not_enough_coke'] = 'Você não tem folha de coca suficiente para ~r~empacotar~s~', ['packing_in_prog'] = '~y~Empacotamento em progresso~s~...', - ['no_pouchs_sale'] = 'Você não tem mais trouxinhas para ~r~vender~s~', + ['no_pouches_sale'] = 'Você não tem mais trouxinhas para ~r~vender~s~', ['sold_one_coke'] = 'Você vendeu ~g~x1 Trouxinha de Cocaína~s~', ['sale_in_prog'] = '~g~Venda em progresso~s~...', ['inv_full_meth'] = 'Você não pode mais coletar metanfetamina, seu inventário está ~r~cheio~s~', diff --git a/locales/de.lua b/locales/de.lua index 2c1d9143..208e35bc 100644 --- a/locales/de.lua +++ b/locales/de.lua @@ -17,7 +17,7 @@ Locales['de'] = { ['too_many_pouches'] = 'du hast zuviele Pakete', ['not_enough_coke'] = 'du hast nicht genug Koks zum ~r~verpacken~s~', ['packing_in_prog'] = '~y~Verarbeitung im gange~s~...', - ['no_pouchs_sale'] = 'Du hast nicht genug Portionen zum ~r~verkaufen~s~', + ['no_pouches_sale'] = 'Du hast nicht genug Portionen zum ~r~verkaufen~s~', ['sold_one_coke'] = 'du verkaufst ~g~x1 Portion Koks~s~', ['sale_in_prog'] = '~g~Verkauf im gange~s~...', ['inv_full_meth'] = 'Du kannst nicht länger Meth sammeln, dein Inventar ist ~r~VOLL~s~', diff --git a/locales/en.lua b/locales/en.lua index 1358430f..49618649 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -17,7 +17,7 @@ Locales['en'] = { ['too_many_pouches'] = 'you have too many pouches', ['not_enough_coke'] = 'you do not have enough coke to ~r~pack~s~', ['packing_in_prog'] = '~y~Packaging in progress~s~...', - ['no_pouchs_sale'] = 'You have no more pouches for ~r~sale~s~', + ['no_pouches_sale'] = 'You have no more pouches for ~r~sale~s~', ['sold_one_coke'] = 'you\'ve sold ~y~x1~s~ ~y~Cocaine Pouch~s~', ['sale_in_prog'] = '~g~Sale in progress~s~...', ['inv_full_meth'] = 'you can no longer collect Meth, your inventory is ~r~full~s~', diff --git a/locales/sv.lua b/locales/sv.lua index 07a9b65f..813f3433 100644 --- a/locales/sv.lua +++ b/locales/sv.lua @@ -17,7 +17,7 @@ Locales['sv'] = { ['too_many_pouches'] = 'Du har för många väskor', ['not_enough_coke'] = 'Du har inte tillräckligt med kokain för att ~r~bearbeta~s~', ['packing_in_prog'] = '~y~Förpackning pågår~s~...', - ['no_pouchs_sale'] = 'Du har inga mer väskor att ~r~sälja~s~', + ['no_pouches_sale'] = 'Du har inga mer väskor att ~r~sälja~s~', ['sold_one_coke'] = 'du har sålt ~y~1x~s~ ~b~väska med kokain~s~', ['sale_in_prog'] = '~g~Försäljning pågår~s~...', ['inv_full_meth'] = 'Du kan inte längre plocka meth, du har inte plats ~r~fullt~s~', From 4a7065f16671a831e9ed16a7828269f4e083f999 Mon Sep 17 00:00:00 2001 From: MajorMarcin Date: Sun, 29 Jul 2018 20:46:45 +0200 Subject: [PATCH 33/66] blips option and add pl added to the config option to hide markers on the map add pl translation --- __resource.lua | 2 ++ client/esx_drugs_cl.lua | 31 ++++++++++++---------- config.lua | 1 + locales/pl.lua | 48 +++++++++++++++++++++++++++++++++++ localization/pl_esx_drugs.sql | 10 ++++++++ 5 files changed, 78 insertions(+), 14 deletions(-) create mode 100644 locales/pl.lua create mode 100644 localization/pl_esx_drugs.sql diff --git a/__resource.lua b/__resource.lua index e10b721b..70391c21 100644 --- a/__resource.lua +++ b/__resource.lua @@ -12,6 +12,7 @@ server_scripts { 'locales/fr.lua', 'locales/es.lua', 'locales/sv.lua', + 'locales/pl.lua', 'server/esx_drugs_sv.lua', 'config.lua' } @@ -24,6 +25,7 @@ client_scripts { 'locales/fr.lua', 'locales/es.lua', 'locales/sv.lua', + 'locales/pl.lua', 'config.lua', 'client/esx_drugs_cl.lua' } diff --git a/client/esx_drugs_cl.lua b/client/esx_drugs_cl.lua index 1dcba016..3871997e 100644 --- a/client/esx_drugs_cl.lua +++ b/client/esx_drugs_cl.lua @@ -199,22 +199,25 @@ Citizen.CreateThread(function() end end) --- Create blips -Citizen.CreateThread(function() - for k,v in pairs(Config.Zones) do - local blip = AddBlipForCoord(v.x, v.y, v.z) +if Config.ShowBlips then + -- Create blips + Citizen.CreateThread(function() + for k,v in pairs(Config.Zones) do + local blip = AddBlipForCoord(v.x, v.y, v.z) - SetBlipSprite (blip, v.sprite) - SetBlipDisplay(blip, 4) - SetBlipScale (blip, 0.9) - SetBlipColour (blip, v.color) - SetBlipAsShortRange(blip, true) + SetBlipSprite (blip, v.sprite) + SetBlipDisplay(blip, 4) + SetBlipScale (blip, 0.9) + SetBlipColour (blip, v.color) + SetBlipAsShortRange(blip, true) + + BeginTextCommandSetBlipName("STRING") + AddTextComponentString(v.name) + EndTextCommandSetBlipName(blip) + end + end) +end - BeginTextCommandSetBlipName("STRING") - AddTextComponentString(v.name) - EndTextCommandSetBlipName(blip) - end -end) -- RETURN NUMBER OF ITEMS FROM SERVER RegisterNetEvent('esx_drugs:ReturnInventory') diff --git a/config.lua b/config.lua index e2fc6d33..3406fd1c 100644 --- a/config.lua +++ b/config.lua @@ -3,6 +3,7 @@ Config.MarkerType = 1 Config.DrawDistance = 100.0 Config.ZoneSize = {x = 5.0, y = 5.0, z = 3.0} Config.MarkerColor = {r = 100, g = 204, b = 100} +Config.ShowBlips = true --markers visible on the map? (false to hide the markers on the map) Config.RequiredCopsCoke = 2 Config.RequiredCopsMeth = 2 diff --git a/locales/pl.lua b/locales/pl.lua new file mode 100644 index 00000000..b645c88d --- /dev/null +++ b/locales/pl.lua @@ -0,0 +1,48 @@ +Locales['pl'] = { + ['press_collect_coke'] = 'naciśnij ~INPUT_CONTEXT~ aby zbierać liście kokainy', + ['press_process_coke'] = 'naciśnij ~INPUT_CONTEXT~ aby poddać liście kokainy obróbce chemicznej', + ['press_sell_coke'] = 'naciśnij ~INPUT_CONTEXT~ aby sprzedać kokaine', + ['press_collect_meth'] = 'naciśnij ~INPUT_CONTEXT~ aby gotować metamfetamine', + ['press_process_meth'] = 'naciśnij ~INPUT_CONTEXT~ aby kruszyć odlew', + ['press_sell_meth'] = 'naciśnij ~INPUT_CONTEXT~ aby sprzedać metamfetamine', + ['press_collect_weed'] = 'naciśnij ~INPUT_CONTEXT~ aby zbierać topy konopii', + ['press_process_weed'] = 'naciśnij ~INPUT_CONTEXT~ aby suszyć topy konopii', + ['press_sell_weed'] = 'naciśnij ~INPUT_CONTEXT~ aby sprzedać marihuane', + ['press_collect_opium'] = 'naciśnij ~INPUT_CONTEXT~ aby zebrać opium', + ['press_process_opium'] = 'naciśnij ~INPUT_CONTEXT~ aby przetworzyć opium', + ['press_sell_opium'] = 'naciśnij ~INPUT_CONTEXT~ aby sprzedać opium', + ['act_imp_police'] = 'nie mozesz wykonać tej akcji z powodu niewystarczającej liczby policjantów: ~o~%s~s~/~y~%s~s~', + ['inv_full_coke'] = 'posiadasz już ~r~wystarczającą~s~ ilość liści', + ['pickup_in_prog'] = '~y~Zbieranie~s~...', + ['too_many_pouches'] = 'posiadasz wystarczającą ilość towaru', + ['not_enough_coke'] = 'nie masz wystarczająco dużo liści aby ~r~poddać obróbce~s~', + ['packing_in_prog'] = '~y~Obrabianie w toku~s~...', + ['no_pouchs_sale'] = 'nie masz wystarczającej ilości towaru na ~r~sprzedaż~s~', + ['sold_one_coke'] = 'sprzedajesz ~y~x1~s~ ~y~ gram kokainy~s~', + ['sale_in_prog'] = '~g~Sprzedawanie~s~...', + ['inv_full_meth'] = 'posiadasz już ~r~wystarczająca~s~ dużo odlewu', + ['not_enough_meth'] = 'nie masz wystarczająco dużo metafetaminy aby ~r~pokruszyć~s~', + ['sold_one_meth'] = 'sprzedajesz ~g~x1 gram metamfetaminy~s~', + ['inv_full_weed'] = 'posiadasz już ~r~wystarczającą~s~ ilośc topów', + ['not_enough_weed'] = 'nie masz topów do ~r~ususzenia~s~', + ['sold_one_weed'] = 'sprzedajesz ~g~x1 gram marihuany~s~', + ['used_one_weed'] = 'spalasz jednego ~b~skręta', + ['inv_full_opium'] = 'nie możesz zbierać wiecej opium, gdyż twój ekwipunek jest ~r~pełny~s~', + ['not_enough_opium'] = 'nie masz wystarczająco opium aby je ~r~spakować~s~', + ['sold_one_opium'] = 'sprzedajesz ~g~x1 torebeczka opium~s~', + ['used_one_opium'] = 'wciągasz 1x torebeczka ~b~opium', + ['exit_marker'] = 'naciśnij ~INPUT_CONTEXT~ aby ~y~przerwać~s~ akcje', + -- Blips + ['coke_field'] = 'plantacja kokainy', + ['coke_processing'] = 'przeróbka liści kokainy', + ['coke_dealer'] = 'handlarz: Kokainy', + ['meth_field'] = 'laboratorium metamfetaminy', + ['meth_processing'] = 'kruszenie metamfetaminy', + ['meth_dealer'] = 'handlarz: Metamfetamina', + ['weed_field'] = 'plantacja marihuany', + ['weed_processing'] = 'suszenie marihuany', + ['weed_dealer'] = 'handlarz: Marihuana', + ['opium_field'] = 'pole opium', + ['opium_processing'] = 'przeróbka opium', + ['opium_dealer'] = 'handlarz: Opium', +} \ No newline at end of file diff --git a/localization/pl_esx_drugs.sql b/localization/pl_esx_drugs.sql new file mode 100644 index 00000000..ab4f829b --- /dev/null +++ b/localization/pl_esx_drugs.sql @@ -0,0 +1,10 @@ +INSERT INTO `items` (name, label, `limit`) VALUES + ('weed', 'Topy', 50), + ('weed_pooch', 'Marihuana', 10), + ('coke', 'Liście kokainy', 50), + ('coke_pooch', 'Kokaina', 10), + ('meth', 'Odlew', 50), + ('meth_pooch', 'Metafetamina', 10), + ('opium', 'Opium', 50), + ('opium_pooch', 'Torebeczka opium', 10) +; From 212f6200ac54bd8a8daaf0b284629391fedfbec2 Mon Sep 17 00:00:00 2001 From: nearbyplayer Date: Fri, 10 Aug 2018 00:53:28 -0400 Subject: [PATCH 34/66] Repo Update --- .editorconfig | 9 + LICENSE | 674 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 683 insertions(+) create mode 100644 .editorconfig create mode 100644 LICENSE diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..9b425256 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +indent_size = 4 +indent_style = tab +end_of_line = crlf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..0f4f5d61 --- /dev/null +++ b/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + fxserver-async + Copyright (C) 2015 Jérémie N'gadi + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + fxserver-async Copyright (C) 2015 Jérémie N'gadi + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. \ No newline at end of file From 7337933402a09f74ceeb8f2b1bfd33e137c83d2d Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Fri, 21 Sep 2018 23:17:53 +0200 Subject: [PATCH 35/66] Minor improvements, proper item limits --- server/esx_drugs_sv.lua | 214 ++++++++++------------------------------ 1 file changed, 51 insertions(+), 163 deletions(-) diff --git a/server/esx_drugs_sv.lua b/server/esx_drugs_sv.lua index b5518db8..2e4401a9 100644 --- a/server/esx_drugs_sv.lua +++ b/server/esx_drugs_sv.lua @@ -16,7 +16,6 @@ local PlayersSellingOpium = {} TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) function CountCops() - local xPlayers = ESX.GetPlayers() CopsConnected = 0 @@ -35,18 +34,14 @@ CountCops() --coke local function HarvestCoke(source) - if CopsConnected < Config.RequiredCopsCoke then TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsCoke)) return end SetTimeout(Config.TimeToFarm, function() - - if PlayersHarvestingCoke[source] == true then - - local xPlayer = ESX.GetPlayerFromId(source) - + if PlayersHarvestingCoke[source] then + local xPlayer = ESX.GetPlayerFromId(source) local coke = xPlayer.getInventoryItem('coke') if coke.limit ~= -1 and coke.count >= coke.limit then @@ -55,14 +50,12 @@ local function HarvestCoke(source) xPlayer.addInventoryItem('coke', 1) HarvestCoke(source) end - end end) end RegisterServerEvent('esx_drugs:startHarvestCoke') AddEventHandler('esx_drugs:startHarvestCoke', function() - local _source = source PlayersHarvestingCoke[_source] = true @@ -70,53 +63,43 @@ AddEventHandler('esx_drugs:startHarvestCoke', function() TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog')) HarvestCoke(_source) - end) RegisterServerEvent('esx_drugs:stopHarvestCoke') AddEventHandler('esx_drugs:stopHarvestCoke', function() - local _source = source PlayersHarvestingCoke[_source] = false - end) local function TransformCoke(source) - if CopsConnected < Config.RequiredCopsCoke then TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsCoke)) return end SetTimeout(Config.TimeToProcess, function() - - if PlayersTransformingCoke[source] == true then - - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) - + if PlayersTransformingCoke[source] then + local xPlayer = ESX.GetPlayerFromId(source) local cokeQuantity = xPlayer.getInventoryItem('coke').count - local poochQuantity = xPlayer.getInventoryItem('coke_pooch').count + local pooch = xPlayer.getInventoryItem('coke_pooch').count - if poochQuantity > 35 then + if pooch.limit ~= -1 and pooch.count >= pooch.limit then TriggerClientEvent('esx:showNotification', source, _U('too_many_pouches')) elseif cokeQuantity < 5 then TriggerClientEvent('esx:showNotification', source, _U('not_enough_coke')) else xPlayer.removeInventoryItem('coke', 5) xPlayer.addInventoryItem('coke_pooch', 1) - + TransformCoke(source) end - end end) end RegisterServerEvent('esx_drugs:startTransformCoke') AddEventHandler('esx_drugs:startTransformCoke', function() - local _source = source PlayersTransformingCoke[_source] = true @@ -124,32 +107,24 @@ AddEventHandler('esx_drugs:startTransformCoke', function() TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog')) TransformCoke(_source) - end) RegisterServerEvent('esx_drugs:stopTransformCoke') AddEventHandler('esx_drugs:stopTransformCoke', function() - local _source = source PlayersTransformingCoke[_source] = false - end) local function SellCoke(source) - if CopsConnected < Config.RequiredCopsCoke then TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsCoke)) return end SetTimeout(Config.TimeToSell, function() - - if PlayersSellingCoke[source] == true then - - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) - + if PlayersSellingCoke[source] then + local xPlayer = ESX.GetPlayerFromId(source) local poochQuantity = xPlayer.getInventoryItem('coke_pooch').count if poochQuantity == 0 then @@ -175,17 +150,15 @@ local function SellCoke(source) xPlayer.addAccountMoney('black_money', 428) TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) end - + SellCoke(source) end - end end) end RegisterServerEvent('esx_drugs:startSellCoke') AddEventHandler('esx_drugs:startSellCoke', function() - local _source = source PlayersSellingCoke[_source] = true @@ -193,33 +166,25 @@ AddEventHandler('esx_drugs:startSellCoke', function() TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog')) SellCoke(_source) - end) RegisterServerEvent('esx_drugs:stopSellCoke') AddEventHandler('esx_drugs:stopSellCoke', function() - local _source = source PlayersSellingCoke[_source] = false - end) --meth local function HarvestMeth(source) - if CopsConnected < Config.RequiredCopsMeth then TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsMeth)) return end SetTimeout(Config.TimeToFarm, function() - - if PlayersHarvestingMeth[source] == true then - - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) - + if PlayersHarvestingMeth[source] then + local xPlayer = ESX.GetPlayerFromId(source) local meth = xPlayer.getInventoryItem('meth') if meth.limit ~= -1 and meth.count >= meth.limit then @@ -228,14 +193,12 @@ local function HarvestMeth(source) xPlayer.addInventoryItem('meth', 1) HarvestMeth(source) end - end end) end RegisterServerEvent('esx_drugs:startHarvestMeth') AddEventHandler('esx_drugs:startHarvestMeth', function() - local _source = source PlayersHarvestingMeth[_source] = true @@ -243,53 +206,43 @@ AddEventHandler('esx_drugs:startHarvestMeth', function() TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog')) HarvestMeth(_source) - end) RegisterServerEvent('esx_drugs:stopHarvestMeth') AddEventHandler('esx_drugs:stopHarvestMeth', function() - local _source = source PlayersHarvestingMeth[_source] = false - end) local function TransformMeth(source) - if CopsConnected < Config.RequiredCopsMeth then TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsMeth)) return end SetTimeout(Config.TimeToProcess, function() - - if PlayersTransformingMeth[source] == true then - - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) - + if PlayersTransformingMeth[source] then + local xPlayer = ESX.GetPlayerFromId(source) local methQuantity = xPlayer.getInventoryItem('meth').count - local poochQuantity = xPlayer.getInventoryItem('meth_pooch').count + local pooch = xPlayer.getInventoryItem('meth_pooch') - if poochQuantity > 35 then + if pooch.limit ~= -1 and pooch.count >= pooch.limit then TriggerClientEvent('esx:showNotification', source, _U('too_many_pouches')) elseif methQuantity < 5 then TriggerClientEvent('esx:showNotification', source, _U('not_enough_meth')) else xPlayer.removeInventoryItem('meth', 5) xPlayer.addInventoryItem('meth_pooch', 1) - + TransformMeth(source) end - end end) end RegisterServerEvent('esx_drugs:startTransformMeth') AddEventHandler('esx_drugs:startTransformMeth', function() - local _source = source PlayersTransformingMeth[_source] = true @@ -297,36 +250,28 @@ AddEventHandler('esx_drugs:startTransformMeth', function() TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog')) TransformMeth(_source) - end) RegisterServerEvent('esx_drugs:stopTransformMeth') AddEventHandler('esx_drugs:stopTransformMeth', function() - local _source = source PlayersTransformingMeth[_source] = false - end) local function SellMeth(source) - if CopsConnected < Config.RequiredCopsMeth then TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsMeth)) return end SetTimeout(Config.TimeToSell, function() - - if PlayersSellingMeth[source] == true then - - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) - + if PlayersSellingMeth[source] then + local xPlayer = ESX.GetPlayerFromId(source) local poochQuantity = xPlayer.getInventoryItem('meth_pooch').count if poochQuantity == 0 then - TriggerClientEvent('esx:showNotification', _source, _U('no_pouches_sale')) + TriggerClientEvent('esx:showNotification', source, _U('no_pouches_sale')) else xPlayer.removeInventoryItem('meth_pooch', 1) if CopsConnected == 0 then @@ -351,17 +296,15 @@ local function SellMeth(source) xPlayer.addAccountMoney('black_money', 686) TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) end - + SellMeth(source) end - end end) end RegisterServerEvent('esx_drugs:startSellMeth') AddEventHandler('esx_drugs:startSellMeth', function() - local _source = source PlayersSellingMeth[_source] = true @@ -369,33 +312,26 @@ AddEventHandler('esx_drugs:startSellMeth', function() TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog')) SellMeth(_source) - end) RegisterServerEvent('esx_drugs:stopSellMeth') AddEventHandler('esx_drugs:stopSellMeth', function() - local _source = source PlayersSellingMeth[_source] = false - end) --weed local function HarvestWeed(source) - if CopsConnected < Config.RequiredCopsWeed then TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsWeed)) return end SetTimeout(Config.TimeToFarm, function() - if PlayersHarvestingWeed[source] == true then - local _source = source local xPlayer = ESX.GetPlayerFromId(_source) - local weed = xPlayer.getInventoryItem('weed') if weed.limit ~= -1 and weed.count >= weed.limit then @@ -404,14 +340,12 @@ local function HarvestWeed(source) xPlayer.addInventoryItem('weed', 1) HarvestWeed(source) end - end end) end RegisterServerEvent('esx_drugs:startHarvestWeed') AddEventHandler('esx_drugs:startHarvestWeed', function() - local _source = source PlayersHarvestingWeed[_source] = true @@ -419,52 +353,44 @@ AddEventHandler('esx_drugs:startHarvestWeed', function() TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog')) HarvestWeed(_source) - end) RegisterServerEvent('esx_drugs:stopHarvestWeed') AddEventHandler('esx_drugs:stopHarvestWeed', function() - local _source = source PlayersHarvestingWeed[_source] = false - end) local function TransformWeed(source) - if CopsConnected < Config.RequiredCopsWeed then TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsWeed)) return end SetTimeout(Config.TimeToProcess, function() - - if PlayersTransformingWeed[source] == true then - + if PlayersTransformingWeed[source] then local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) + local xPlayer = ESX.GetPlayerFromId(_source) local weedQuantity = xPlayer.getInventoryItem('weed').count - local poochQuantity = xPlayer.getInventoryItem('weed_pooch').count + local pooch = xPlayer.getInventoryItem('weed_pooch') - if poochQuantity > 35 then + if pooch.limit ~= -1 and pooch.count >= pooch.limit then TriggerClientEvent('esx:showNotification', source, _U('too_many_pouches')) elseif weedQuantity < 5 then TriggerClientEvent('esx:showNotification', source, _U('not_enough_weed')) else xPlayer.removeInventoryItem('weed', 5) xPlayer.addInventoryItem('weed_pooch', 1) - + TransformWeed(source) end - end end) end RegisterServerEvent('esx_drugs:startTransformWeed') AddEventHandler('esx_drugs:startTransformWeed', function() - local _source = source PlayersTransformingWeed[_source] = true @@ -472,32 +398,25 @@ AddEventHandler('esx_drugs:startTransformWeed', function() TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog')) TransformWeed(_source) - end) RegisterServerEvent('esx_drugs:stopTransformWeed') AddEventHandler('esx_drugs:stopTransformWeed', function() - local _source = source PlayersTransformingWeed[_source] = false - end) local function SellWeed(source) - if CopsConnected < Config.RequiredCopsWeed then TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsWeed)) return end SetTimeout(Config.TimeToSell, function() - - if PlayersSellingWeed[source] == true then - + if PlayersSellingWeed[source] then local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) - + local xPlayer = ESX.GetPlayerFromId(_source) local poochQuantity = xPlayer.getInventoryItem('weed_pooch').count if poochQuantity == 0 then @@ -520,17 +439,15 @@ local function SellWeed(source) xPlayer.addAccountMoney('black_money', 180) TriggerClientEvent('esx:showNotification', source, _U('sold_one_weed')) end - + SellWeed(source) end - end end) end RegisterServerEvent('esx_drugs:startSellWeed') AddEventHandler('esx_drugs:startSellWeed', function() - local _source = source PlayersSellingWeed[_source] = true @@ -538,51 +455,42 @@ AddEventHandler('esx_drugs:startSellWeed', function() TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog')) SellWeed(_source) - end) RegisterServerEvent('esx_drugs:stopSellWeed') AddEventHandler('esx_drugs:stopSellWeed', function() - local _source = source PlayersSellingWeed[_source] = false - end) --opium local function HarvestOpium(source) - if CopsConnected < Config.RequiredCopsOpium then TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsOpium)) return end SetTimeout(Config.TimeToFarm, function() - - if PlayersHarvestingOpium[source] == true then - + if PlayersHarvestingOpium[source] then local _source = source local xPlayer = ESX.GetPlayerFromId(_source) - local opium = xPlayer.getInventoryItem('opium') if opium.limit ~= -1 and opium.count >= opium.limit then - TriggerClientEvent('esx:showNotification', source, _U('inv_full_opium')) + TriggerClientEvent('esx:showNotification', _source, _U('inv_full_opium')) else xPlayer.addInventoryItem('opium', 1) - HarvestOpium(source) + HarvestOpium(_source) end - end end) end RegisterServerEvent('esx_drugs:startHarvestOpium') AddEventHandler('esx_drugs:startHarvestOpium', function() - local _source = source PlayersHarvestingOpium[_source] = true @@ -590,53 +498,45 @@ AddEventHandler('esx_drugs:startHarvestOpium', function() TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog')) HarvestOpium(_source) - end) RegisterServerEvent('esx_drugs:stopHarvestOpium') AddEventHandler('esx_drugs:stopHarvestOpium', function() - local _source = source PlayersHarvestingOpium[_source] = false - end) local function TransformOpium(source) - if CopsConnected < Config.RequiredCopsOpium then TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsOpium)) return end SetTimeout(Config.TimeToProcess, function() - - if PlayersTransformingOpium[source] == true then - + if PlayersTransformingOpium[source] then local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) + local xPlayer = ESX.GetPlayerFromId(_source) local opiumQuantity = xPlayer.getInventoryItem('opium').count - local poochQuantity = xPlayer.getInventoryItem('opium_pooch').count + local pooch = xPlayer.getInventoryItem('opium_pooch') - if poochQuantity > 35 then - TriggerClientEvent('esx:showNotification', source, _U('too_many_pouches')) + if pooch.limit ~= -1 and pooch.count >= pooch.limit then + TriggerClientEvent('esx:showNotification', _source, _U('too_many_pouches')) elseif opiumQuantity < 5 then - TriggerClientEvent('esx:showNotification', source, _U('not_enough_opium')) + TriggerClientEvent('esx:showNotification', _source, _U('not_enough_opium')) else xPlayer.removeInventoryItem('opium', 5) xPlayer.addInventoryItem('opium_pooch', 1) - TransformOpium(source) + TransformOpium(_source) end - end end) end RegisterServerEvent('esx_drugs:startTransformOpium') AddEventHandler('esx_drugs:startTransformOpium', function() - local _source = source PlayersTransformingOpium[_source] = true @@ -644,32 +544,25 @@ AddEventHandler('esx_drugs:startTransformOpium', function() TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog')) TransformOpium(_source) - end) RegisterServerEvent('esx_drugs:stopTransformOpium') AddEventHandler('esx_drugs:stopTransformOpium', function() - local _source = source PlayersTransformingOpium[_source] = false - end) local function SellOpium(source) - if CopsConnected < Config.RequiredCopsOpium then TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsOpium)) return end SetTimeout(Config.TimeToSell, function() - - if PlayersSellingOpium[source] == true then - + if PlayersSellingOpium[source] then local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) - + local xPlayer = ESX.GetPlayerFromId(_source) local poochQuantity = xPlayer.getInventoryItem('opium_pooch').count if poochQuantity == 0 then @@ -695,17 +588,15 @@ local function SellOpium(source) xPlayer.addAccountMoney('black_money', 1000) TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) end - + SellOpium(source) end - end end) end RegisterServerEvent('esx_drugs:startSellOpium') AddEventHandler('esx_drugs:startSellOpium', function() - local _source = source PlayersSellingOpium[_source] = true @@ -713,33 +604,30 @@ AddEventHandler('esx_drugs:startSellOpium', function() TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog')) SellOpium(_source) - end) RegisterServerEvent('esx_drugs:stopSellOpium') AddEventHandler('esx_drugs:stopSellOpium', function() - local _source = source PlayersSellingOpium[_source] = false - end) RegisterServerEvent('esx_drugs:GetUserInventory') AddEventHandler('esx_drugs:GetUserInventory', function(currentZone) local _source = source local xPlayer = ESX.GetPlayerFromId(_source) - TriggerClientEvent('esx_drugs:ReturnInventory', - _source, - xPlayer.getInventoryItem('coke').count, + TriggerClientEvent('esx_drugs:ReturnInventory', + _source, + xPlayer.getInventoryItem('coke').count, xPlayer.getInventoryItem('coke_pooch').count, - xPlayer.getInventoryItem('meth').count, - xPlayer.getInventoryItem('meth_pooch').count, - xPlayer.getInventoryItem('weed').count, - xPlayer.getInventoryItem('weed_pooch').count, - xPlayer.getInventoryItem('opium').count, + xPlayer.getInventoryItem('meth').count, + xPlayer.getInventoryItem('meth_pooch').count, + xPlayer.getInventoryItem('weed').count, + xPlayer.getInventoryItem('weed_pooch').count, + xPlayer.getInventoryItem('opium').count, xPlayer.getInventoryItem('opium_pooch').count, - xPlayer.job.name, + xPlayer.job.name, currentZone ) end) From c968bdfb73c9830d9b749e6309c65fd61a313ef3 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Wed, 26 Sep 2018 11:05:15 +0200 Subject: [PATCH 36/66] Renamed files --- __resource.lua | 4 +- client/{esx_drugs_cl.lua => main.lua} | 654 ++++++------- server/{esx_drugs_sv.lua => main.lua} | 1286 ++++++++++++------------- 3 files changed, 972 insertions(+), 972 deletions(-) rename client/{esx_drugs_cl.lua => main.lua} (96%) rename server/{esx_drugs_sv.lua => main.lua} (96%) diff --git a/__resource.lua b/__resource.lua index 70391c21..515cfa30 100644 --- a/__resource.lua +++ b/__resource.lua @@ -13,7 +13,7 @@ server_scripts { 'locales/es.lua', 'locales/sv.lua', 'locales/pl.lua', - 'server/esx_drugs_sv.lua', + 'server/main.lua', 'config.lua' } @@ -27,5 +27,5 @@ client_scripts { 'locales/sv.lua', 'locales/pl.lua', 'config.lua', - 'client/esx_drugs_cl.lua' + 'client/main.lua' } diff --git a/client/esx_drugs_cl.lua b/client/main.lua similarity index 96% rename from client/esx_drugs_cl.lua rename to client/main.lua index 3871997e..38b566c0 100644 --- a/client/esx_drugs_cl.lua +++ b/client/main.lua @@ -1,327 +1,327 @@ -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 cokeQTE = 0 -ESX = nil -local coke_poochQTE = 0 -local weedQTE = 0 -local weed_poochQTE = 0 -local methQTE = 0 -local meth_poochQTE = 0 -local opiumQTE = 0 -local opium_poochQTE = 0 -local myJob = nil -local HasAlreadyEnteredMarker = false -local LastZone = nil -local isInZone = false -local CurrentAction = nil -local CurrentActionMsg = '' -local CurrentActionData = {} - -Citizen.CreateThread(function() - while ESX == nil do - TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) - Citizen.Wait(0) - end -end) - -AddEventHandler('esx_drugs:hasEnteredMarker', function(zone) - if myJob == 'police' or myJob == 'ambulance' then - return - end - - ESX.UI.Menu.CloseAll() - - if zone == 'exitMarker' then - CurrentAction = zone - CurrentActionMsg = _U('exit_marker') - CurrentActionData = {} - end - - if zone == 'CokeField' then - CurrentAction = zone - CurrentActionMsg = _U('press_collect_coke') - CurrentActionData = {} - end - - if zone == 'CokeProcessing' then - if cokeQTE >= 5 then - CurrentAction = zone - CurrentActionMsg = _U('press_process_coke') - CurrentActionData = {} - end - end - - if zone == 'CokeDealer' then - if coke_poochQTE >= 1 then - CurrentAction = zone - CurrentActionMsg = _U('press_sell_coke') - CurrentActionData = {} - end - end - - if zone == 'MethField' then - CurrentAction = zone - CurrentActionMsg = _U('press_collect_meth') - CurrentActionData = {} - end - - if zone == 'MethProcessing' then - if methQTE >= 5 then - CurrentAction = zone - CurrentActionMsg = _U('press_process_meth') - CurrentActionData = {} - end - end - - if zone == 'MethDealer' then - if meth_poochQTE >= 1 then - CurrentAction = zone - CurrentActionMsg = _U('press_sell_meth') - CurrentActionData = {} - end - end - - if zone == 'WeedField' then - CurrentAction = zone - CurrentActionMsg = _U('press_collect_weed') - CurrentActionData = {} - end - - if zone == 'WeedProcessing' then - if weedQTE >= 5 then - CurrentAction = zone - CurrentActionMsg = _U('press_process_weed') - CurrentActionData = {} - end - end - - if zone == 'WeedDealer' then - if weed_poochQTE >= 1 then - CurrentAction = zone - CurrentActionMsg = _U('press_sell_weed') - CurrentActionData = {} - end - end - - if zone == 'OpiumField' then - CurrentAction = zone - CurrentActionMsg = _U('press_collect_opium') - CurrentActionData = {} - end - - if zone == 'OpiumProcessing' then - if opiumQTE >= 5 then - CurrentAction = zone - CurrentActionMsg = _U('press_process_opium') - CurrentActionData = {} - end - end - - if zone == 'OpiumDealer' then - if opium_poochQTE >= 1 then - CurrentAction = zone - CurrentActionMsg = _U('press_sell_opium') - CurrentActionData = {} - end - end -end) - -AddEventHandler('esx_drugs:hasExitedMarker', function(zone) - CurrentAction = nil - ESX.UI.Menu.CloseAll() - - TriggerServerEvent('esx_drugs:stopHarvestCoke') - TriggerServerEvent('esx_drugs:stopTransformCoke') - TriggerServerEvent('esx_drugs:stopSellCoke') - TriggerServerEvent('esx_drugs:stopHarvestMeth') - TriggerServerEvent('esx_drugs:stopTransformMeth') - TriggerServerEvent('esx_drugs:stopSellMeth') - TriggerServerEvent('esx_drugs:stopHarvestWeed') - TriggerServerEvent('esx_drugs:stopTransformWeed') - TriggerServerEvent('esx_drugs:stopSellWeed') - TriggerServerEvent('esx_drugs:stopHarvestOpium') - TriggerServerEvent('esx_drugs:stopTransformOpium') - TriggerServerEvent('esx_drugs:stopSellOpium') -end) - --- Weed Effect -RegisterNetEvent('esx_drugs:onPot') -AddEventHandler('esx_drugs:onPot', function() - RequestAnimSet("MOVE_M@DRUNK@SLIGHTLYDRUNK") - while not HasAnimSetLoaded("MOVE_M@DRUNK@SLIGHTLYDRUNK") do - Citizen.Wait(0) - end - TaskStartScenarioInPlace(GetPlayerPed(-1), "WORLD_HUMAN_SMOKING_POT", 0, true) - Citizen.Wait(5000) - DoScreenFadeOut(1000) - Citizen.Wait(1000) - ClearPedTasksImmediately(GetPlayerPed(-1)) - SetTimecycleModifier("spectator5") - SetPedMotionBlur(GetPlayerPed(-1), true) - SetPedMovementClipset(GetPlayerPed(-1), "MOVE_M@DRUNK@SLIGHTLYDRUNK", true) - SetPedIsDrunk(GetPlayerPed(-1), true) - DoScreenFadeIn(1000) - Citizen.Wait(600000) - DoScreenFadeOut(1000) - Citizen.Wait(1000) - DoScreenFadeIn(1000) - ClearTimecycleModifier() - ResetScenarioTypesEnabled() - ResetPedMovementClipset(GetPlayerPed(-1), 0) - SetPedIsDrunk(GetPlayerPed(-1), false) - SetPedMotionBlur(GetPlayerPed(-1), false) -end) - --- Render markers -Citizen.CreateThread(function() - while true do - - Citizen.Wait(0) - - local coords = GetEntityCoords(GetPlayerPed(-1)) - - for k,v in pairs(Config.Zones) do - if(GetDistanceBetweenCoords(coords, v.x, v.y, v.z, true) < Config.DrawDistance) then - DrawMarker(Config.MarkerType, v.x, v.y, v.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, Config.ZoneSize.x, Config.ZoneSize.y, Config.ZoneSize.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false) - end - end - - end -end) - -if Config.ShowBlips then - -- Create blips - Citizen.CreateThread(function() - for k,v in pairs(Config.Zones) do - local blip = AddBlipForCoord(v.x, v.y, v.z) - - SetBlipSprite (blip, v.sprite) - SetBlipDisplay(blip, 4) - SetBlipScale (blip, 0.9) - SetBlipColour (blip, v.color) - SetBlipAsShortRange(blip, true) - - BeginTextCommandSetBlipName("STRING") - AddTextComponentString(v.name) - EndTextCommandSetBlipName(blip) - end - end) -end - - --- RETURN NUMBER OF ITEMS FROM SERVER -RegisterNetEvent('esx_drugs:ReturnInventory') -AddEventHandler('esx_drugs:ReturnInventory', function(cokeNbr, cokepNbr, methNbr, methpNbr, weedNbr, weedpNbr, opiumNbr, opiumpNbr, jobName, currentZone) - cokeQTE = cokeNbr - coke_poochQTE = cokepNbr - methQTE = methNbr - meth_poochQTE = methpNbr - weedQTE = weedNbr - weed_poochQTE = weedpNbr - opiumQTE = opiumNbr - opium_poochQTE = opiumpNbr - myJob = jobName - TriggerEvent('esx_drugs:hasEnteredMarker', currentZone) -end) - --- Activate menu when player is inside marker -Citizen.CreateThread(function() - while true do - - Citizen.Wait(0) - - local coords = GetEntityCoords(GetPlayerPed(-1)) - local isInMarker = false - local currentZone = nil - - for k,v in pairs(Config.Zones) do - if(GetDistanceBetweenCoords(coords, v.x, v.y, v.z, true) < Config.ZoneSize.x / 2) then - isInMarker = true - currentZone = k - end - end - - if isInMarker and not hasAlreadyEnteredMarker then - hasAlreadyEnteredMarker = true - lastZone = currentZone - TriggerServerEvent('esx_drugs:GetUserInventory', currentZone) - end - - if not isInMarker and hasAlreadyEnteredMarker then - hasAlreadyEnteredMarker = false - TriggerEvent('esx_drugs:hasExitedMarker', lastZone) - end - - if isInMarker and isInZone then - TriggerEvent('esx_drugs:hasEnteredMarker', 'exitMarker') - end - end -end) - --- Key Controls -Citizen.CreateThread(function() - while true do - Citizen.Wait(10) - if CurrentAction ~= nil then - SetTextComponentFormat('STRING') - AddTextComponentString(CurrentActionMsg) - DisplayHelpTextFromStringLabel(0, 0, 1, -1) - if IsControlJustReleased(0, Keys['E']) then - isInZone = true -- unless we set this boolean to false, we will always freeze the user - if CurrentAction == 'exitMarker' then - isInZone = false -- do not freeze user - TriggerEvent('esx_drugs:freezePlayer', false) - TriggerEvent('esx_drugs:hasExitedMarker', lastZone) - Citizen.Wait(15000) - elseif CurrentAction == 'CokeField' then - TriggerServerEvent('esx_drugs:startHarvestCoke') - elseif CurrentAction == 'CokeProcessing' then - TriggerServerEvent('esx_drugs:startTransformCoke') - elseif CurrentAction == 'CokeDealer' then - TriggerServerEvent('esx_drugs:startSellCoke') - elseif CurrentAction == 'MethField' then - TriggerServerEvent('esx_drugs:startHarvestMeth') - elseif CurrentAction == 'MethProcessing' then - TriggerServerEvent('esx_drugs:startTransformMeth') - elseif CurrentAction == 'MethDealer' then - TriggerServerEvent('esx_drugs:startSellMeth') - elseif CurrentAction == 'WeedField' then - TriggerServerEvent('esx_drugs:startHarvestWeed') - elseif CurrentAction == 'WeedProcessing' then - TriggerServerEvent('esx_drugs:startTransformWeed') - elseif CurrentAction == 'WeedDealer' then - TriggerServerEvent('esx_drugs:startSellWeed') - elseif CurrentAction == 'OpiumField' then - TriggerServerEvent('esx_drugs:startHarvestOpium') - elseif CurrentAction == 'OpiumProcessing' then - TriggerServerEvent('esx_drugs:startTransformOpium') - elseif CurrentAction == 'OpiumDealer' then - TriggerServerEvent('esx_drugs:startSellOpium') - else - isInZone = false -- not a esx_drugs zone - end - - if isInZone then - TriggerEvent('esx_drugs:freezePlayer', true) - end - - CurrentAction = nil - end - end - end -end) - -RegisterNetEvent('esx_drugs:freezePlayer') -AddEventHandler('esx_drugs:freezePlayer', function(freeze) - FreezeEntityPosition(GetPlayerPed(-1), freeze) -end) +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 cokeQTE = 0 +ESX = nil +local coke_poochQTE = 0 +local weedQTE = 0 +local weed_poochQTE = 0 +local methQTE = 0 +local meth_poochQTE = 0 +local opiumQTE = 0 +local opium_poochQTE = 0 +local myJob = nil +local HasAlreadyEnteredMarker = false +local LastZone = nil +local isInZone = false +local CurrentAction = nil +local CurrentActionMsg = '' +local CurrentActionData = {} + +Citizen.CreateThread(function() + while ESX == nil do + TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) + Citizen.Wait(0) + end +end) + +AddEventHandler('esx_drugs:hasEnteredMarker', function(zone) + if myJob == 'police' or myJob == 'ambulance' then + return + end + + ESX.UI.Menu.CloseAll() + + if zone == 'exitMarker' then + CurrentAction = zone + CurrentActionMsg = _U('exit_marker') + CurrentActionData = {} + end + + if zone == 'CokeField' then + CurrentAction = zone + CurrentActionMsg = _U('press_collect_coke') + CurrentActionData = {} + end + + if zone == 'CokeProcessing' then + if cokeQTE >= 5 then + CurrentAction = zone + CurrentActionMsg = _U('press_process_coke') + CurrentActionData = {} + end + end + + if zone == 'CokeDealer' then + if coke_poochQTE >= 1 then + CurrentAction = zone + CurrentActionMsg = _U('press_sell_coke') + CurrentActionData = {} + end + end + + if zone == 'MethField' then + CurrentAction = zone + CurrentActionMsg = _U('press_collect_meth') + CurrentActionData = {} + end + + if zone == 'MethProcessing' then + if methQTE >= 5 then + CurrentAction = zone + CurrentActionMsg = _U('press_process_meth') + CurrentActionData = {} + end + end + + if zone == 'MethDealer' then + if meth_poochQTE >= 1 then + CurrentAction = zone + CurrentActionMsg = _U('press_sell_meth') + CurrentActionData = {} + end + end + + if zone == 'WeedField' then + CurrentAction = zone + CurrentActionMsg = _U('press_collect_weed') + CurrentActionData = {} + end + + if zone == 'WeedProcessing' then + if weedQTE >= 5 then + CurrentAction = zone + CurrentActionMsg = _U('press_process_weed') + CurrentActionData = {} + end + end + + if zone == 'WeedDealer' then + if weed_poochQTE >= 1 then + CurrentAction = zone + CurrentActionMsg = _U('press_sell_weed') + CurrentActionData = {} + end + end + + if zone == 'OpiumField' then + CurrentAction = zone + CurrentActionMsg = _U('press_collect_opium') + CurrentActionData = {} + end + + if zone == 'OpiumProcessing' then + if opiumQTE >= 5 then + CurrentAction = zone + CurrentActionMsg = _U('press_process_opium') + CurrentActionData = {} + end + end + + if zone == 'OpiumDealer' then + if opium_poochQTE >= 1 then + CurrentAction = zone + CurrentActionMsg = _U('press_sell_opium') + CurrentActionData = {} + end + end +end) + +AddEventHandler('esx_drugs:hasExitedMarker', function(zone) + CurrentAction = nil + ESX.UI.Menu.CloseAll() + + TriggerServerEvent('esx_drugs:stopHarvestCoke') + TriggerServerEvent('esx_drugs:stopTransformCoke') + TriggerServerEvent('esx_drugs:stopSellCoke') + TriggerServerEvent('esx_drugs:stopHarvestMeth') + TriggerServerEvent('esx_drugs:stopTransformMeth') + TriggerServerEvent('esx_drugs:stopSellMeth') + TriggerServerEvent('esx_drugs:stopHarvestWeed') + TriggerServerEvent('esx_drugs:stopTransformWeed') + TriggerServerEvent('esx_drugs:stopSellWeed') + TriggerServerEvent('esx_drugs:stopHarvestOpium') + TriggerServerEvent('esx_drugs:stopTransformOpium') + TriggerServerEvent('esx_drugs:stopSellOpium') +end) + +-- Weed Effect +RegisterNetEvent('esx_drugs:onPot') +AddEventHandler('esx_drugs:onPot', function() + RequestAnimSet("MOVE_M@DRUNK@SLIGHTLYDRUNK") + while not HasAnimSetLoaded("MOVE_M@DRUNK@SLIGHTLYDRUNK") do + Citizen.Wait(0) + end + TaskStartScenarioInPlace(GetPlayerPed(-1), "WORLD_HUMAN_SMOKING_POT", 0, true) + Citizen.Wait(5000) + DoScreenFadeOut(1000) + Citizen.Wait(1000) + ClearPedTasksImmediately(GetPlayerPed(-1)) + SetTimecycleModifier("spectator5") + SetPedMotionBlur(GetPlayerPed(-1), true) + SetPedMovementClipset(GetPlayerPed(-1), "MOVE_M@DRUNK@SLIGHTLYDRUNK", true) + SetPedIsDrunk(GetPlayerPed(-1), true) + DoScreenFadeIn(1000) + Citizen.Wait(600000) + DoScreenFadeOut(1000) + Citizen.Wait(1000) + DoScreenFadeIn(1000) + ClearTimecycleModifier() + ResetScenarioTypesEnabled() + ResetPedMovementClipset(GetPlayerPed(-1), 0) + SetPedIsDrunk(GetPlayerPed(-1), false) + SetPedMotionBlur(GetPlayerPed(-1), false) +end) + +-- Render markers +Citizen.CreateThread(function() + while true do + + Citizen.Wait(0) + + local coords = GetEntityCoords(GetPlayerPed(-1)) + + for k,v in pairs(Config.Zones) do + if(GetDistanceBetweenCoords(coords, v.x, v.y, v.z, true) < Config.DrawDistance) then + DrawMarker(Config.MarkerType, v.x, v.y, v.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, Config.ZoneSize.x, Config.ZoneSize.y, Config.ZoneSize.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false) + end + end + + end +end) + +if Config.ShowBlips then + -- Create blips + Citizen.CreateThread(function() + for k,v in pairs(Config.Zones) do + local blip = AddBlipForCoord(v.x, v.y, v.z) + + SetBlipSprite (blip, v.sprite) + SetBlipDisplay(blip, 4) + SetBlipScale (blip, 0.9) + SetBlipColour (blip, v.color) + SetBlipAsShortRange(blip, true) + + BeginTextCommandSetBlipName("STRING") + AddTextComponentString(v.name) + EndTextCommandSetBlipName(blip) + end + end) +end + + +-- RETURN NUMBER OF ITEMS FROM SERVER +RegisterNetEvent('esx_drugs:ReturnInventory') +AddEventHandler('esx_drugs:ReturnInventory', function(cokeNbr, cokepNbr, methNbr, methpNbr, weedNbr, weedpNbr, opiumNbr, opiumpNbr, jobName, currentZone) + cokeQTE = cokeNbr + coke_poochQTE = cokepNbr + methQTE = methNbr + meth_poochQTE = methpNbr + weedQTE = weedNbr + weed_poochQTE = weedpNbr + opiumQTE = opiumNbr + opium_poochQTE = opiumpNbr + myJob = jobName + TriggerEvent('esx_drugs:hasEnteredMarker', currentZone) +end) + +-- Activate menu when player is inside marker +Citizen.CreateThread(function() + while true do + + Citizen.Wait(0) + + local coords = GetEntityCoords(GetPlayerPed(-1)) + local isInMarker = false + local currentZone = nil + + for k,v in pairs(Config.Zones) do + if(GetDistanceBetweenCoords(coords, v.x, v.y, v.z, true) < Config.ZoneSize.x / 2) then + isInMarker = true + currentZone = k + end + end + + if isInMarker and not hasAlreadyEnteredMarker then + hasAlreadyEnteredMarker = true + lastZone = currentZone + TriggerServerEvent('esx_drugs:GetUserInventory', currentZone) + end + + if not isInMarker and hasAlreadyEnteredMarker then + hasAlreadyEnteredMarker = false + TriggerEvent('esx_drugs:hasExitedMarker', lastZone) + end + + if isInMarker and isInZone then + TriggerEvent('esx_drugs:hasEnteredMarker', 'exitMarker') + end + end +end) + +-- Key Controls +Citizen.CreateThread(function() + while true do + Citizen.Wait(10) + if CurrentAction ~= nil then + SetTextComponentFormat('STRING') + AddTextComponentString(CurrentActionMsg) + DisplayHelpTextFromStringLabel(0, 0, 1, -1) + if IsControlJustReleased(0, Keys['E']) then + isInZone = true -- unless we set this boolean to false, we will always freeze the user + if CurrentAction == 'exitMarker' then + isInZone = false -- do not freeze user + TriggerEvent('esx_drugs:freezePlayer', false) + TriggerEvent('esx_drugs:hasExitedMarker', lastZone) + Citizen.Wait(15000) + elseif CurrentAction == 'CokeField' then + TriggerServerEvent('esx_drugs:startHarvestCoke') + elseif CurrentAction == 'CokeProcessing' then + TriggerServerEvent('esx_drugs:startTransformCoke') + elseif CurrentAction == 'CokeDealer' then + TriggerServerEvent('esx_drugs:startSellCoke') + elseif CurrentAction == 'MethField' then + TriggerServerEvent('esx_drugs:startHarvestMeth') + elseif CurrentAction == 'MethProcessing' then + TriggerServerEvent('esx_drugs:startTransformMeth') + elseif CurrentAction == 'MethDealer' then + TriggerServerEvent('esx_drugs:startSellMeth') + elseif CurrentAction == 'WeedField' then + TriggerServerEvent('esx_drugs:startHarvestWeed') + elseif CurrentAction == 'WeedProcessing' then + TriggerServerEvent('esx_drugs:startTransformWeed') + elseif CurrentAction == 'WeedDealer' then + TriggerServerEvent('esx_drugs:startSellWeed') + elseif CurrentAction == 'OpiumField' then + TriggerServerEvent('esx_drugs:startHarvestOpium') + elseif CurrentAction == 'OpiumProcessing' then + TriggerServerEvent('esx_drugs:startTransformOpium') + elseif CurrentAction == 'OpiumDealer' then + TriggerServerEvent('esx_drugs:startSellOpium') + else + isInZone = false -- not a esx_drugs zone + end + + if isInZone then + TriggerEvent('esx_drugs:freezePlayer', true) + end + + CurrentAction = nil + end + end + end +end) + +RegisterNetEvent('esx_drugs:freezePlayer') +AddEventHandler('esx_drugs:freezePlayer', function(freeze) + FreezeEntityPosition(GetPlayerPed(-1), freeze) +end) diff --git a/server/esx_drugs_sv.lua b/server/main.lua similarity index 96% rename from server/esx_drugs_sv.lua rename to server/main.lua index 2e4401a9..9fe2394d 100644 --- a/server/esx_drugs_sv.lua +++ b/server/main.lua @@ -1,643 +1,643 @@ -ESX = nil -local CopsConnected = 0 -local PlayersHarvestingCoke = {} -local PlayersTransformingCoke = {} -local PlayersSellingCoke = {} -local PlayersHarvestingMeth = {} -local PlayersTransformingMeth = {} -local PlayersSellingMeth = {} -local PlayersHarvestingWeed = {} -local PlayersTransformingWeed = {} -local PlayersSellingWeed = {} -local PlayersHarvestingOpium = {} -local PlayersTransformingOpium = {} -local PlayersSellingOpium = {} - -TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) - -function CountCops() - local xPlayers = ESX.GetPlayers() - - CopsConnected = 0 - - for i=1, #xPlayers, 1 do - local xPlayer = ESX.GetPlayerFromId(xPlayers[i]) - if xPlayer.job.name == 'police' then - CopsConnected = CopsConnected + 1 - end - end - - SetTimeout(120 * 1000, CountCops) -end - -CountCops() - ---coke -local function HarvestCoke(source) - if CopsConnected < Config.RequiredCopsCoke then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsCoke)) - return - end - - SetTimeout(Config.TimeToFarm, function() - if PlayersHarvestingCoke[source] then - local xPlayer = ESX.GetPlayerFromId(source) - local coke = xPlayer.getInventoryItem('coke') - - if coke.limit ~= -1 and coke.count >= coke.limit then - TriggerClientEvent('esx:showNotification', source, _U('inv_full_coke')) - else - xPlayer.addInventoryItem('coke', 1) - HarvestCoke(source) - end - end - end) -end - -RegisterServerEvent('esx_drugs:startHarvestCoke') -AddEventHandler('esx_drugs:startHarvestCoke', function() - local _source = source - - PlayersHarvestingCoke[_source] = true - - TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog')) - - HarvestCoke(_source) -end) - -RegisterServerEvent('esx_drugs:stopHarvestCoke') -AddEventHandler('esx_drugs:stopHarvestCoke', function() - local _source = source - - PlayersHarvestingCoke[_source] = false -end) - -local function TransformCoke(source) - if CopsConnected < Config.RequiredCopsCoke then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsCoke)) - return - end - - SetTimeout(Config.TimeToProcess, function() - if PlayersTransformingCoke[source] then - local xPlayer = ESX.GetPlayerFromId(source) - local cokeQuantity = xPlayer.getInventoryItem('coke').count - local pooch = xPlayer.getInventoryItem('coke_pooch').count - - if pooch.limit ~= -1 and pooch.count >= pooch.limit then - TriggerClientEvent('esx:showNotification', source, _U('too_many_pouches')) - elseif cokeQuantity < 5 then - TriggerClientEvent('esx:showNotification', source, _U('not_enough_coke')) - else - xPlayer.removeInventoryItem('coke', 5) - xPlayer.addInventoryItem('coke_pooch', 1) - - TransformCoke(source) - end - end - end) -end - -RegisterServerEvent('esx_drugs:startTransformCoke') -AddEventHandler('esx_drugs:startTransformCoke', function() - local _source = source - - PlayersTransformingCoke[_source] = true - - TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog')) - - TransformCoke(_source) -end) - -RegisterServerEvent('esx_drugs:stopTransformCoke') -AddEventHandler('esx_drugs:stopTransformCoke', function() - local _source = source - - PlayersTransformingCoke[_source] = false -end) - -local function SellCoke(source) - if CopsConnected < Config.RequiredCopsCoke then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsCoke)) - return - end - - SetTimeout(Config.TimeToSell, function() - if PlayersSellingCoke[source] then - local xPlayer = ESX.GetPlayerFromId(source) - local poochQuantity = xPlayer.getInventoryItem('coke_pooch').count - - if poochQuantity == 0 then - TriggerClientEvent('esx:showNotification', source, _U('no_pouches_sale')) - else - xPlayer.removeInventoryItem('coke_pooch', 1) - if CopsConnected == 0 then - xPlayer.addAccountMoney('black_money', 198) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) - elseif CopsConnected == 1 then - xPlayer.addAccountMoney('black_money', 258) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) - elseif CopsConnected == 2 then - xPlayer.addAccountMoney('black_money', 308) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) - elseif CopsConnected == 3 then - xPlayer.addAccountMoney('black_money', 358) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) - elseif CopsConnected == 4 then - xPlayer.addAccountMoney('black_money', 396) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) - elseif CopsConnected >= 5 then - xPlayer.addAccountMoney('black_money', 428) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) - end - - SellCoke(source) - end - end - end) -end - -RegisterServerEvent('esx_drugs:startSellCoke') -AddEventHandler('esx_drugs:startSellCoke', function() - local _source = source - - PlayersSellingCoke[_source] = true - - TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog')) - - SellCoke(_source) -end) - -RegisterServerEvent('esx_drugs:stopSellCoke') -AddEventHandler('esx_drugs:stopSellCoke', function() - local _source = source - - PlayersSellingCoke[_source] = false -end) - ---meth -local function HarvestMeth(source) - if CopsConnected < Config.RequiredCopsMeth then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsMeth)) - return - end - - SetTimeout(Config.TimeToFarm, function() - if PlayersHarvestingMeth[source] then - local xPlayer = ESX.GetPlayerFromId(source) - local meth = xPlayer.getInventoryItem('meth') - - if meth.limit ~= -1 and meth.count >= meth.limit then - TriggerClientEvent('esx:showNotification', source, _U('inv_full_meth')) - else - xPlayer.addInventoryItem('meth', 1) - HarvestMeth(source) - end - end - end) -end - -RegisterServerEvent('esx_drugs:startHarvestMeth') -AddEventHandler('esx_drugs:startHarvestMeth', function() - local _source = source - - PlayersHarvestingMeth[_source] = true - - TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog')) - - HarvestMeth(_source) -end) - -RegisterServerEvent('esx_drugs:stopHarvestMeth') -AddEventHandler('esx_drugs:stopHarvestMeth', function() - local _source = source - - PlayersHarvestingMeth[_source] = false -end) - -local function TransformMeth(source) - if CopsConnected < Config.RequiredCopsMeth then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsMeth)) - return - end - - SetTimeout(Config.TimeToProcess, function() - if PlayersTransformingMeth[source] then - local xPlayer = ESX.GetPlayerFromId(source) - local methQuantity = xPlayer.getInventoryItem('meth').count - local pooch = xPlayer.getInventoryItem('meth_pooch') - - if pooch.limit ~= -1 and pooch.count >= pooch.limit then - TriggerClientEvent('esx:showNotification', source, _U('too_many_pouches')) - elseif methQuantity < 5 then - TriggerClientEvent('esx:showNotification', source, _U('not_enough_meth')) - else - xPlayer.removeInventoryItem('meth', 5) - xPlayer.addInventoryItem('meth_pooch', 1) - - TransformMeth(source) - end - end - end) -end - -RegisterServerEvent('esx_drugs:startTransformMeth') -AddEventHandler('esx_drugs:startTransformMeth', function() - local _source = source - - PlayersTransformingMeth[_source] = true - - TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog')) - - TransformMeth(_source) -end) - -RegisterServerEvent('esx_drugs:stopTransformMeth') -AddEventHandler('esx_drugs:stopTransformMeth', function() - local _source = source - - PlayersTransformingMeth[_source] = false -end) - -local function SellMeth(source) - if CopsConnected < Config.RequiredCopsMeth then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsMeth)) - return - end - - SetTimeout(Config.TimeToSell, function() - if PlayersSellingMeth[source] then - local xPlayer = ESX.GetPlayerFromId(source) - local poochQuantity = xPlayer.getInventoryItem('meth_pooch').count - - if poochQuantity == 0 then - TriggerClientEvent('esx:showNotification', source, _U('no_pouches_sale')) - else - xPlayer.removeInventoryItem('meth_pooch', 1) - if CopsConnected == 0 then - xPlayer.addAccountMoney('black_money', 276) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) - elseif CopsConnected == 1 then - xPlayer.addAccountMoney('black_money', 374) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) - elseif CopsConnected == 2 then - xPlayer.addAccountMoney('black_money', 474) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) - elseif CopsConnected == 3 then - xPlayer.addAccountMoney('black_money', 552) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) - elseif CopsConnected == 4 then - xPlayer.addAccountMoney('black_money', 616) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) - elseif CopsConnected == 5 then - xPlayer.addAccountMoney('black_money', 654) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) - elseif CopsConnected >= 6 then - xPlayer.addAccountMoney('black_money', 686) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) - end - - SellMeth(source) - end - end - end) -end - -RegisterServerEvent('esx_drugs:startSellMeth') -AddEventHandler('esx_drugs:startSellMeth', function() - local _source = source - - PlayersSellingMeth[_source] = true - - TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog')) - - SellMeth(_source) -end) - -RegisterServerEvent('esx_drugs:stopSellMeth') -AddEventHandler('esx_drugs:stopSellMeth', function() - local _source = source - - PlayersSellingMeth[_source] = false -end) - ---weed -local function HarvestWeed(source) - if CopsConnected < Config.RequiredCopsWeed then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsWeed)) - return - end - - SetTimeout(Config.TimeToFarm, function() - if PlayersHarvestingWeed[source] == true then - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) - local weed = xPlayer.getInventoryItem('weed') - - if weed.limit ~= -1 and weed.count >= weed.limit then - TriggerClientEvent('esx:showNotification', source, _U('inv_full_weed')) - else - xPlayer.addInventoryItem('weed', 1) - HarvestWeed(source) - end - end - end) -end - -RegisterServerEvent('esx_drugs:startHarvestWeed') -AddEventHandler('esx_drugs:startHarvestWeed', function() - local _source = source - - PlayersHarvestingWeed[_source] = true - - TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog')) - - HarvestWeed(_source) -end) - -RegisterServerEvent('esx_drugs:stopHarvestWeed') -AddEventHandler('esx_drugs:stopHarvestWeed', function() - local _source = source - - PlayersHarvestingWeed[_source] = false -end) - -local function TransformWeed(source) - if CopsConnected < Config.RequiredCopsWeed then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsWeed)) - return - end - - SetTimeout(Config.TimeToProcess, function() - if PlayersTransformingWeed[source] then - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) - local weedQuantity = xPlayer.getInventoryItem('weed').count - local pooch = xPlayer.getInventoryItem('weed_pooch') - - if pooch.limit ~= -1 and pooch.count >= pooch.limit then - TriggerClientEvent('esx:showNotification', source, _U('too_many_pouches')) - elseif weedQuantity < 5 then - TriggerClientEvent('esx:showNotification', source, _U('not_enough_weed')) - else - xPlayer.removeInventoryItem('weed', 5) - xPlayer.addInventoryItem('weed_pooch', 1) - - TransformWeed(source) - end - end - end) -end - -RegisterServerEvent('esx_drugs:startTransformWeed') -AddEventHandler('esx_drugs:startTransformWeed', function() - local _source = source - - PlayersTransformingWeed[_source] = true - - TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog')) - - TransformWeed(_source) -end) - -RegisterServerEvent('esx_drugs:stopTransformWeed') -AddEventHandler('esx_drugs:stopTransformWeed', function() - local _source = source - - PlayersTransformingWeed[_source] = false -end) - -local function SellWeed(source) - if CopsConnected < Config.RequiredCopsWeed then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsWeed)) - return - end - - SetTimeout(Config.TimeToSell, function() - if PlayersSellingWeed[source] then - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) - local poochQuantity = xPlayer.getInventoryItem('weed_pooch').count - - if poochQuantity == 0 then - TriggerClientEvent('esx:showNotification', source, _U('no_pouches_sale')) - else - xPlayer.removeInventoryItem('weed_pooch', 1) - if CopsConnected == 0 then - xPlayer.addAccountMoney('black_money', 108) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_weed')) - elseif CopsConnected == 1 then - xPlayer.addAccountMoney('black_money', 128) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_weed')) - elseif CopsConnected == 2 then - xPlayer.addAccountMoney('black_money', 152) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_weed')) - elseif CopsConnected == 3 then - xPlayer.addAccountMoney('black_money', 165) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_weed')) - elseif CopsConnected >= 4 then - xPlayer.addAccountMoney('black_money', 180) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_weed')) - end - - SellWeed(source) - end - end - end) -end - -RegisterServerEvent('esx_drugs:startSellWeed') -AddEventHandler('esx_drugs:startSellWeed', function() - local _source = source - - PlayersSellingWeed[_source] = true - - TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog')) - - SellWeed(_source) -end) - -RegisterServerEvent('esx_drugs:stopSellWeed') -AddEventHandler('esx_drugs:stopSellWeed', function() - local _source = source - - PlayersSellingWeed[_source] = false -end) - - ---opium - -local function HarvestOpium(source) - if CopsConnected < Config.RequiredCopsOpium then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsOpium)) - return - end - - SetTimeout(Config.TimeToFarm, function() - if PlayersHarvestingOpium[source] then - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) - local opium = xPlayer.getInventoryItem('opium') - - if opium.limit ~= -1 and opium.count >= opium.limit then - TriggerClientEvent('esx:showNotification', _source, _U('inv_full_opium')) - else - xPlayer.addInventoryItem('opium', 1) - HarvestOpium(_source) - end - end - end) -end - -RegisterServerEvent('esx_drugs:startHarvestOpium') -AddEventHandler('esx_drugs:startHarvestOpium', function() - local _source = source - - PlayersHarvestingOpium[_source] = true - - TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog')) - - HarvestOpium(_source) -end) - -RegisterServerEvent('esx_drugs:stopHarvestOpium') -AddEventHandler('esx_drugs:stopHarvestOpium', function() - local _source = source - - PlayersHarvestingOpium[_source] = false -end) - -local function TransformOpium(source) - if CopsConnected < Config.RequiredCopsOpium then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsOpium)) - return - end - - SetTimeout(Config.TimeToProcess, function() - if PlayersTransformingOpium[source] then - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) - - local opiumQuantity = xPlayer.getInventoryItem('opium').count - local pooch = xPlayer.getInventoryItem('opium_pooch') - - if pooch.limit ~= -1 and pooch.count >= pooch.limit then - TriggerClientEvent('esx:showNotification', _source, _U('too_many_pouches')) - elseif opiumQuantity < 5 then - TriggerClientEvent('esx:showNotification', _source, _U('not_enough_opium')) - else - xPlayer.removeInventoryItem('opium', 5) - xPlayer.addInventoryItem('opium_pooch', 1) - - TransformOpium(_source) - end - end - end) -end - -RegisterServerEvent('esx_drugs:startTransformOpium') -AddEventHandler('esx_drugs:startTransformOpium', function() - local _source = source - - PlayersTransformingOpium[_source] = true - - TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog')) - - TransformOpium(_source) -end) - -RegisterServerEvent('esx_drugs:stopTransformOpium') -AddEventHandler('esx_drugs:stopTransformOpium', function() - local _source = source - - PlayersTransformingOpium[_source] = false -end) - -local function SellOpium(source) - if CopsConnected < Config.RequiredCopsOpium then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsOpium)) - return - end - - SetTimeout(Config.TimeToSell, function() - if PlayersSellingOpium[source] then - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) - local poochQuantity = xPlayer.getInventoryItem('opium_pooch').count - - if poochQuantity == 0 then - TriggerClientEvent('esx:showNotification', source, _U('no_pouches_sale')) - else - xPlayer.removeInventoryItem('opium_pooch', 1) - if CopsConnected == 0 then - xPlayer.addAccountMoney('black_money', 300) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) - elseif CopsConnected == 1 then - xPlayer.addAccountMoney('black_money', 500) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) - elseif CopsConnected == 2 then - xPlayer.addAccountMoney('black_money', 700) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) - elseif CopsConnected == 3 then - xPlayer.addAccountMoney('black_money', 800) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) - elseif CopsConnected == 4 then - xPlayer.addAccountMoney('black_money', 900) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) - elseif CopsConnected >= 5 then - xPlayer.addAccountMoney('black_money', 1000) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) - end - - SellOpium(source) - end - end - end) -end - -RegisterServerEvent('esx_drugs:startSellOpium') -AddEventHandler('esx_drugs:startSellOpium', function() - local _source = source - - PlayersSellingOpium[_source] = true - - TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog')) - - SellOpium(_source) -end) - -RegisterServerEvent('esx_drugs:stopSellOpium') -AddEventHandler('esx_drugs:stopSellOpium', function() - local _source = source - - PlayersSellingOpium[_source] = false -end) - -RegisterServerEvent('esx_drugs:GetUserInventory') -AddEventHandler('esx_drugs:GetUserInventory', function(currentZone) - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) - TriggerClientEvent('esx_drugs:ReturnInventory', - _source, - xPlayer.getInventoryItem('coke').count, - xPlayer.getInventoryItem('coke_pooch').count, - xPlayer.getInventoryItem('meth').count, - xPlayer.getInventoryItem('meth_pooch').count, - xPlayer.getInventoryItem('weed').count, - xPlayer.getInventoryItem('weed_pooch').count, - xPlayer.getInventoryItem('opium').count, - xPlayer.getInventoryItem('opium_pooch').count, - xPlayer.job.name, - currentZone - ) -end) - -ESX.RegisterUsableItem('weed', function(source) - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) - - xPlayer.removeInventoryItem('weed', 1) - - TriggerClientEvent('esx_drugs:onPot', _source) - TriggerClientEvent('esx:showNotification', _source, _U('used_one_weed')) -end) +ESX = nil +local CopsConnected = 0 +local PlayersHarvestingCoke = {} +local PlayersTransformingCoke = {} +local PlayersSellingCoke = {} +local PlayersHarvestingMeth = {} +local PlayersTransformingMeth = {} +local PlayersSellingMeth = {} +local PlayersHarvestingWeed = {} +local PlayersTransformingWeed = {} +local PlayersSellingWeed = {} +local PlayersHarvestingOpium = {} +local PlayersTransformingOpium = {} +local PlayersSellingOpium = {} + +TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) + +function CountCops() + local xPlayers = ESX.GetPlayers() + + CopsConnected = 0 + + for i=1, #xPlayers, 1 do + local xPlayer = ESX.GetPlayerFromId(xPlayers[i]) + if xPlayer.job.name == 'police' then + CopsConnected = CopsConnected + 1 + end + end + + SetTimeout(120 * 1000, CountCops) +end + +CountCops() + +--coke +local function HarvestCoke(source) + if CopsConnected < Config.RequiredCopsCoke then + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsCoke)) + return + end + + SetTimeout(Config.TimeToFarm, function() + if PlayersHarvestingCoke[source] then + local xPlayer = ESX.GetPlayerFromId(source) + local coke = xPlayer.getInventoryItem('coke') + + if coke.limit ~= -1 and coke.count >= coke.limit then + TriggerClientEvent('esx:showNotification', source, _U('inv_full_coke')) + else + xPlayer.addInventoryItem('coke', 1) + HarvestCoke(source) + end + end + end) +end + +RegisterServerEvent('esx_drugs:startHarvestCoke') +AddEventHandler('esx_drugs:startHarvestCoke', function() + local _source = source + + PlayersHarvestingCoke[_source] = true + + TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog')) + + HarvestCoke(_source) +end) + +RegisterServerEvent('esx_drugs:stopHarvestCoke') +AddEventHandler('esx_drugs:stopHarvestCoke', function() + local _source = source + + PlayersHarvestingCoke[_source] = false +end) + +local function TransformCoke(source) + if CopsConnected < Config.RequiredCopsCoke then + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsCoke)) + return + end + + SetTimeout(Config.TimeToProcess, function() + if PlayersTransformingCoke[source] then + local xPlayer = ESX.GetPlayerFromId(source) + local cokeQuantity = xPlayer.getInventoryItem('coke').count + local pooch = xPlayer.getInventoryItem('coke_pooch').count + + if pooch.limit ~= -1 and pooch.count >= pooch.limit then + TriggerClientEvent('esx:showNotification', source, _U('too_many_pouches')) + elseif cokeQuantity < 5 then + TriggerClientEvent('esx:showNotification', source, _U('not_enough_coke')) + else + xPlayer.removeInventoryItem('coke', 5) + xPlayer.addInventoryItem('coke_pooch', 1) + + TransformCoke(source) + end + end + end) +end + +RegisterServerEvent('esx_drugs:startTransformCoke') +AddEventHandler('esx_drugs:startTransformCoke', function() + local _source = source + + PlayersTransformingCoke[_source] = true + + TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog')) + + TransformCoke(_source) +end) + +RegisterServerEvent('esx_drugs:stopTransformCoke') +AddEventHandler('esx_drugs:stopTransformCoke', function() + local _source = source + + PlayersTransformingCoke[_source] = false +end) + +local function SellCoke(source) + if CopsConnected < Config.RequiredCopsCoke then + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsCoke)) + return + end + + SetTimeout(Config.TimeToSell, function() + if PlayersSellingCoke[source] then + local xPlayer = ESX.GetPlayerFromId(source) + local poochQuantity = xPlayer.getInventoryItem('coke_pooch').count + + if poochQuantity == 0 then + TriggerClientEvent('esx:showNotification', source, _U('no_pouches_sale')) + else + xPlayer.removeInventoryItem('coke_pooch', 1) + if CopsConnected == 0 then + xPlayer.addAccountMoney('black_money', 198) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) + elseif CopsConnected == 1 then + xPlayer.addAccountMoney('black_money', 258) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) + elseif CopsConnected == 2 then + xPlayer.addAccountMoney('black_money', 308) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) + elseif CopsConnected == 3 then + xPlayer.addAccountMoney('black_money', 358) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) + elseif CopsConnected == 4 then + xPlayer.addAccountMoney('black_money', 396) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) + elseif CopsConnected >= 5 then + xPlayer.addAccountMoney('black_money', 428) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) + end + + SellCoke(source) + end + end + end) +end + +RegisterServerEvent('esx_drugs:startSellCoke') +AddEventHandler('esx_drugs:startSellCoke', function() + local _source = source + + PlayersSellingCoke[_source] = true + + TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog')) + + SellCoke(_source) +end) + +RegisterServerEvent('esx_drugs:stopSellCoke') +AddEventHandler('esx_drugs:stopSellCoke', function() + local _source = source + + PlayersSellingCoke[_source] = false +end) + +--meth +local function HarvestMeth(source) + if CopsConnected < Config.RequiredCopsMeth then + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsMeth)) + return + end + + SetTimeout(Config.TimeToFarm, function() + if PlayersHarvestingMeth[source] then + local xPlayer = ESX.GetPlayerFromId(source) + local meth = xPlayer.getInventoryItem('meth') + + if meth.limit ~= -1 and meth.count >= meth.limit then + TriggerClientEvent('esx:showNotification', source, _U('inv_full_meth')) + else + xPlayer.addInventoryItem('meth', 1) + HarvestMeth(source) + end + end + end) +end + +RegisterServerEvent('esx_drugs:startHarvestMeth') +AddEventHandler('esx_drugs:startHarvestMeth', function() + local _source = source + + PlayersHarvestingMeth[_source] = true + + TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog')) + + HarvestMeth(_source) +end) + +RegisterServerEvent('esx_drugs:stopHarvestMeth') +AddEventHandler('esx_drugs:stopHarvestMeth', function() + local _source = source + + PlayersHarvestingMeth[_source] = false +end) + +local function TransformMeth(source) + if CopsConnected < Config.RequiredCopsMeth then + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsMeth)) + return + end + + SetTimeout(Config.TimeToProcess, function() + if PlayersTransformingMeth[source] then + local xPlayer = ESX.GetPlayerFromId(source) + local methQuantity = xPlayer.getInventoryItem('meth').count + local pooch = xPlayer.getInventoryItem('meth_pooch') + + if pooch.limit ~= -1 and pooch.count >= pooch.limit then + TriggerClientEvent('esx:showNotification', source, _U('too_many_pouches')) + elseif methQuantity < 5 then + TriggerClientEvent('esx:showNotification', source, _U('not_enough_meth')) + else + xPlayer.removeInventoryItem('meth', 5) + xPlayer.addInventoryItem('meth_pooch', 1) + + TransformMeth(source) + end + end + end) +end + +RegisterServerEvent('esx_drugs:startTransformMeth') +AddEventHandler('esx_drugs:startTransformMeth', function() + local _source = source + + PlayersTransformingMeth[_source] = true + + TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog')) + + TransformMeth(_source) +end) + +RegisterServerEvent('esx_drugs:stopTransformMeth') +AddEventHandler('esx_drugs:stopTransformMeth', function() + local _source = source + + PlayersTransformingMeth[_source] = false +end) + +local function SellMeth(source) + if CopsConnected < Config.RequiredCopsMeth then + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsMeth)) + return + end + + SetTimeout(Config.TimeToSell, function() + if PlayersSellingMeth[source] then + local xPlayer = ESX.GetPlayerFromId(source) + local poochQuantity = xPlayer.getInventoryItem('meth_pooch').count + + if poochQuantity == 0 then + TriggerClientEvent('esx:showNotification', source, _U('no_pouches_sale')) + else + xPlayer.removeInventoryItem('meth_pooch', 1) + if CopsConnected == 0 then + xPlayer.addAccountMoney('black_money', 276) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) + elseif CopsConnected == 1 then + xPlayer.addAccountMoney('black_money', 374) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) + elseif CopsConnected == 2 then + xPlayer.addAccountMoney('black_money', 474) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) + elseif CopsConnected == 3 then + xPlayer.addAccountMoney('black_money', 552) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) + elseif CopsConnected == 4 then + xPlayer.addAccountMoney('black_money', 616) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) + elseif CopsConnected == 5 then + xPlayer.addAccountMoney('black_money', 654) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) + elseif CopsConnected >= 6 then + xPlayer.addAccountMoney('black_money', 686) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) + end + + SellMeth(source) + end + end + end) +end + +RegisterServerEvent('esx_drugs:startSellMeth') +AddEventHandler('esx_drugs:startSellMeth', function() + local _source = source + + PlayersSellingMeth[_source] = true + + TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog')) + + SellMeth(_source) +end) + +RegisterServerEvent('esx_drugs:stopSellMeth') +AddEventHandler('esx_drugs:stopSellMeth', function() + local _source = source + + PlayersSellingMeth[_source] = false +end) + +--weed +local function HarvestWeed(source) + if CopsConnected < Config.RequiredCopsWeed then + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsWeed)) + return + end + + SetTimeout(Config.TimeToFarm, function() + if PlayersHarvestingWeed[source] == true then + local _source = source + local xPlayer = ESX.GetPlayerFromId(_source) + local weed = xPlayer.getInventoryItem('weed') + + if weed.limit ~= -1 and weed.count >= weed.limit then + TriggerClientEvent('esx:showNotification', source, _U('inv_full_weed')) + else + xPlayer.addInventoryItem('weed', 1) + HarvestWeed(source) + end + end + end) +end + +RegisterServerEvent('esx_drugs:startHarvestWeed') +AddEventHandler('esx_drugs:startHarvestWeed', function() + local _source = source + + PlayersHarvestingWeed[_source] = true + + TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog')) + + HarvestWeed(_source) +end) + +RegisterServerEvent('esx_drugs:stopHarvestWeed') +AddEventHandler('esx_drugs:stopHarvestWeed', function() + local _source = source + + PlayersHarvestingWeed[_source] = false +end) + +local function TransformWeed(source) + if CopsConnected < Config.RequiredCopsWeed then + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsWeed)) + return + end + + SetTimeout(Config.TimeToProcess, function() + if PlayersTransformingWeed[source] then + local _source = source + local xPlayer = ESX.GetPlayerFromId(_source) + local weedQuantity = xPlayer.getInventoryItem('weed').count + local pooch = xPlayer.getInventoryItem('weed_pooch') + + if pooch.limit ~= -1 and pooch.count >= pooch.limit then + TriggerClientEvent('esx:showNotification', source, _U('too_many_pouches')) + elseif weedQuantity < 5 then + TriggerClientEvent('esx:showNotification', source, _U('not_enough_weed')) + else + xPlayer.removeInventoryItem('weed', 5) + xPlayer.addInventoryItem('weed_pooch', 1) + + TransformWeed(source) + end + end + end) +end + +RegisterServerEvent('esx_drugs:startTransformWeed') +AddEventHandler('esx_drugs:startTransformWeed', function() + local _source = source + + PlayersTransformingWeed[_source] = true + + TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog')) + + TransformWeed(_source) +end) + +RegisterServerEvent('esx_drugs:stopTransformWeed') +AddEventHandler('esx_drugs:stopTransformWeed', function() + local _source = source + + PlayersTransformingWeed[_source] = false +end) + +local function SellWeed(source) + if CopsConnected < Config.RequiredCopsWeed then + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsWeed)) + return + end + + SetTimeout(Config.TimeToSell, function() + if PlayersSellingWeed[source] then + local _source = source + local xPlayer = ESX.GetPlayerFromId(_source) + local poochQuantity = xPlayer.getInventoryItem('weed_pooch').count + + if poochQuantity == 0 then + TriggerClientEvent('esx:showNotification', source, _U('no_pouches_sale')) + else + xPlayer.removeInventoryItem('weed_pooch', 1) + if CopsConnected == 0 then + xPlayer.addAccountMoney('black_money', 108) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_weed')) + elseif CopsConnected == 1 then + xPlayer.addAccountMoney('black_money', 128) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_weed')) + elseif CopsConnected == 2 then + xPlayer.addAccountMoney('black_money', 152) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_weed')) + elseif CopsConnected == 3 then + xPlayer.addAccountMoney('black_money', 165) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_weed')) + elseif CopsConnected >= 4 then + xPlayer.addAccountMoney('black_money', 180) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_weed')) + end + + SellWeed(source) + end + end + end) +end + +RegisterServerEvent('esx_drugs:startSellWeed') +AddEventHandler('esx_drugs:startSellWeed', function() + local _source = source + + PlayersSellingWeed[_source] = true + + TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog')) + + SellWeed(_source) +end) + +RegisterServerEvent('esx_drugs:stopSellWeed') +AddEventHandler('esx_drugs:stopSellWeed', function() + local _source = source + + PlayersSellingWeed[_source] = false +end) + + +--opium + +local function HarvestOpium(source) + if CopsConnected < Config.RequiredCopsOpium then + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsOpium)) + return + end + + SetTimeout(Config.TimeToFarm, function() + if PlayersHarvestingOpium[source] then + local _source = source + local xPlayer = ESX.GetPlayerFromId(_source) + local opium = xPlayer.getInventoryItem('opium') + + if opium.limit ~= -1 and opium.count >= opium.limit then + TriggerClientEvent('esx:showNotification', _source, _U('inv_full_opium')) + else + xPlayer.addInventoryItem('opium', 1) + HarvestOpium(_source) + end + end + end) +end + +RegisterServerEvent('esx_drugs:startHarvestOpium') +AddEventHandler('esx_drugs:startHarvestOpium', function() + local _source = source + + PlayersHarvestingOpium[_source] = true + + TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog')) + + HarvestOpium(_source) +end) + +RegisterServerEvent('esx_drugs:stopHarvestOpium') +AddEventHandler('esx_drugs:stopHarvestOpium', function() + local _source = source + + PlayersHarvestingOpium[_source] = false +end) + +local function TransformOpium(source) + if CopsConnected < Config.RequiredCopsOpium then + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsOpium)) + return + end + + SetTimeout(Config.TimeToProcess, function() + if PlayersTransformingOpium[source] then + local _source = source + local xPlayer = ESX.GetPlayerFromId(_source) + + local opiumQuantity = xPlayer.getInventoryItem('opium').count + local pooch = xPlayer.getInventoryItem('opium_pooch') + + if pooch.limit ~= -1 and pooch.count >= pooch.limit then + TriggerClientEvent('esx:showNotification', _source, _U('too_many_pouches')) + elseif opiumQuantity < 5 then + TriggerClientEvent('esx:showNotification', _source, _U('not_enough_opium')) + else + xPlayer.removeInventoryItem('opium', 5) + xPlayer.addInventoryItem('opium_pooch', 1) + + TransformOpium(_source) + end + end + end) +end + +RegisterServerEvent('esx_drugs:startTransformOpium') +AddEventHandler('esx_drugs:startTransformOpium', function() + local _source = source + + PlayersTransformingOpium[_source] = true + + TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog')) + + TransformOpium(_source) +end) + +RegisterServerEvent('esx_drugs:stopTransformOpium') +AddEventHandler('esx_drugs:stopTransformOpium', function() + local _source = source + + PlayersTransformingOpium[_source] = false +end) + +local function SellOpium(source) + if CopsConnected < Config.RequiredCopsOpium then + TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsOpium)) + return + end + + SetTimeout(Config.TimeToSell, function() + if PlayersSellingOpium[source] then + local _source = source + local xPlayer = ESX.GetPlayerFromId(_source) + local poochQuantity = xPlayer.getInventoryItem('opium_pooch').count + + if poochQuantity == 0 then + TriggerClientEvent('esx:showNotification', source, _U('no_pouches_sale')) + else + xPlayer.removeInventoryItem('opium_pooch', 1) + if CopsConnected == 0 then + xPlayer.addAccountMoney('black_money', 300) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) + elseif CopsConnected == 1 then + xPlayer.addAccountMoney('black_money', 500) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) + elseif CopsConnected == 2 then + xPlayer.addAccountMoney('black_money', 700) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) + elseif CopsConnected == 3 then + xPlayer.addAccountMoney('black_money', 800) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) + elseif CopsConnected == 4 then + xPlayer.addAccountMoney('black_money', 900) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) + elseif CopsConnected >= 5 then + xPlayer.addAccountMoney('black_money', 1000) + TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) + end + + SellOpium(source) + end + end + end) +end + +RegisterServerEvent('esx_drugs:startSellOpium') +AddEventHandler('esx_drugs:startSellOpium', function() + local _source = source + + PlayersSellingOpium[_source] = true + + TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog')) + + SellOpium(_source) +end) + +RegisterServerEvent('esx_drugs:stopSellOpium') +AddEventHandler('esx_drugs:stopSellOpium', function() + local _source = source + + PlayersSellingOpium[_source] = false +end) + +RegisterServerEvent('esx_drugs:GetUserInventory') +AddEventHandler('esx_drugs:GetUserInventory', function(currentZone) + local _source = source + local xPlayer = ESX.GetPlayerFromId(_source) + TriggerClientEvent('esx_drugs:ReturnInventory', + _source, + xPlayer.getInventoryItem('coke').count, + xPlayer.getInventoryItem('coke_pooch').count, + xPlayer.getInventoryItem('meth').count, + xPlayer.getInventoryItem('meth_pooch').count, + xPlayer.getInventoryItem('weed').count, + xPlayer.getInventoryItem('weed_pooch').count, + xPlayer.getInventoryItem('opium').count, + xPlayer.getInventoryItem('opium_pooch').count, + xPlayer.job.name, + currentZone + ) +end) + +ESX.RegisterUsableItem('weed', function(source) + local _source = source + local xPlayer = ESX.GetPlayerFromId(_source) + + xPlayer.removeInventoryItem('weed', 1) + + TriggerClientEvent('esx_drugs:onPot', _source) + TriggerClientEvent('esx:showNotification', _source, _U('used_one_weed')) +end) From ed62ba70d41fa44de0a459756bef5d1b8e6a3f5f Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Wed, 26 Sep 2018 11:22:36 +0200 Subject: [PATCH 37/66] Fixed exploiting zones, closes #25 --- server/main.lua | 136 ++++++++++++++++++++++++++++++------------------ 1 file changed, 85 insertions(+), 51 deletions(-) diff --git a/server/main.lua b/server/main.lua index 9fe2394d..2dc0e650 100644 --- a/server/main.lua +++ b/server/main.lua @@ -58,11 +58,14 @@ RegisterServerEvent('esx_drugs:startHarvestCoke') AddEventHandler('esx_drugs:startHarvestCoke', function() local _source = source - PlayersHarvestingCoke[_source] = true + if not PlayersHarvestingCoke[_source] then + PlayersHarvestingCoke[_source] = true - TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog')) - - HarvestCoke(_source) + TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog')) + HarvestCoke(_source) + else + print(('esx_drugs: %s attempted to exploit the marker!'):format(GetPlayerIdentifiers(_source)[1])) + end end) RegisterServerEvent('esx_drugs:stopHarvestCoke') @@ -102,11 +105,14 @@ RegisterServerEvent('esx_drugs:startTransformCoke') AddEventHandler('esx_drugs:startTransformCoke', function() local _source = source - PlayersTransformingCoke[_source] = true + if not PlayersTransformingCoke[_source] then + PlayersTransformingCoke[_source] = true - TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog')) - - TransformCoke(_source) + TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog')) + TransformCoke(_source) + else + print(('esx_drugs: %s attempted to exploit the marker!'):format(GetPlayerIdentifiers(_source)[1])) + end end) RegisterServerEvent('esx_drugs:stopTransformCoke') @@ -161,11 +167,14 @@ RegisterServerEvent('esx_drugs:startSellCoke') AddEventHandler('esx_drugs:startSellCoke', function() local _source = source - PlayersSellingCoke[_source] = true + if not PlayersSellingCoke[_source] then + PlayersSellingCoke[_source] = true - TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog')) - - SellCoke(_source) + TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog')) + SellCoke(_source) + else + print(('esx_drugs: %s attempted to exploit the marker!'):format(GetPlayerIdentifiers(_source)[1])) + end end) RegisterServerEvent('esx_drugs:stopSellCoke') @@ -201,11 +210,14 @@ RegisterServerEvent('esx_drugs:startHarvestMeth') AddEventHandler('esx_drugs:startHarvestMeth', function() local _source = source - PlayersHarvestingMeth[_source] = true + if not PlayersHarvestingMeth[_source] then + PlayersHarvestingMeth[_source] = true - TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog')) - - HarvestMeth(_source) + TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog')) + HarvestMeth(_source) + else + print(('esx_drugs: %s attempted to exploit the marker!'):format(GetPlayerIdentifiers(_source)[1])) + end end) RegisterServerEvent('esx_drugs:stopHarvestMeth') @@ -245,11 +257,14 @@ RegisterServerEvent('esx_drugs:startTransformMeth') AddEventHandler('esx_drugs:startTransformMeth', function() local _source = source - PlayersTransformingMeth[_source] = true + if not PlayersTransformingMeth[_source] then + PlayersTransformingMeth[_source] = true - TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog')) - - TransformMeth(_source) + TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog')) + TransformMeth(_source) + else + print(('esx_drugs: %s attempted to exploit the marker!'):format(GetPlayerIdentifiers(_source)[1])) + end end) RegisterServerEvent('esx_drugs:stopTransformMeth') @@ -307,11 +322,14 @@ RegisterServerEvent('esx_drugs:startSellMeth') AddEventHandler('esx_drugs:startSellMeth', function() local _source = source - PlayersSellingMeth[_source] = true + if not PlayersSellingMeth[_source] then + PlayersSellingMeth[_source] = true - TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog')) - - SellMeth(_source) + TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog')) + SellMeth(_source) + else + print(('esx_drugs: %s attempted to exploit the marker!'):format(GetPlayerIdentifiers(_source)[1])) + end end) RegisterServerEvent('esx_drugs:stopSellMeth') @@ -329,7 +347,7 @@ local function HarvestWeed(source) end SetTimeout(Config.TimeToFarm, function() - if PlayersHarvestingWeed[source] == true then + if PlayersHarvestingWeed[source] then local _source = source local xPlayer = ESX.GetPlayerFromId(_source) local weed = xPlayer.getInventoryItem('weed') @@ -348,11 +366,14 @@ RegisterServerEvent('esx_drugs:startHarvestWeed') AddEventHandler('esx_drugs:startHarvestWeed', function() local _source = source - PlayersHarvestingWeed[_source] = true + if not PlayersHarvestingWeed[_source] then + PlayersHarvestingWeed[_source] = true - TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog')) - - HarvestWeed(_source) + TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog')) + HarvestWeed(_source) + else + print(('esx_drugs: %s attempted to exploit the marker!'):format(GetPlayerIdentifiers(_source)[1])) + end end) RegisterServerEvent('esx_drugs:stopHarvestWeed') @@ -393,11 +414,14 @@ RegisterServerEvent('esx_drugs:startTransformWeed') AddEventHandler('esx_drugs:startTransformWeed', function() local _source = source - PlayersTransformingWeed[_source] = true + if not PlayersTransformingWeed[_source] then + PlayersTransformingWeed[_source] = true - TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog')) - - TransformWeed(_source) + TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog')) + TransformWeed(_source) + else + print(('esx_drugs: %s attempted to exploit the marker!'):format(GetPlayerIdentifiers(_source)[1])) + end end) RegisterServerEvent('esx_drugs:stopTransformWeed') @@ -450,11 +474,14 @@ RegisterServerEvent('esx_drugs:startSellWeed') AddEventHandler('esx_drugs:startSellWeed', function() local _source = source - PlayersSellingWeed[_source] = true + if not PlayersSellingWeed[_source] then + PlayersSellingWeed[_source] = true - TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog')) - - SellWeed(_source) + TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog')) + SellWeed(_source) + else + print(('esx_drugs: %s attempted to exploit the marker!'):format(GetPlayerIdentifiers(_source)[1])) + end end) RegisterServerEvent('esx_drugs:stopSellWeed') @@ -464,9 +491,7 @@ AddEventHandler('esx_drugs:stopSellWeed', function() PlayersSellingWeed[_source] = false end) - --opium - local function HarvestOpium(source) if CopsConnected < Config.RequiredCopsOpium then TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsOpium)) @@ -493,11 +518,14 @@ RegisterServerEvent('esx_drugs:startHarvestOpium') AddEventHandler('esx_drugs:startHarvestOpium', function() local _source = source - PlayersHarvestingOpium[_source] = true + if not PlayersHarvestingOpium[_source] then + PlayersHarvestingOpium[_source] = true - TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog')) - - HarvestOpium(_source) + TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog')) + HarvestOpium(_source) + else + print(('esx_drugs: %s attempted to exploit the marker!'):format(GetPlayerIdentifiers(_source)[1])) + end end) RegisterServerEvent('esx_drugs:stopHarvestOpium') @@ -539,11 +567,14 @@ RegisterServerEvent('esx_drugs:startTransformOpium') AddEventHandler('esx_drugs:startTransformOpium', function() local _source = source - PlayersTransformingOpium[_source] = true + if not PlayersTransformingOpium[_source] then + PlayersTransformingOpium[_source] = true - TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog')) - - TransformOpium(_source) + TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog')) + TransformOpium(_source) + else + print(('esx_drugs: %s attempted to exploit the marker!'):format(GetPlayerIdentifiers(_source)[1])) + end end) RegisterServerEvent('esx_drugs:stopTransformOpium') @@ -599,11 +630,14 @@ RegisterServerEvent('esx_drugs:startSellOpium') AddEventHandler('esx_drugs:startSellOpium', function() local _source = source - PlayersSellingOpium[_source] = true + if not PlayersSellingOpium[_source] then + PlayersSellingOpium[_source] = true - TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog')) - - SellOpium(_source) + TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog')) + SellOpium(_source) + else + print(('esx_drugs: %s attempted to exploit the marker!'):format(GetPlayerIdentifiers(_source)[1])) + end end) RegisterServerEvent('esx_drugs:stopSellOpium') From 83a031ff881fc4502c557ee92d2e7f07db2b9830 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Mon, 1 Oct 2018 20:08:15 +0200 Subject: [PATCH 38/66] Removed freezing in zones --- client/main.lua | 55 ++++++++++++------------------------------------- locales/br.lua | 1 - locales/de.lua | 1 - locales/en.lua | 1 - locales/es.lua | 1 - locales/fr.lua | 1 - locales/pl.lua | 1 - locales/sv.lua | 1 - 8 files changed, 13 insertions(+), 49 deletions(-) diff --git a/client/main.lua b/client/main.lua index 38b566c0..6614489e 100644 --- a/client/main.lua +++ b/client/main.lua @@ -22,7 +22,6 @@ local opium_poochQTE = 0 local myJob = nil local HasAlreadyEnteredMarker = false local LastZone = nil -local isInZone = false local CurrentAction = nil local CurrentActionMsg = '' local CurrentActionData = {} @@ -41,12 +40,6 @@ AddEventHandler('esx_drugs:hasEnteredMarker', function(zone) ESX.UI.Menu.CloseAll() - if zone == 'exitMarker' then - CurrentAction = zone - CurrentActionMsg = _U('exit_marker') - CurrentActionData = {} - end - if zone == 'CokeField' then CurrentAction = zone CurrentActionMsg = _U('press_collect_coke') @@ -191,7 +184,7 @@ Citizen.CreateThread(function() local coords = GetEntityCoords(GetPlayerPed(-1)) for k,v in pairs(Config.Zones) do - if(GetDistanceBetweenCoords(coords, v.x, v.y, v.z, true) < Config.DrawDistance) then + if GetDistanceBetweenCoords(coords, v.x, v.y, v.z, true) < Config.DrawDistance then DrawMarker(Config.MarkerType, v.x, v.y, v.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, Config.ZoneSize.x, Config.ZoneSize.y, Config.ZoneSize.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false) end end @@ -222,15 +215,15 @@ end -- RETURN NUMBER OF ITEMS FROM SERVER RegisterNetEvent('esx_drugs:ReturnInventory') AddEventHandler('esx_drugs:ReturnInventory', function(cokeNbr, cokepNbr, methNbr, methpNbr, weedNbr, weedpNbr, opiumNbr, opiumpNbr, jobName, currentZone) - cokeQTE = cokeNbr - coke_poochQTE = cokepNbr - methQTE = methNbr - meth_poochQTE = methpNbr - weedQTE = weedNbr - weed_poochQTE = weedpNbr - opiumQTE = opiumNbr - opium_poochQTE = opiumpNbr - myJob = jobName + cokeQTE = cokeNbr + coke_poochQTE = cokepNbr + methQTE = methNbr + meth_poochQTE = methpNbr + weedQTE = weedNbr + weed_poochQTE = weedpNbr + opiumQTE = opiumNbr + opium_poochQTE = opiumpNbr + myJob = jobName TriggerEvent('esx_drugs:hasEnteredMarker', currentZone) end) @@ -261,10 +254,6 @@ Citizen.CreateThread(function() hasAlreadyEnteredMarker = false TriggerEvent('esx_drugs:hasExitedMarker', lastZone) end - - if isInMarker and isInZone then - TriggerEvent('esx_drugs:hasEnteredMarker', 'exitMarker') - end end end) @@ -273,17 +262,10 @@ Citizen.CreateThread(function() while true do Citizen.Wait(10) if CurrentAction ~= nil then - SetTextComponentFormat('STRING') - AddTextComponentString(CurrentActionMsg) - DisplayHelpTextFromStringLabel(0, 0, 1, -1) + ESX.ShowHelpNotification(CurrentActionMsg) + if IsControlJustReleased(0, Keys['E']) then - isInZone = true -- unless we set this boolean to false, we will always freeze the user - if CurrentAction == 'exitMarker' then - isInZone = false -- do not freeze user - TriggerEvent('esx_drugs:freezePlayer', false) - TriggerEvent('esx_drugs:hasExitedMarker', lastZone) - Citizen.Wait(15000) - elseif CurrentAction == 'CokeField' then + if CurrentAction == 'CokeField' then TriggerServerEvent('esx_drugs:startHarvestCoke') elseif CurrentAction == 'CokeProcessing' then TriggerServerEvent('esx_drugs:startTransformCoke') @@ -307,12 +289,6 @@ Citizen.CreateThread(function() TriggerServerEvent('esx_drugs:startTransformOpium') elseif CurrentAction == 'OpiumDealer' then TriggerServerEvent('esx_drugs:startSellOpium') - else - isInZone = false -- not a esx_drugs zone - end - - if isInZone then - TriggerEvent('esx_drugs:freezePlayer', true) end CurrentAction = nil @@ -320,8 +296,3 @@ Citizen.CreateThread(function() end end end) - -RegisterNetEvent('esx_drugs:freezePlayer') -AddEventHandler('esx_drugs:freezePlayer', function(freeze) - FreezeEntityPosition(GetPlayerPed(-1), freeze) -end) diff --git a/locales/br.lua b/locales/br.lua index baf400b8..a7cd6f2a 100644 --- a/locales/br.lua +++ b/locales/br.lua @@ -31,7 +31,6 @@ Locales['br'] = { ['not_enough_opium'] = 'Você não tem ópio suficiente para ~r~embalar~s~', ['sold_one_opium'] = 'Você vendeu ~g~x1 Trouxinha de ópio~s~', ['used_one_opium'] = 'Você usou 1 trouxinha de ~b~ópio', - ['exit_marker'] = 'press ~INPUT_CONTEXT~ to cancel the ~y~process~s~', -- Blips ['coke_field'] = 'cocaine Field', ['coke_processing'] = 'cocaine Processing', diff --git a/locales/de.lua b/locales/de.lua index 208e35bc..ffc54e19 100644 --- a/locales/de.lua +++ b/locales/de.lua @@ -31,7 +31,6 @@ Locales['de'] = { ['not_enough_opium'] = 'du hast nicht genug Opium zum ~r~verarbeiten~s~', ['sold_one_opium'] = 'du verkaufst ~g~x1 Portion Opium~s~', ['used_one_opium'] = 'du benutzt 1x ~b~Opium', - ['exit_marker'] = 'press ~INPUT_CONTEXT~ to cancel the ~y~process~s~', -- Blips ['coke_field'] = 'cocaine Field', ['coke_processing'] = 'cocaine Processing', diff --git a/locales/en.lua b/locales/en.lua index 49618649..4bccf402 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -31,7 +31,6 @@ Locales['en'] = { ['not_enough_opium'] = 'you do not have enough opium to ~r~pack~s~', ['sold_one_opium'] = 'you\'ve sold ~g~x1 opium Pouch~s~', ['used_one_opium'] = 'you used 1 pouch of ~b~opium', - ['exit_marker'] = 'press ~INPUT_CONTEXT~ to cancel the ~y~process~s~', -- Blips ['coke_field'] = 'cocaine Field', ['coke_processing'] = 'cocaine Processing', diff --git a/locales/es.lua b/locales/es.lua index 60625a26..f123db65 100644 --- a/locales/es.lua +++ b/locales/es.lua @@ -31,7 +31,6 @@ Locales['es'] = { ['not_enough_opium'] = 'No tienes sufiente Opio para ~r~fabricar~s~', ['sold_one_opium'] = 'Has vendido ~g~1 Bolsa de Opio~s~', ['used_one_opium'] = 'Has gastado una bolsa de ~b~Opio', - ['exit_marker'] = 'press ~INPUT_CONTEXT~ to cancel the ~y~process~s~', -- Blips ['coke_field'] = 'cocaine Field', ['coke_processing'] = 'cocaine Processing', diff --git a/locales/fr.lua b/locales/fr.lua index e7cdcf5a..68a197d4 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -31,7 +31,6 @@ Locales['fr'] = { ['not_enough_opium'] = 'vous n\'avez pas assez de opium à ~r~conditionner~s~', ['sold_one_opium'] = 'vous avez vendu ~g~x1 Pochon de opium~s~', ['used_one_opium'] = 'Vous avez utilisé 1 Pochon de ~b~opium', - ['exit_marker'] = 'press ~INPUT_CONTEXT~ to cancel the ~y~process~s~', -- Blips ['coke_field'] = 'cocaine Field', ['coke_processing'] = 'cocaine Processing', diff --git a/locales/pl.lua b/locales/pl.lua index b645c88d..7c1375d1 100644 --- a/locales/pl.lua +++ b/locales/pl.lua @@ -31,7 +31,6 @@ Locales['pl'] = { ['not_enough_opium'] = 'nie masz wystarczająco opium aby je ~r~spakować~s~', ['sold_one_opium'] = 'sprzedajesz ~g~x1 torebeczka opium~s~', ['used_one_opium'] = 'wciągasz 1x torebeczka ~b~opium', - ['exit_marker'] = 'naciśnij ~INPUT_CONTEXT~ aby ~y~przerwać~s~ akcje', -- Blips ['coke_field'] = 'plantacja kokainy', ['coke_processing'] = 'przeróbka liści kokainy', diff --git a/locales/sv.lua b/locales/sv.lua index 813f3433..280c9e7a 100644 --- a/locales/sv.lua +++ b/locales/sv.lua @@ -31,7 +31,6 @@ Locales['sv'] = { ['not_enough_opium'] = 'Du har inte tillräckligt med opium för att ~r~bearbeta~s~', ['sold_one_opium'] = 'du har sålt ~y~1x~s~ ~b~väska med opium~s~', ['used_one_opium'] = 'Du använde 1 väska ~b~opium', - ['exit_marker'] = 'tryck ~INPUT_CONTEXT~ för att avbryta pågående process', -- Blips ['coke_field'] = 'coke field', ['coke_processing'] = 'coke processing', From 9abba7b787629a29000e37540d90825b3764855c Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Tue, 2 Oct 2018 17:42:22 +0200 Subject: [PATCH 39/66] Only activate on foot, fixed #42 --- client/main.lua | 81 ++++++++++++++++++++++--------------------------- server/main.lua | 15 ++++----- 2 files changed, 42 insertions(+), 54 deletions(-) diff --git a/client/main.lua b/client/main.lua index 6614489e..62776688 100644 --- a/client/main.lua +++ b/client/main.lua @@ -44,83 +44,61 @@ AddEventHandler('esx_drugs:hasEnteredMarker', function(zone) CurrentAction = zone CurrentActionMsg = _U('press_collect_coke') CurrentActionData = {} - end - - if zone == 'CokeProcessing' then + elseif zone == 'CokeProcessing' then if cokeQTE >= 5 then CurrentAction = zone CurrentActionMsg = _U('press_process_coke') CurrentActionData = {} end - end - - if zone == 'CokeDealer' then + elseif zone == 'CokeDealer' then if coke_poochQTE >= 1 then CurrentAction = zone CurrentActionMsg = _U('press_sell_coke') CurrentActionData = {} end - end - - if zone == 'MethField' then + elseif zone == 'MethField' then CurrentAction = zone CurrentActionMsg = _U('press_collect_meth') CurrentActionData = {} - end - - if zone == 'MethProcessing' then + elseif zone == 'MethProcessing' then if methQTE >= 5 then CurrentAction = zone CurrentActionMsg = _U('press_process_meth') CurrentActionData = {} end - end - - if zone == 'MethDealer' then + elseif zone == 'MethDealer' then if meth_poochQTE >= 1 then CurrentAction = zone CurrentActionMsg = _U('press_sell_meth') CurrentActionData = {} end - end - - if zone == 'WeedField' then + elseif zone == 'WeedField' then CurrentAction = zone CurrentActionMsg = _U('press_collect_weed') CurrentActionData = {} - end - - if zone == 'WeedProcessing' then + elseif zone == 'WeedProcessing' then if weedQTE >= 5 then CurrentAction = zone CurrentActionMsg = _U('press_process_weed') CurrentActionData = {} end - end - - if zone == 'WeedDealer' then + elseif zone == 'WeedDealer' then if weed_poochQTE >= 1 then CurrentAction = zone CurrentActionMsg = _U('press_sell_weed') CurrentActionData = {} end - end - - if zone == 'OpiumField' then + elseif zone == 'OpiumField' then CurrentAction = zone CurrentActionMsg = _U('press_collect_opium') CurrentActionData = {} - end - - if zone == 'OpiumProcessing' then + elseif zone == 'OpiumProcessing' then if opiumQTE >= 5 then CurrentAction = zone CurrentActionMsg = _U('press_process_opium') CurrentActionData = {} end - end - - if zone == 'OpiumDealer' then + elseif zone == 'OpiumDealer' then if opium_poochQTE >= 1 then CurrentAction = zone CurrentActionMsg = _U('press_sell_opium') @@ -133,18 +111,31 @@ AddEventHandler('esx_drugs:hasExitedMarker', function(zone) CurrentAction = nil ESX.UI.Menu.CloseAll() - TriggerServerEvent('esx_drugs:stopHarvestCoke') + if zone == 'CokeField' then + TriggerServerEvent('esx_drugs:stopHarvestCoke') + elseif zone == 'CokeProcessing' then TriggerServerEvent('esx_drugs:stopTransformCoke') - TriggerServerEvent('esx_drugs:stopSellCoke') - TriggerServerEvent('esx_drugs:stopHarvestMeth') - TriggerServerEvent('esx_drugs:stopTransformMeth') - TriggerServerEvent('esx_drugs:stopSellMeth') - TriggerServerEvent('esx_drugs:stopHarvestWeed') - TriggerServerEvent('esx_drugs:stopTransformWeed') - TriggerServerEvent('esx_drugs:stopSellWeed') - TriggerServerEvent('esx_drugs:stopHarvestOpium') - TriggerServerEvent('esx_drugs:stopTransformOpium') - TriggerServerEvent('esx_drugs:stopSellOpium') + elseif zone == 'CokeDealer' then + TriggerServerEvent('esx_drugs:stopSellCoke') + elseif zone == 'MethField' then + TriggerServerEvent('esx_drugs:stopHarvestMeth') + elseif zone == 'MethProcessing' then + TriggerServerEvent('esx_drugs:stopTransformMeth') + elseif zone == 'MethDealer' then + TriggerServerEvent('esx_drugs:stopSellMeth') + elseif zone == 'WeedField' then + TriggerServerEvent('esx_drugs:stopHarvestWeed') + elseif zone == 'WeedProcessing' then + TriggerServerEvent('esx_drugs:stopTransformWeed') + elseif zone == 'WeedDealer' then + TriggerServerEvent('esx_drugs:stopSellWeed') + elseif zone == 'OpiumField' then + TriggerServerEvent('esx_drugs:stopHarvestOpium') + elseif zone == 'OpiumProcessing' then + TriggerServerEvent('esx_drugs:stopTransformOpium') + elseif zone == 'OpiumDealer' then + TriggerServerEvent('esx_drugs:stopSellOpium') + end end) -- Weed Effect @@ -264,7 +255,7 @@ Citizen.CreateThread(function() if CurrentAction ~= nil then ESX.ShowHelpNotification(CurrentActionMsg) - if IsControlJustReleased(0, Keys['E']) then + if IsControlJustReleased(0, Keys['E']) and IsPedOnFoot(PlayerPedId()) then if CurrentAction == 'CokeField' then TriggerServerEvent('esx_drugs:startHarvestCoke') elseif CurrentAction == 'CokeProcessing' then diff --git a/server/main.lua b/server/main.lua index 2dc0e650..05e2bce7 100644 --- a/server/main.lua +++ b/server/main.lua @@ -85,7 +85,7 @@ local function TransformCoke(source) if PlayersTransformingCoke[source] then local xPlayer = ESX.GetPlayerFromId(source) local cokeQuantity = xPlayer.getInventoryItem('coke').count - local pooch = xPlayer.getInventoryItem('coke_pooch').count + local pooch = xPlayer.getInventoryItem('coke_pooch') if pooch.limit ~= -1 and pooch.count >= pooch.limit then TriggerClientEvent('esx:showNotification', source, _U('too_many_pouches')) @@ -391,8 +391,7 @@ local function TransformWeed(source) SetTimeout(Config.TimeToProcess, function() if PlayersTransformingWeed[source] then - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) + local xPlayer = ESX.GetPlayerFromId(source) local weedQuantity = xPlayer.getInventoryItem('weed').count local pooch = xPlayer.getInventoryItem('weed_pooch') @@ -543,21 +542,19 @@ local function TransformOpium(source) SetTimeout(Config.TimeToProcess, function() if PlayersTransformingOpium[source] then - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) - + local xPlayer = ESX.GetPlayerFromId(source) local opiumQuantity = xPlayer.getInventoryItem('opium').count local pooch = xPlayer.getInventoryItem('opium_pooch') if pooch.limit ~= -1 and pooch.count >= pooch.limit then - TriggerClientEvent('esx:showNotification', _source, _U('too_many_pouches')) + TriggerClientEvent('esx:showNotification', source, _U('too_many_pouches')) elseif opiumQuantity < 5 then - TriggerClientEvent('esx:showNotification', _source, _U('not_enough_opium')) + TriggerClientEvent('esx:showNotification', source, _U('not_enough_opium')) else xPlayer.removeInventoryItem('opium', 5) xPlayer.addInventoryItem('opium_pooch', 1) - TransformOpium(_source) + TransformOpium(source) end end end) From 29635212b3024792cce92563d1e6c6e069453e25 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sun, 25 Nov 2018 21:38:04 +0100 Subject: [PATCH 40/66] Typo correction --- server/main.lua | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/server/main.lua b/server/main.lua index 05e2bce7..b4846eb1 100644 --- a/server/main.lua +++ b/server/main.lua @@ -64,7 +64,7 @@ AddEventHandler('esx_drugs:startHarvestCoke', function() TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog')) HarvestCoke(_source) else - print(('esx_drugs: %s attempted to exploit the marker!'):format(GetPlayerIdentifiers(_source)[1])) + print(('esx_drugs: %s attempted to exploit the zone!'):format(GetPlayerIdentifiers(_source)[1])) end end) @@ -111,7 +111,7 @@ AddEventHandler('esx_drugs:startTransformCoke', function() TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog')) TransformCoke(_source) else - print(('esx_drugs: %s attempted to exploit the marker!'):format(GetPlayerIdentifiers(_source)[1])) + print(('esx_drugs: %s attempted to exploit the zone!'):format(GetPlayerIdentifiers(_source)[1])) end end) @@ -173,7 +173,7 @@ AddEventHandler('esx_drugs:startSellCoke', function() TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog')) SellCoke(_source) else - print(('esx_drugs: %s attempted to exploit the marker!'):format(GetPlayerIdentifiers(_source)[1])) + print(('esx_drugs: %s attempted to exploit the zone!'):format(GetPlayerIdentifiers(_source)[1])) end end) @@ -216,7 +216,7 @@ AddEventHandler('esx_drugs:startHarvestMeth', function() TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog')) HarvestMeth(_source) else - print(('esx_drugs: %s attempted to exploit the marker!'):format(GetPlayerIdentifiers(_source)[1])) + print(('esx_drugs: %s attempted to exploit the zone!'):format(GetPlayerIdentifiers(_source)[1])) end end) @@ -263,7 +263,7 @@ AddEventHandler('esx_drugs:startTransformMeth', function() TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog')) TransformMeth(_source) else - print(('esx_drugs: %s attempted to exploit the marker!'):format(GetPlayerIdentifiers(_source)[1])) + print(('esx_drugs: %s attempted to exploit the zone!'):format(GetPlayerIdentifiers(_source)[1])) end end) @@ -328,7 +328,7 @@ AddEventHandler('esx_drugs:startSellMeth', function() TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog')) SellMeth(_source) else - print(('esx_drugs: %s attempted to exploit the marker!'):format(GetPlayerIdentifiers(_source)[1])) + print(('esx_drugs: %s attempted to exploit the zone!'):format(GetPlayerIdentifiers(_source)[1])) end end) @@ -372,7 +372,7 @@ AddEventHandler('esx_drugs:startHarvestWeed', function() TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog')) HarvestWeed(_source) else - print(('esx_drugs: %s attempted to exploit the marker!'):format(GetPlayerIdentifiers(_source)[1])) + print(('esx_drugs: %s attempted to exploit the zone!'):format(GetPlayerIdentifiers(_source)[1])) end end) @@ -419,7 +419,7 @@ AddEventHandler('esx_drugs:startTransformWeed', function() TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog')) TransformWeed(_source) else - print(('esx_drugs: %s attempted to exploit the marker!'):format(GetPlayerIdentifiers(_source)[1])) + print(('esx_drugs: %s attempted to exploit the zone!'):format(GetPlayerIdentifiers(_source)[1])) end end) @@ -479,7 +479,7 @@ AddEventHandler('esx_drugs:startSellWeed', function() TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog')) SellWeed(_source) else - print(('esx_drugs: %s attempted to exploit the marker!'):format(GetPlayerIdentifiers(_source)[1])) + print(('esx_drugs: %s attempted to exploit the zone!'):format(GetPlayerIdentifiers(_source)[1])) end end) @@ -523,7 +523,7 @@ AddEventHandler('esx_drugs:startHarvestOpium', function() TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog')) HarvestOpium(_source) else - print(('esx_drugs: %s attempted to exploit the marker!'):format(GetPlayerIdentifiers(_source)[1])) + print(('esx_drugs: %s attempted to exploit the zone!'):format(GetPlayerIdentifiers(_source)[1])) end end) @@ -570,7 +570,7 @@ AddEventHandler('esx_drugs:startTransformOpium', function() TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog')) TransformOpium(_source) else - print(('esx_drugs: %s attempted to exploit the marker!'):format(GetPlayerIdentifiers(_source)[1])) + print(('esx_drugs: %s attempted to exploit the zone!'):format(GetPlayerIdentifiers(_source)[1])) end end) @@ -633,7 +633,7 @@ AddEventHandler('esx_drugs:startSellOpium', function() TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog')) SellOpium(_source) else - print(('esx_drugs: %s attempted to exploit the marker!'):format(GetPlayerIdentifiers(_source)[1])) + print(('esx_drugs: %s attempted to exploit the zone!'):format(GetPlayerIdentifiers(_source)[1])) end end) From c792d8960bff04b5a3f81ddc24dc365e044b7785 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Fri, 30 Nov 2018 22:40:53 +0100 Subject: [PATCH 41/66] Remove all old files --- .editorconfig | 9 - LICENSE | 674 ---------------------------------- README.md | 40 -- __resource.lua | 31 -- client/main.lua | 289 --------------- config.lua | 32 -- esx_drugs.sql | 10 - locales/br.lua | 47 --- locales/de.lua | 47 --- locales/en.lua | 47 --- locales/es.lua | 47 --- locales/fr.lua | 47 --- locales/pl.lua | 47 --- locales/sv.lua | 47 --- localization/de_esx_drugs.sql | 10 - localization/en_esx_drugs.sql | 10 - localization/pl_esx_drugs.sql | 10 - localization/sv_esx_drugs.sql | 10 - server/main.lua | 674 ---------------------------------- 19 files changed, 2128 deletions(-) delete mode 100644 .editorconfig delete mode 100644 LICENSE delete mode 100644 README.md delete mode 100644 __resource.lua delete mode 100644 client/main.lua delete mode 100644 config.lua delete mode 100644 esx_drugs.sql delete mode 100644 locales/br.lua delete mode 100644 locales/de.lua delete mode 100644 locales/en.lua delete mode 100644 locales/es.lua delete mode 100644 locales/fr.lua delete mode 100644 locales/pl.lua delete mode 100644 locales/sv.lua delete mode 100644 localization/de_esx_drugs.sql delete mode 100644 localization/en_esx_drugs.sql delete mode 100644 localization/pl_esx_drugs.sql delete mode 100644 localization/sv_esx_drugs.sql delete mode 100644 server/main.lua diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 9b425256..00000000 --- a/.editorconfig +++ /dev/null @@ -1,9 +0,0 @@ -root = true - -[*] -indent_size = 4 -indent_style = tab -end_of_line = crlf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true \ No newline at end of file diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 0f4f5d61..00000000 --- a/LICENSE +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - fxserver-async - Copyright (C) 2015 Jérémie N'gadi - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - fxserver-async Copyright (C) 2015 Jérémie N'gadi - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index 6061a3f0..00000000 --- a/README.md +++ /dev/null @@ -1,40 +0,0 @@ -# esx_drugs -## Requirements - - [esx_policejob](https://github.com/ESX-Org/esx_policejob) - -## Download & Installation - -### Using [fvm](https://github.com/qlaffont/fvm-installer) -``` -fvm install --save --folder=esx esx-org/esx_drugs -``` - -### Using Git -``` -cd resources -git clone https://github.com/ESX-Org/esx_drugs [esx]/esx_drugs -``` - -### Manually -- Download https://github.com/ESX-Org/esx_drugs/archive/master.zip -- Put it in the `[esx]` directory - -## Installation -- Import `esx_drugs.sql` in your database -- Add this in your `server.cfg`: - -``` -start esx_drugs -``` - -# Legal -### License -esx_drugs - drugs job - -Copyright (C) 2015-2018 Jérémie N'gadi - -This program Is free software: you can redistribute it And/Or modify it under the terms Of the GNU General Public License As published by the Free Software Foundation, either version 3 Of the License, Or (at your option) any later version. - -This program Is distributed In the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty Of MERCHANTABILITY Or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License For more details. - -You should have received a copy Of the GNU General Public License along with this program. If Not, see http://www.gnu.org/licenses/. diff --git a/__resource.lua b/__resource.lua deleted file mode 100644 index 515cfa30..00000000 --- a/__resource.lua +++ /dev/null @@ -1,31 +0,0 @@ -resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937' - -description 'ESX Drugs' - -version '1.0.2' - -server_scripts { - '@es_extended/locale.lua', - 'locales/de.lua', - 'locales/br.lua', - 'locales/en.lua', - 'locales/fr.lua', - 'locales/es.lua', - 'locales/sv.lua', - 'locales/pl.lua', - 'server/main.lua', - 'config.lua' -} - -client_scripts { - '@es_extended/locale.lua', - 'locales/de.lua', - 'locales/br.lua', - 'locales/en.lua', - 'locales/fr.lua', - 'locales/es.lua', - 'locales/sv.lua', - 'locales/pl.lua', - 'config.lua', - 'client/main.lua' -} diff --git a/client/main.lua b/client/main.lua deleted file mode 100644 index 62776688..00000000 --- a/client/main.lua +++ /dev/null @@ -1,289 +0,0 @@ -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 cokeQTE = 0 -ESX = nil -local coke_poochQTE = 0 -local weedQTE = 0 -local weed_poochQTE = 0 -local methQTE = 0 -local meth_poochQTE = 0 -local opiumQTE = 0 -local opium_poochQTE = 0 -local myJob = nil -local HasAlreadyEnteredMarker = false -local LastZone = nil -local CurrentAction = nil -local CurrentActionMsg = '' -local CurrentActionData = {} - -Citizen.CreateThread(function() - while ESX == nil do - TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) - Citizen.Wait(0) - end -end) - -AddEventHandler('esx_drugs:hasEnteredMarker', function(zone) - if myJob == 'police' or myJob == 'ambulance' then - return - end - - ESX.UI.Menu.CloseAll() - - if zone == 'CokeField' then - CurrentAction = zone - CurrentActionMsg = _U('press_collect_coke') - CurrentActionData = {} - elseif zone == 'CokeProcessing' then - if cokeQTE >= 5 then - CurrentAction = zone - CurrentActionMsg = _U('press_process_coke') - CurrentActionData = {} - end - elseif zone == 'CokeDealer' then - if coke_poochQTE >= 1 then - CurrentAction = zone - CurrentActionMsg = _U('press_sell_coke') - CurrentActionData = {} - end - elseif zone == 'MethField' then - CurrentAction = zone - CurrentActionMsg = _U('press_collect_meth') - CurrentActionData = {} - elseif zone == 'MethProcessing' then - if methQTE >= 5 then - CurrentAction = zone - CurrentActionMsg = _U('press_process_meth') - CurrentActionData = {} - end - elseif zone == 'MethDealer' then - if meth_poochQTE >= 1 then - CurrentAction = zone - CurrentActionMsg = _U('press_sell_meth') - CurrentActionData = {} - end - elseif zone == 'WeedField' then - CurrentAction = zone - CurrentActionMsg = _U('press_collect_weed') - CurrentActionData = {} - elseif zone == 'WeedProcessing' then - if weedQTE >= 5 then - CurrentAction = zone - CurrentActionMsg = _U('press_process_weed') - CurrentActionData = {} - end - elseif zone == 'WeedDealer' then - if weed_poochQTE >= 1 then - CurrentAction = zone - CurrentActionMsg = _U('press_sell_weed') - CurrentActionData = {} - end - elseif zone == 'OpiumField' then - CurrentAction = zone - CurrentActionMsg = _U('press_collect_opium') - CurrentActionData = {} - elseif zone == 'OpiumProcessing' then - if opiumQTE >= 5 then - CurrentAction = zone - CurrentActionMsg = _U('press_process_opium') - CurrentActionData = {} - end - elseif zone == 'OpiumDealer' then - if opium_poochQTE >= 1 then - CurrentAction = zone - CurrentActionMsg = _U('press_sell_opium') - CurrentActionData = {} - end - end -end) - -AddEventHandler('esx_drugs:hasExitedMarker', function(zone) - CurrentAction = nil - ESX.UI.Menu.CloseAll() - - if zone == 'CokeField' then - TriggerServerEvent('esx_drugs:stopHarvestCoke') - elseif zone == 'CokeProcessing' then - TriggerServerEvent('esx_drugs:stopTransformCoke') - elseif zone == 'CokeDealer' then - TriggerServerEvent('esx_drugs:stopSellCoke') - elseif zone == 'MethField' then - TriggerServerEvent('esx_drugs:stopHarvestMeth') - elseif zone == 'MethProcessing' then - TriggerServerEvent('esx_drugs:stopTransformMeth') - elseif zone == 'MethDealer' then - TriggerServerEvent('esx_drugs:stopSellMeth') - elseif zone == 'WeedField' then - TriggerServerEvent('esx_drugs:stopHarvestWeed') - elseif zone == 'WeedProcessing' then - TriggerServerEvent('esx_drugs:stopTransformWeed') - elseif zone == 'WeedDealer' then - TriggerServerEvent('esx_drugs:stopSellWeed') - elseif zone == 'OpiumField' then - TriggerServerEvent('esx_drugs:stopHarvestOpium') - elseif zone == 'OpiumProcessing' then - TriggerServerEvent('esx_drugs:stopTransformOpium') - elseif zone == 'OpiumDealer' then - TriggerServerEvent('esx_drugs:stopSellOpium') - end -end) - --- Weed Effect -RegisterNetEvent('esx_drugs:onPot') -AddEventHandler('esx_drugs:onPot', function() - RequestAnimSet("MOVE_M@DRUNK@SLIGHTLYDRUNK") - while not HasAnimSetLoaded("MOVE_M@DRUNK@SLIGHTLYDRUNK") do - Citizen.Wait(0) - end - TaskStartScenarioInPlace(GetPlayerPed(-1), "WORLD_HUMAN_SMOKING_POT", 0, true) - Citizen.Wait(5000) - DoScreenFadeOut(1000) - Citizen.Wait(1000) - ClearPedTasksImmediately(GetPlayerPed(-1)) - SetTimecycleModifier("spectator5") - SetPedMotionBlur(GetPlayerPed(-1), true) - SetPedMovementClipset(GetPlayerPed(-1), "MOVE_M@DRUNK@SLIGHTLYDRUNK", true) - SetPedIsDrunk(GetPlayerPed(-1), true) - DoScreenFadeIn(1000) - Citizen.Wait(600000) - DoScreenFadeOut(1000) - Citizen.Wait(1000) - DoScreenFadeIn(1000) - ClearTimecycleModifier() - ResetScenarioTypesEnabled() - ResetPedMovementClipset(GetPlayerPed(-1), 0) - SetPedIsDrunk(GetPlayerPed(-1), false) - SetPedMotionBlur(GetPlayerPed(-1), false) -end) - --- Render markers -Citizen.CreateThread(function() - while true do - - Citizen.Wait(0) - - local coords = GetEntityCoords(GetPlayerPed(-1)) - - for k,v in pairs(Config.Zones) do - if GetDistanceBetweenCoords(coords, v.x, v.y, v.z, true) < Config.DrawDistance then - DrawMarker(Config.MarkerType, v.x, v.y, v.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, Config.ZoneSize.x, Config.ZoneSize.y, Config.ZoneSize.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false) - end - end - - end -end) - -if Config.ShowBlips then - -- Create blips - Citizen.CreateThread(function() - for k,v in pairs(Config.Zones) do - local blip = AddBlipForCoord(v.x, v.y, v.z) - - SetBlipSprite (blip, v.sprite) - SetBlipDisplay(blip, 4) - SetBlipScale (blip, 0.9) - SetBlipColour (blip, v.color) - SetBlipAsShortRange(blip, true) - - BeginTextCommandSetBlipName("STRING") - AddTextComponentString(v.name) - EndTextCommandSetBlipName(blip) - end - end) -end - - --- RETURN NUMBER OF ITEMS FROM SERVER -RegisterNetEvent('esx_drugs:ReturnInventory') -AddEventHandler('esx_drugs:ReturnInventory', function(cokeNbr, cokepNbr, methNbr, methpNbr, weedNbr, weedpNbr, opiumNbr, opiumpNbr, jobName, currentZone) - cokeQTE = cokeNbr - coke_poochQTE = cokepNbr - methQTE = methNbr - meth_poochQTE = methpNbr - weedQTE = weedNbr - weed_poochQTE = weedpNbr - opiumQTE = opiumNbr - opium_poochQTE = opiumpNbr - myJob = jobName - TriggerEvent('esx_drugs:hasEnteredMarker', currentZone) -end) - --- Activate menu when player is inside marker -Citizen.CreateThread(function() - while true do - - Citizen.Wait(0) - - local coords = GetEntityCoords(GetPlayerPed(-1)) - local isInMarker = false - local currentZone = nil - - for k,v in pairs(Config.Zones) do - if(GetDistanceBetweenCoords(coords, v.x, v.y, v.z, true) < Config.ZoneSize.x / 2) then - isInMarker = true - currentZone = k - end - end - - if isInMarker and not hasAlreadyEnteredMarker then - hasAlreadyEnteredMarker = true - lastZone = currentZone - TriggerServerEvent('esx_drugs:GetUserInventory', currentZone) - end - - if not isInMarker and hasAlreadyEnteredMarker then - hasAlreadyEnteredMarker = false - TriggerEvent('esx_drugs:hasExitedMarker', lastZone) - end - end -end) - --- Key Controls -Citizen.CreateThread(function() - while true do - Citizen.Wait(10) - if CurrentAction ~= nil then - ESX.ShowHelpNotification(CurrentActionMsg) - - if IsControlJustReleased(0, Keys['E']) and IsPedOnFoot(PlayerPedId()) then - if CurrentAction == 'CokeField' then - TriggerServerEvent('esx_drugs:startHarvestCoke') - elseif CurrentAction == 'CokeProcessing' then - TriggerServerEvent('esx_drugs:startTransformCoke') - elseif CurrentAction == 'CokeDealer' then - TriggerServerEvent('esx_drugs:startSellCoke') - elseif CurrentAction == 'MethField' then - TriggerServerEvent('esx_drugs:startHarvestMeth') - elseif CurrentAction == 'MethProcessing' then - TriggerServerEvent('esx_drugs:startTransformMeth') - elseif CurrentAction == 'MethDealer' then - TriggerServerEvent('esx_drugs:startSellMeth') - elseif CurrentAction == 'WeedField' then - TriggerServerEvent('esx_drugs:startHarvestWeed') - elseif CurrentAction == 'WeedProcessing' then - TriggerServerEvent('esx_drugs:startTransformWeed') - elseif CurrentAction == 'WeedDealer' then - TriggerServerEvent('esx_drugs:startSellWeed') - elseif CurrentAction == 'OpiumField' then - TriggerServerEvent('esx_drugs:startHarvestOpium') - elseif CurrentAction == 'OpiumProcessing' then - TriggerServerEvent('esx_drugs:startTransformOpium') - elseif CurrentAction == 'OpiumDealer' then - TriggerServerEvent('esx_drugs:startSellOpium') - end - - CurrentAction = nil - end - end - end -end) diff --git a/config.lua b/config.lua deleted file mode 100644 index 3406fd1c..00000000 --- a/config.lua +++ /dev/null @@ -1,32 +0,0 @@ -Config = {} -Config.MarkerType = 1 -Config.DrawDistance = 100.0 -Config.ZoneSize = {x = 5.0, y = 5.0, z = 3.0} -Config.MarkerColor = {r = 100, g = 204, b = 100} -Config.ShowBlips = true --markers visible on the map? (false to hide the markers on the map) - -Config.RequiredCopsCoke = 2 -Config.RequiredCopsMeth = 2 -Config.RequiredCopsWeed = 2 -Config.RequiredCopsOpium = 2 - -Config.TimeToFarm = 17 * 1000 -Config.TimeToProcess = 46 * 1000 -Config.TimeToSell = 5 * 1000 - -Config.Locale = 'fr' - -Config.Zones = { - CokeField = {x = 2448.92, y = -1836.80, z = 51.95, name = _U('coke_field'), sprite = 501, color = 40}, - CokeProcessing = {x = -458.13, y = -2278.61, z = 7.51, name = _U('coke_processing'), sprite = 478, color = 40}, - CokeDealer = {x = -1756.19, y = 427.31, z =126.68, name = _U('coke_dealer'), sprite = 500, color = 75}, - MethField = {x = 1525.29, y = 1710.02, z = 109.00, name = _U('meth_field'), sprite = 499, color = 26}, - MethProcessing = {x = -1001.41, y = 4848.00, z = 274.00, name = _U('meth_processing'), sprite = 499, color = 26}, - MethDealer = {x = -63.59, y = -1224.07, z = 27.76, name = _U('meth_dealer'), sprite = 500, color = 75}, - WeedField = {x = 1609.12, y = 6663.59, z = 20.96, name = _U('weed_field'), sprite = 496, color = 52}, - WeedProcessing = {x = 91.06, y = 3750.03, z = 39.77, name = _U('weed_processing'), sprite = 496, color = 52}, - WeedDealer = {x = -54.24, y = -1443.36, z = 31.06, name = _U('weed_dealer'), sprite = 500, color = 75}, - OpiumField = {x = 1972.78, y = 3819.39, z = 32.50, name = _U('opium_field'), sprite = 51, color = 60}, - OpiumProcessing = {x = 971.86, y = -2157.00, z = 28.47, name = _U('opium_processing'), sprite = 51, color = 60}, - OpiumDealer = {x = 2331.08, y = 2570.22, z = 45.30, name = _U('opium_dealer'), sprite = 500, color = 75} -} diff --git a/esx_drugs.sql b/esx_drugs.sql deleted file mode 100644 index 2c29fb45..00000000 --- a/esx_drugs.sql +++ /dev/null @@ -1,10 +0,0 @@ -INSERT INTO `items` (name, label, `limit`) VALUES - ('weed', 'Weed', 50), - ('weed_pooch', 'Pochon de weed', 10), - ('coke', 'Coke', 50), - ('coke_pooch', 'Pochon de coke', 10), - ('meth', 'Meth', 50), - ('meth_pooch', 'Pochon de meth', 10), - ('opium', 'Opium', 50), - ('opium_pooch', 'Pochon de opium', 10) -; \ No newline at end of file diff --git a/locales/br.lua b/locales/br.lua deleted file mode 100644 index a7cd6f2a..00000000 --- a/locales/br.lua +++ /dev/null @@ -1,47 +0,0 @@ -Locales['br'] = { - ['press_collect_coke'] = 'Pressione ~INPUT_CONTEXT~ para coletar coca', - ['press_process_coke'] = 'Pressione ~INPUT_CONTEXT~ para processar a coca', - ['press_sell_coke'] = 'Pressione ~INPUT_CONTEXT~ para vender coca', - ['press_collect_meth'] = 'Pressione ~INPUT_CONTEXT~ para coletar metanfetamina', - ['press_process_meth'] = 'Pressione ~INPUT_CONTEXT~ para processar metanfetamina', - ['press_sell_meth'] = 'Pressione ~INPUT_CONTEXT~ para vender metanfetamina', - ['press_collect_weed'] = 'Pressione ~INPUT_CONTEXT~ para coletar erva', - ['press_process_weed'] = 'Pressione ~INPUT_CONTEXT~ para processar erva', - ['press_sell_opium'] = 'Pressione ~INPUT_CONTEXT~ para vender ópio', - ['press_collect_opium'] = 'Pressione ~INPUT_CONTEXT~ para coletar ópio', - ['press_process_opium'] = 'Pressione ~INPUT_CONTEXT~ para processar ópio', - ['press_sell_weed'] = 'Pressione ~INPUT_CONTEXT~ para vender erva', - ['act_imp_police'] = 'Ação ~r~impossivel~s~, ~b~polícia~s~: ~o~%s~s~/~y~%s~s~ online', - ['inv_full_coke'] = 'Você não pode mais coletar a Cocaína, seu estoque está ~r~cheio~s~', - ['pickup_in_prog'] = '~y~Colheita em progresso~s~...', - ['too_many_pouches'] = 'Você tem muitas trouxinhas', - ['not_enough_coke'] = 'Você não tem folha de coca suficiente para ~r~empacotar~s~', - ['packing_in_prog'] = '~y~Empacotamento em progresso~s~...', - ['no_pouches_sale'] = 'Você não tem mais trouxinhas para ~r~vender~s~', - ['sold_one_coke'] = 'Você vendeu ~g~x1 Trouxinha de Cocaína~s~', - ['sale_in_prog'] = '~g~Venda em progresso~s~...', - ['inv_full_meth'] = 'Você não pode mais coletar metanfetamina, seu inventário está ~r~cheio~s~', - ['not_enough_meth'] = 'Você não tem metanfetamina suficiente para ~r~embalar~s~', - ['sold_one_meth'] = 'Você vendeu ~g~x1 Trouxinha de Metanfetamina~s~', - ['inv_full_weed'] = 'Você não pode mais coletar erva, seu inventário está ~r~cheio~s~', - ['not_enough_weed'] = 'Você não tem erva suficiente para ~r~embalar~s~', - ['sold_one_weed'] = 'Você vendeu ~g~x1 Trouxinha de erva~s~', - ['used_one_weed'] = 'Você usou 1 trouxinha de ~b~erva', - ['inv_full_opium'] = 'Você não pode mais coletar ópio, seu inventário está ~r~cheio~s~', - ['not_enough_opium'] = 'Você não tem ópio suficiente para ~r~embalar~s~', - ['sold_one_opium'] = 'Você vendeu ~g~x1 Trouxinha de ópio~s~', - ['used_one_opium'] = 'Você usou 1 trouxinha de ~b~ópio', - -- Blips - ['coke_field'] = 'cocaine Field', - ['coke_processing'] = 'cocaine Processing', - ['coke_dealer'] = 'cocaine Dealer', - ['meth_field'] = 'meth Field', - ['meth_processing'] = 'meth Processing', - ['meth_dealer'] = 'meth Dealer', - ['weed_field'] = 'weed Field', - ['weed_processing'] = 'weed Processing', - ['weed_dealer'] = 'weed Dealer', - ['opium_field'] = 'opium Field', - ['opium_processing'] = 'opium Processing', - ['opium_dealer'] = 'opium Dealer', -} \ No newline at end of file diff --git a/locales/de.lua b/locales/de.lua deleted file mode 100644 index ffc54e19..00000000 --- a/locales/de.lua +++ /dev/null @@ -1,47 +0,0 @@ -Locales['de'] = { - ['press_collect_coke'] = 'drücke ~INPUT_CONTEXT~ um Koks zu sammeln', - ['press_process_coke'] = 'drücke ~INPUT_CONTEXT~ um Koks zu verarbeiten', - ['press_sell_coke'] = 'drücke ~INPUT_CONTEXT~ um Koks zu verkaufen', - ['press_collect_meth'] = 'drücke ~INPUT_CONTEXT~ um Meth zu sammeln', - ['press_process_meth'] = 'drücke ~INPUT_CONTEXT~ um Meth zu verarbeiten', - ['press_sell_meth'] = 'drücke ~INPUT_CONTEXT~ um Meth zu verkaufen', - ['press_collect_weed'] = 'drücke ~INPUT_CONTEXT~ um Grass zu sammeln', - ['press_process_weed'] = 'drücke ~INPUT_CONTEXT~ um Grass zu verarbeiten', - ['press_sell_weed'] = 'drücke ~INPUT_CONTEXT~ um Grass zu verkaufen', - ['press_collect_opium'] = 'drücke ~INPUT_CONTEXT~ um Opium zu sammeln', - ['press_process_opium'] = 'drücke ~INPUT_CONTEXT~ um Opium zu verarbeiten', - ['press_sell_opium'] = 'drücke ~INPUT_CONTEXT~ um Opium zu verkaufen', - ['act_imp_police'] = 'aktion ~r~nihct möglich~s~, ~b~Polizisten~s~: ~o~%s~s~/~y~%s~s~ online', - ['inv_full_coke'] = 'Du kannst nicht länger Koks sammeln, dein Inventar ist ~r~VOLL~s~', - ['pickup_in_prog'] = '~y~Sammeln im gange~s~...', - ['too_many_pouches'] = 'du hast zuviele Pakete', - ['not_enough_coke'] = 'du hast nicht genug Koks zum ~r~verpacken~s~', - ['packing_in_prog'] = '~y~Verarbeitung im gange~s~...', - ['no_pouches_sale'] = 'Du hast nicht genug Portionen zum ~r~verkaufen~s~', - ['sold_one_coke'] = 'du verkaufst ~g~x1 Portion Koks~s~', - ['sale_in_prog'] = '~g~Verkauf im gange~s~...', - ['inv_full_meth'] = 'Du kannst nicht länger Meth sammeln, dein Inventar ist ~r~VOLL~s~', - ['not_enough_meth'] = 'du hast nicht genug Meth zum ~r~verpacken~s~', - ['sold_one_meth'] = 'du verkaufst ~g~x1 Portion Meth~s~', - ['inv_full_weed'] = 'Du kannst nicht länger Grass sammeln, dein Inventar ist ~r~VOLL~s~', - ['not_enough_weed'] = 'du hast nicht genug Grass zum ~r~verarbeiten~s~', - ['sold_one_weed'] = 'du verkaufst ~g~x1 Portion Grass~s~', - ['used_one_weed'] = 'du benutzt 1x ~b~Grass', - ['inv_full_opium'] = 'Du kannst nicht länger Opium sammeln, dein Inventar ist ~r~VOLL~s~', - ['not_enough_opium'] = 'du hast nicht genug Opium zum ~r~verarbeiten~s~', - ['sold_one_opium'] = 'du verkaufst ~g~x1 Portion Opium~s~', - ['used_one_opium'] = 'du benutzt 1x ~b~Opium', - -- Blips - ['coke_field'] = 'cocaine Field', - ['coke_processing'] = 'cocaine Processing', - ['coke_dealer'] = 'cocaine Dealer', - ['meth_field'] = 'meth Field', - ['meth_processing'] = 'meth Processing', - ['meth_dealer'] = 'meth Dealer', - ['weed_field'] = 'weed Field', - ['weed_processing'] = 'weed Processing', - ['weed_dealer'] = 'weed Dealer', - ['opium_field'] = 'opium Field', - ['opium_processing'] = 'opium Processing', - ['opium_dealer'] = 'opium Dealer', -} \ No newline at end of file diff --git a/locales/en.lua b/locales/en.lua deleted file mode 100644 index 4bccf402..00000000 --- a/locales/en.lua +++ /dev/null @@ -1,47 +0,0 @@ -Locales['en'] = { - ['press_collect_coke'] = 'press ~INPUT_CONTEXT~ to collect cocaine', - ['press_process_coke'] = 'press ~INPUT_CONTEXT~ to process cocaine', - ['press_sell_coke'] = 'press ~INPUT_CONTEXT~ to sell cocaine', - ['press_collect_meth'] = 'press ~INPUT_CONTEXT~ to collect meth', - ['press_process_meth'] = 'press ~INPUT_CONTEXT~ to process meth', - ['press_sell_meth'] = 'press ~INPUT_CONTEXT~ to sell meth', - ['press_collect_weed'] = 'press ~INPUT_CONTEXT~ to collect weed', - ['press_process_weed'] = 'press ~INPUT_CONTEXT~ to process weed', - ['press_sell_weed'] = 'press ~INPUT_CONTEXT~ to sell weed', - ['press_collect_opium'] = 'press ~INPUT_CONTEXT~ to collect opium', - ['press_process_opium'] = 'press ~INPUT_CONTEXT~ to process opium', - ['press_sell_opium'] = 'press ~INPUT_CONTEXT~ to sell opium', - ['act_imp_police'] = 'you cannot participate illegal activities unless there\'s enough cops online: ~o~%s~s~/~y~%s~s~ online', - ['inv_full_coke'] = 'you can no longer collect Cocaine, your inventory is ~r~full~s~', - ['pickup_in_prog'] = '~y~Pickup in progress~s~...', - ['too_many_pouches'] = 'you have too many pouches', - ['not_enough_coke'] = 'you do not have enough coke to ~r~pack~s~', - ['packing_in_prog'] = '~y~Packaging in progress~s~...', - ['no_pouches_sale'] = 'You have no more pouches for ~r~sale~s~', - ['sold_one_coke'] = 'you\'ve sold ~y~x1~s~ ~y~Cocaine Pouch~s~', - ['sale_in_prog'] = '~g~Sale in progress~s~...', - ['inv_full_meth'] = 'you can no longer collect Meth, your inventory is ~r~full~s~', - ['not_enough_meth'] = 'you do not have enough Meth to ~r~pack~s~', - ['sold_one_meth'] = 'you\'ve sold ~g~x1 Meth Pouch~s~', - ['inv_full_weed'] = 'you can no longer collect Weed, your inventory is ~r~full~s~', - ['not_enough_weed'] = 'you do not have enough Weed to ~r~pack~s~', - ['sold_one_weed'] = 'you\'ve sold ~g~x1 Weed Pouch~s~', - ['used_one_weed'] = 'you used 1 pouch of ~b~weed', - ['inv_full_opium'] = 'you can no longer collect opium, your inventory is ~r~full~s~', - ['not_enough_opium'] = 'you do not have enough opium to ~r~pack~s~', - ['sold_one_opium'] = 'you\'ve sold ~g~x1 opium Pouch~s~', - ['used_one_opium'] = 'you used 1 pouch of ~b~opium', - -- Blips - ['coke_field'] = 'cocaine Field', - ['coke_processing'] = 'cocaine Processing', - ['coke_dealer'] = 'cocaine Dealer', - ['meth_field'] = 'meth Field', - ['meth_processing'] = 'meth Processing', - ['meth_dealer'] = 'meth Dealer', - ['weed_field'] = 'weed Field', - ['weed_processing'] = 'weed Processing', - ['weed_dealer'] = 'weed Dealer', - ['opium_field'] = 'opium Field', - ['opium_processing'] = 'opium Processing', - ['opium_dealer'] = 'opium Dealer', -} \ No newline at end of file diff --git a/locales/es.lua b/locales/es.lua deleted file mode 100644 index f123db65..00000000 --- a/locales/es.lua +++ /dev/null @@ -1,47 +0,0 @@ -Locales['es'] = { - ['press_collect_coke'] = 'Presiona ~INPUT_CONTEXT~ para cosechar la Coca', - ['press_process_coke'] = 'Presiona ~INPUT_CONTEXT~ para tratar la Coca', - ['press_sell_coke'] = 'Presiona ~INPUT_CONTEXT~ para vender la Coca', - ['press_collect_meth'] = 'Presiona ~INPUT_CONTEXT~ para recoger ingredientes del LSD', - ['press_process_meth'] = 'Presiona ~INPUT_CONTEXT~ para cocinar el LSD', - ['press_sell_meth'] = 'Presiona ~INPUT_CONTEXT~ para vender el LSD', - ['press_collect_weed'] = 'Presiona ~INPUT_CONTEXT~ para cosechar el Hierbón', - ['press_process_weed'] = 'Presiona ~INPUT_CONTEXT~ para embolsar el Hierbón', - ['press_sell_weed'] = 'Presiona ~INPUT_CONTEXT~ para vender el Hierbón', - ['press_collect_opium'] = "Presiona ~INPUT_CONTEXT~ para cosechar el Opio", - ['press_process_opium'] = "Presiona ~INPUT_CONTEXT~ para tratar el Opio", - ['press_sell_opium'] = "Presiona ~INPUT_CONTEXT~ para vender el Opio", - ['act_imp_police'] = 'Acción ~r~imposible~s~, ~b~policias~s~: ~o~%s~s~/~y~%s~s~ online', - ['inv_full_coke'] = 'No puedes recoger mas cocaina, tu inventario está ~r~lleno~s~', - ['pickup_in_prog'] = '~y~Recogida en curso~s~...', - ['too_many_pouches'] = 'Tienes demasiadas bolsas', - ['not_enough_coke'] = 'No tienes suficiente hoja de coca para ~r~fabricar~s~', - ['packing_in_prog'] = '~y~Fabricación en curso~s~...', - ['no_pouches_sale'] = 'No tienes mas bolsas para ~r~vender~s~', - ['sold_one_coke'] = 'Has vendido ~g~1 Gramo de Coca~s~', - ['sale_in_prog'] = '~g~Venta en curso~s~...', - ['inv_full_meth'] = 'No puedes recoger mas ingredientes, tu inventario está ~r~lleno~s~', - ['not_enough_meth'] = 'No tienes suficientes ingredientes para ~r~fabricar~s~ mas LSD', - ['sold_one_meth'] = 'Has vendido ~g~1 Bote de LSD~s~', - ['inv_full_weed'] = 'No puedes recoger mas hierba, tu inventario está ~r~lleno~s~', - ['not_enough_weed'] = 'No tienes suficiente hierba para ~r~embolsar~s~', - ['sold_one_weed'] = 'Has vendido ~g~1 Bolsa de Hierbón~s~', - ['used_one_weed'] = 'Has gastado una bolsa de ~b~hierbón', - ['inv_full_opium'] = 'No puedes recoger mas hierba, tu inventario está ~r~lleno~s~', - ['not_enough_opium'] = 'No tienes sufiente Opio para ~r~fabricar~s~', - ['sold_one_opium'] = 'Has vendido ~g~1 Bolsa de Opio~s~', - ['used_one_opium'] = 'Has gastado una bolsa de ~b~Opio', - -- Blips - ['coke_field'] = 'cocaine Field', - ['coke_processing'] = 'cocaine Processing', - ['coke_dealer'] = 'cocaine Dealer', - ['meth_field'] = 'meth Field', - ['meth_processing'] = 'meth Processing', - ['meth_dealer'] = 'meth Dealer', - ['weed_field'] = 'weed Field', - ['weed_processing'] = 'weed Processing', - ['weed_dealer'] = 'weed Dealer', - ['opium_field'] = 'opium Field', - ['opium_processing'] = 'opium Processing', - ['opium_dealer'] = 'opium Dealer', -} \ No newline at end of file diff --git a/locales/fr.lua b/locales/fr.lua deleted file mode 100644 index 68a197d4..00000000 --- a/locales/fr.lua +++ /dev/null @@ -1,47 +0,0 @@ -Locales['fr'] = { - ['press_collect_coke'] = 'appuyez sur ~INPUT_CONTEXT~ pour récolter la coke', - ['press_process_coke'] = 'appuyez sur ~INPUT_CONTEXT~ pour traiter la coke', - ['press_sell_coke'] = 'appuyez sur ~INPUT_CONTEXT~ pour vendre la coke', - ['press_collect_meth'] = 'appuyez sur ~INPUT_CONTEXT~ pour récolter la meth', - ['press_process_meth'] = 'appuyez sur ~INPUT_CONTEXT~ pour traiter la meth', - ['press_sell_meth'] = 'appuyez sur ~INPUT_CONTEXT~ pour vendre la meth', - ['press_collect_weed'] = 'appuyez sur ~INPUT_CONTEXT~ pour récolter la weed', - ['press_process_weed'] = 'appuyez sur ~INPUT_CONTEXT~ pour traiter la weed', - ['press_sell_weed'] = 'appuyez sur ~INPUT_CONTEXT~ pour vendre la weed', - ['press_collect_opium'] = "appuyez sur ~INPUT_CONTEXT~ pour récolter l'opium", - ['press_process_opium'] = "appuyez sur ~INPUT_CONTEXT~ pour traiter l'opium", - ['press_sell_opium'] = "appuyez sur ~INPUT_CONTEXT~ pour vendre l'opium", - ['act_imp_police'] = 'action ~r~impossible~s~, ~b~policiers~s~: ~o~%s~s~/~y~%s~s~ online', - ['inv_full_coke'] = 'vous ne pouvez plus ramasser de Cocaine, votre inventaire est ~r~plein~s~', - ['pickup_in_prog'] = '~y~Ramassage en cours~s~...', - ['too_many_pouches'] = 'vous avez trop de pochons', - ['not_enough_coke'] = 'vous n\'avez pas assez de feuille de coca à ~r~conditionner~s~', - ['packing_in_prog'] = '~y~Conditonnement en cours~s~...', - ['no_pouches_sale'] = 'vous n\'avez plus de pochons à ~r~vendre~s~', - ['sold_one_coke'] = 'vous avez vendu ~g~x1 Pochon de coke~s~', - ['sale_in_prog'] = '~g~Vente en cours~s~...', - ['inv_full_meth'] = 'vous ne pouvez plus ramasser de Meth, votre inventaire est ~r~plein~s~', - ['not_enough_meth'] = 'vous n\'avez pas assez de Meth à ~r~conditionner~s~', - ['sold_one_meth'] = 'vous avez vendu ~g~x1 Pochon de meth~s~', - ['inv_full_weed'] = 'vous ne pouvez plus ramasser de weed, votre inventaire est ~r~plein~s~', - ['not_enough_weed'] = 'vous n\'avez pas assez de weed à ~r~conditionner~s~', - ['sold_one_weed'] = 'vous avez vendu ~g~x1 Pochon de weed~s~', - ['used_one_weed'] = 'Vous avez utilisé 1 Pochon de ~b~weed', - ['inv_full_opium'] = 'vous ne pouvez plus ramasser de weed, votre inventaire est ~r~plein~s~', - ['not_enough_opium'] = 'vous n\'avez pas assez de opium à ~r~conditionner~s~', - ['sold_one_opium'] = 'vous avez vendu ~g~x1 Pochon de opium~s~', - ['used_one_opium'] = 'Vous avez utilisé 1 Pochon de ~b~opium', - -- Blips - ['coke_field'] = 'cocaine Field', - ['coke_processing'] = 'cocaine Processing', - ['coke_dealer'] = 'cocaine Dealer', - ['meth_field'] = 'meth Field', - ['meth_processing'] = 'meth Processing', - ['meth_dealer'] = 'meth Dealer', - ['weed_field'] = 'weed Field', - ['weed_processing'] = 'weed Processing', - ['weed_dealer'] = 'weed Dealer', - ['opium_field'] = 'opium Field', - ['opium_processing'] = 'opium Processing', - ['opium_dealer'] = 'opium Dealer', -} \ No newline at end of file diff --git a/locales/pl.lua b/locales/pl.lua deleted file mode 100644 index 7c1375d1..00000000 --- a/locales/pl.lua +++ /dev/null @@ -1,47 +0,0 @@ -Locales['pl'] = { - ['press_collect_coke'] = 'naciśnij ~INPUT_CONTEXT~ aby zbierać liście kokainy', - ['press_process_coke'] = 'naciśnij ~INPUT_CONTEXT~ aby poddać liście kokainy obróbce chemicznej', - ['press_sell_coke'] = 'naciśnij ~INPUT_CONTEXT~ aby sprzedać kokaine', - ['press_collect_meth'] = 'naciśnij ~INPUT_CONTEXT~ aby gotować metamfetamine', - ['press_process_meth'] = 'naciśnij ~INPUT_CONTEXT~ aby kruszyć odlew', - ['press_sell_meth'] = 'naciśnij ~INPUT_CONTEXT~ aby sprzedać metamfetamine', - ['press_collect_weed'] = 'naciśnij ~INPUT_CONTEXT~ aby zbierać topy konopii', - ['press_process_weed'] = 'naciśnij ~INPUT_CONTEXT~ aby suszyć topy konopii', - ['press_sell_weed'] = 'naciśnij ~INPUT_CONTEXT~ aby sprzedać marihuane', - ['press_collect_opium'] = 'naciśnij ~INPUT_CONTEXT~ aby zebrać opium', - ['press_process_opium'] = 'naciśnij ~INPUT_CONTEXT~ aby przetworzyć opium', - ['press_sell_opium'] = 'naciśnij ~INPUT_CONTEXT~ aby sprzedać opium', - ['act_imp_police'] = 'nie mozesz wykonać tej akcji z powodu niewystarczającej liczby policjantów: ~o~%s~s~/~y~%s~s~', - ['inv_full_coke'] = 'posiadasz już ~r~wystarczającą~s~ ilość liści', - ['pickup_in_prog'] = '~y~Zbieranie~s~...', - ['too_many_pouches'] = 'posiadasz wystarczającą ilość towaru', - ['not_enough_coke'] = 'nie masz wystarczająco dużo liści aby ~r~poddać obróbce~s~', - ['packing_in_prog'] = '~y~Obrabianie w toku~s~...', - ['no_pouchs_sale'] = 'nie masz wystarczającej ilości towaru na ~r~sprzedaż~s~', - ['sold_one_coke'] = 'sprzedajesz ~y~x1~s~ ~y~ gram kokainy~s~', - ['sale_in_prog'] = '~g~Sprzedawanie~s~...', - ['inv_full_meth'] = 'posiadasz już ~r~wystarczająca~s~ dużo odlewu', - ['not_enough_meth'] = 'nie masz wystarczająco dużo metafetaminy aby ~r~pokruszyć~s~', - ['sold_one_meth'] = 'sprzedajesz ~g~x1 gram metamfetaminy~s~', - ['inv_full_weed'] = 'posiadasz już ~r~wystarczającą~s~ ilośc topów', - ['not_enough_weed'] = 'nie masz topów do ~r~ususzenia~s~', - ['sold_one_weed'] = 'sprzedajesz ~g~x1 gram marihuany~s~', - ['used_one_weed'] = 'spalasz jednego ~b~skręta', - ['inv_full_opium'] = 'nie możesz zbierać wiecej opium, gdyż twój ekwipunek jest ~r~pełny~s~', - ['not_enough_opium'] = 'nie masz wystarczająco opium aby je ~r~spakować~s~', - ['sold_one_opium'] = 'sprzedajesz ~g~x1 torebeczka opium~s~', - ['used_one_opium'] = 'wciągasz 1x torebeczka ~b~opium', - -- Blips - ['coke_field'] = 'plantacja kokainy', - ['coke_processing'] = 'przeróbka liści kokainy', - ['coke_dealer'] = 'handlarz: Kokainy', - ['meth_field'] = 'laboratorium metamfetaminy', - ['meth_processing'] = 'kruszenie metamfetaminy', - ['meth_dealer'] = 'handlarz: Metamfetamina', - ['weed_field'] = 'plantacja marihuany', - ['weed_processing'] = 'suszenie marihuany', - ['weed_dealer'] = 'handlarz: Marihuana', - ['opium_field'] = 'pole opium', - ['opium_processing'] = 'przeróbka opium', - ['opium_dealer'] = 'handlarz: Opium', -} \ No newline at end of file diff --git a/locales/sv.lua b/locales/sv.lua deleted file mode 100644 index 280c9e7a..00000000 --- a/locales/sv.lua +++ /dev/null @@ -1,47 +0,0 @@ -Locales['sv'] = { - ['press_collect_coke'] = 'klicka ~INPUT_CONTEXT~ för att plocka kokain', - ['press_process_coke'] = 'klicka ~INPUT_CONTEXT~ för att bearbeta kokain', - ['press_sell_coke'] = 'klicka ~INPUT_CONTEXT~ för att sälja coke', - ['press_collect_meth'] = 'klicka ~INPUT_CONTEXT~ för att plocka meth', - ['press_process_meth'] = 'klicka ~INPUT_CONTEXT~ för att bearbeta meth', - ['press_sell_meth'] = 'klicka ~INPUT_CONTEXT~ för att sälja meth', - ['press_collect_weed'] = 'klicka ~INPUT_CONTEXT~ för att plocka cannabis', - ['press_process_weed'] = 'klicka ~INPUT_CONTEXT~ för att bearbeta cannabis', - ['press_sell_weed'] = 'klicka ~INPUT_CONTEXT~ för att sälja cannabis', - ['press_collect_opium'] = 'klicka ~INPUT_CONTEXT~ för att plocka opium', - ['press_process_opium'] = 'klicka ~INPUT_CONTEXT~ för att bearbeta opium', - ['press_sell_opium'] = 'klicka ~INPUT_CONTEXT~ för att sälja opium', - ['act_imp_police'] = 'Du kan inte delta i olagliga aktiviteter om det inte finns tillräckligt med poliser (~o~%s~s~/~y~%s~s~ online)', - ['inv_full_coke'] = 'Du kan inte längre plocka kokain, du har inte plats ~r~fullt~s~', - ['pickup_in_prog'] = '~y~Plockning pågår~s~...', - ['too_many_pouches'] = 'Du har för många väskor', - ['not_enough_coke'] = 'Du har inte tillräckligt med kokain för att ~r~bearbeta~s~', - ['packing_in_prog'] = '~y~Förpackning pågår~s~...', - ['no_pouches_sale'] = 'Du har inga mer väskor att ~r~sälja~s~', - ['sold_one_coke'] = 'du har sålt ~y~1x~s~ ~b~väska med kokain~s~', - ['sale_in_prog'] = '~g~Försäljning pågår~s~...', - ['inv_full_meth'] = 'Du kan inte längre plocka meth, du har inte plats ~r~fullt~s~', - ['not_enough_meth'] = 'Du har inte tillräckligt med meth för att ~r~bearbeta~s~', - ['sold_one_meth'] = 'du har sålt ~y~1x~s~ ~b~väska med meth~s~', - ['inv_full_weed'] = 'Du kan inte längre plocka cannabis, du har inte plats ~r~fullt~s~', - ['not_enough_weed'] = 'Du har inte tillräckligt med annabis för att ~r~bearbeta~s~', - ['sold_one_weed'] = 'du har sålt ~y~1x~s~ ~b~väska med cannabis~s~', - ['used_one_weed'] = 'Du använde 1 väska ~b~cannabis', - ['inv_full_opium'] = 'Du kan inte längre plocka opium, du har inte plats ~r~fullt~s~', - ['not_enough_opium'] = 'Du har inte tillräckligt med opium för att ~r~bearbeta~s~', - ['sold_one_opium'] = 'du har sålt ~y~1x~s~ ~b~väska med opium~s~', - ['used_one_opium'] = 'Du använde 1 väska ~b~opium', - -- Blips - ['coke_field'] = 'coke field', - ['coke_processing'] = 'coke processing', - ['coke_dealer'] = 'coke dealer', - ['meth_field'] = 'meth field', - ['meth_processing'] = 'meth processing', - ['meth_dealer'] = 'meth dealer', - ['weed_field'] = 'weed field', - ['weed_processing'] = 'weed processing', - ['weed_dealer'] = 'weed dealer', - ['opium_field'] = 'opium field', - ['opium_processing'] = 'opium processing', - ['opium_dealer'] = 'opium dealer', -} diff --git a/localization/de_esx_drugs.sql b/localization/de_esx_drugs.sql deleted file mode 100644 index cb7a11f8..00000000 --- a/localization/de_esx_drugs.sql +++ /dev/null @@ -1,10 +0,0 @@ -INSERT INTO `items` (name, label, `limit`) VALUES - ('weed', 'Grass', 50), - ('weed_pooch', 'Portion Grass', 10), - ('coke', 'Koks', 50), - ('coke_pooch', 'Portion Koks', 10), - ('meth', 'Meth', 50), - ('meth_pooch', 'Portion Meth', 10), - ('opium', 'Opium', 50), - ('opium_pooch', 'Portion Opium', 10) -; \ No newline at end of file diff --git a/localization/en_esx_drugs.sql b/localization/en_esx_drugs.sql deleted file mode 100644 index a445c073..00000000 --- a/localization/en_esx_drugs.sql +++ /dev/null @@ -1,10 +0,0 @@ -INSERT INTO `items` (name, label, `limit`) VALUES - ('weed', 'Weed', 50), - ('weed_pooch', 'Bag of weed', 10), - ('coke', 'Cocaine', 50), - ('coke_pooch', 'Bag of cocaine', 10), - ('meth', 'Meth', 50), - ('meth_pooch', 'Bag of meth', 10), - ('opium', 'Opium', 50), - ('opium_pooch', 'Bag of opium', 10) -; diff --git a/localization/pl_esx_drugs.sql b/localization/pl_esx_drugs.sql deleted file mode 100644 index ab4f829b..00000000 --- a/localization/pl_esx_drugs.sql +++ /dev/null @@ -1,10 +0,0 @@ -INSERT INTO `items` (name, label, `limit`) VALUES - ('weed', 'Topy', 50), - ('weed_pooch', 'Marihuana', 10), - ('coke', 'Liście kokainy', 50), - ('coke_pooch', 'Kokaina', 10), - ('meth', 'Odlew', 50), - ('meth_pooch', 'Metafetamina', 10), - ('opium', 'Opium', 50), - ('opium_pooch', 'Torebeczka opium', 10) -; diff --git a/localization/sv_esx_drugs.sql b/localization/sv_esx_drugs.sql deleted file mode 100644 index 3c7dd2a6..00000000 --- a/localization/sv_esx_drugs.sql +++ /dev/null @@ -1,10 +0,0 @@ -INSERT INTO `items` (name, label, `limit`) VALUES - ('weed', 'Cannabis', 50), - ('weed_pooch', 'Väska med cannabis', 10), - ('coke', 'Kokain', 50), - ('coke_pooch', 'Väska med kokain', 10), - ('meth', 'Meth', 50), - ('meth_pooch', 'Väska med meth', 10), - ('opium', 'Opium', 50), - ('opium_pooch', 'Väska med opium', 10) -; diff --git a/server/main.lua b/server/main.lua deleted file mode 100644 index b4846eb1..00000000 --- a/server/main.lua +++ /dev/null @@ -1,674 +0,0 @@ -ESX = nil -local CopsConnected = 0 -local PlayersHarvestingCoke = {} -local PlayersTransformingCoke = {} -local PlayersSellingCoke = {} -local PlayersHarvestingMeth = {} -local PlayersTransformingMeth = {} -local PlayersSellingMeth = {} -local PlayersHarvestingWeed = {} -local PlayersTransformingWeed = {} -local PlayersSellingWeed = {} -local PlayersHarvestingOpium = {} -local PlayersTransformingOpium = {} -local PlayersSellingOpium = {} - -TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) - -function CountCops() - local xPlayers = ESX.GetPlayers() - - CopsConnected = 0 - - for i=1, #xPlayers, 1 do - local xPlayer = ESX.GetPlayerFromId(xPlayers[i]) - if xPlayer.job.name == 'police' then - CopsConnected = CopsConnected + 1 - end - end - - SetTimeout(120 * 1000, CountCops) -end - -CountCops() - ---coke -local function HarvestCoke(source) - if CopsConnected < Config.RequiredCopsCoke then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsCoke)) - return - end - - SetTimeout(Config.TimeToFarm, function() - if PlayersHarvestingCoke[source] then - local xPlayer = ESX.GetPlayerFromId(source) - local coke = xPlayer.getInventoryItem('coke') - - if coke.limit ~= -1 and coke.count >= coke.limit then - TriggerClientEvent('esx:showNotification', source, _U('inv_full_coke')) - else - xPlayer.addInventoryItem('coke', 1) - HarvestCoke(source) - end - end - end) -end - -RegisterServerEvent('esx_drugs:startHarvestCoke') -AddEventHandler('esx_drugs:startHarvestCoke', function() - local _source = source - - if not PlayersHarvestingCoke[_source] then - PlayersHarvestingCoke[_source] = true - - TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog')) - HarvestCoke(_source) - else - print(('esx_drugs: %s attempted to exploit the zone!'):format(GetPlayerIdentifiers(_source)[1])) - end -end) - -RegisterServerEvent('esx_drugs:stopHarvestCoke') -AddEventHandler('esx_drugs:stopHarvestCoke', function() - local _source = source - - PlayersHarvestingCoke[_source] = false -end) - -local function TransformCoke(source) - if CopsConnected < Config.RequiredCopsCoke then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsCoke)) - return - end - - SetTimeout(Config.TimeToProcess, function() - if PlayersTransformingCoke[source] then - local xPlayer = ESX.GetPlayerFromId(source) - local cokeQuantity = xPlayer.getInventoryItem('coke').count - local pooch = xPlayer.getInventoryItem('coke_pooch') - - if pooch.limit ~= -1 and pooch.count >= pooch.limit then - TriggerClientEvent('esx:showNotification', source, _U('too_many_pouches')) - elseif cokeQuantity < 5 then - TriggerClientEvent('esx:showNotification', source, _U('not_enough_coke')) - else - xPlayer.removeInventoryItem('coke', 5) - xPlayer.addInventoryItem('coke_pooch', 1) - - TransformCoke(source) - end - end - end) -end - -RegisterServerEvent('esx_drugs:startTransformCoke') -AddEventHandler('esx_drugs:startTransformCoke', function() - local _source = source - - if not PlayersTransformingCoke[_source] then - PlayersTransformingCoke[_source] = true - - TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog')) - TransformCoke(_source) - else - print(('esx_drugs: %s attempted to exploit the zone!'):format(GetPlayerIdentifiers(_source)[1])) - end -end) - -RegisterServerEvent('esx_drugs:stopTransformCoke') -AddEventHandler('esx_drugs:stopTransformCoke', function() - local _source = source - - PlayersTransformingCoke[_source] = false -end) - -local function SellCoke(source) - if CopsConnected < Config.RequiredCopsCoke then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsCoke)) - return - end - - SetTimeout(Config.TimeToSell, function() - if PlayersSellingCoke[source] then - local xPlayer = ESX.GetPlayerFromId(source) - local poochQuantity = xPlayer.getInventoryItem('coke_pooch').count - - if poochQuantity == 0 then - TriggerClientEvent('esx:showNotification', source, _U('no_pouches_sale')) - else - xPlayer.removeInventoryItem('coke_pooch', 1) - if CopsConnected == 0 then - xPlayer.addAccountMoney('black_money', 198) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) - elseif CopsConnected == 1 then - xPlayer.addAccountMoney('black_money', 258) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) - elseif CopsConnected == 2 then - xPlayer.addAccountMoney('black_money', 308) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) - elseif CopsConnected == 3 then - xPlayer.addAccountMoney('black_money', 358) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) - elseif CopsConnected == 4 then - xPlayer.addAccountMoney('black_money', 396) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) - elseif CopsConnected >= 5 then - xPlayer.addAccountMoney('black_money', 428) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke')) - end - - SellCoke(source) - end - end - end) -end - -RegisterServerEvent('esx_drugs:startSellCoke') -AddEventHandler('esx_drugs:startSellCoke', function() - local _source = source - - if not PlayersSellingCoke[_source] then - PlayersSellingCoke[_source] = true - - TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog')) - SellCoke(_source) - else - print(('esx_drugs: %s attempted to exploit the zone!'):format(GetPlayerIdentifiers(_source)[1])) - end -end) - -RegisterServerEvent('esx_drugs:stopSellCoke') -AddEventHandler('esx_drugs:stopSellCoke', function() - local _source = source - - PlayersSellingCoke[_source] = false -end) - ---meth -local function HarvestMeth(source) - if CopsConnected < Config.RequiredCopsMeth then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsMeth)) - return - end - - SetTimeout(Config.TimeToFarm, function() - if PlayersHarvestingMeth[source] then - local xPlayer = ESX.GetPlayerFromId(source) - local meth = xPlayer.getInventoryItem('meth') - - if meth.limit ~= -1 and meth.count >= meth.limit then - TriggerClientEvent('esx:showNotification', source, _U('inv_full_meth')) - else - xPlayer.addInventoryItem('meth', 1) - HarvestMeth(source) - end - end - end) -end - -RegisterServerEvent('esx_drugs:startHarvestMeth') -AddEventHandler('esx_drugs:startHarvestMeth', function() - local _source = source - - if not PlayersHarvestingMeth[_source] then - PlayersHarvestingMeth[_source] = true - - TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog')) - HarvestMeth(_source) - else - print(('esx_drugs: %s attempted to exploit the zone!'):format(GetPlayerIdentifiers(_source)[1])) - end -end) - -RegisterServerEvent('esx_drugs:stopHarvestMeth') -AddEventHandler('esx_drugs:stopHarvestMeth', function() - local _source = source - - PlayersHarvestingMeth[_source] = false -end) - -local function TransformMeth(source) - if CopsConnected < Config.RequiredCopsMeth then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsMeth)) - return - end - - SetTimeout(Config.TimeToProcess, function() - if PlayersTransformingMeth[source] then - local xPlayer = ESX.GetPlayerFromId(source) - local methQuantity = xPlayer.getInventoryItem('meth').count - local pooch = xPlayer.getInventoryItem('meth_pooch') - - if pooch.limit ~= -1 and pooch.count >= pooch.limit then - TriggerClientEvent('esx:showNotification', source, _U('too_many_pouches')) - elseif methQuantity < 5 then - TriggerClientEvent('esx:showNotification', source, _U('not_enough_meth')) - else - xPlayer.removeInventoryItem('meth', 5) - xPlayer.addInventoryItem('meth_pooch', 1) - - TransformMeth(source) - end - end - end) -end - -RegisterServerEvent('esx_drugs:startTransformMeth') -AddEventHandler('esx_drugs:startTransformMeth', function() - local _source = source - - if not PlayersTransformingMeth[_source] then - PlayersTransformingMeth[_source] = true - - TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog')) - TransformMeth(_source) - else - print(('esx_drugs: %s attempted to exploit the zone!'):format(GetPlayerIdentifiers(_source)[1])) - end -end) - -RegisterServerEvent('esx_drugs:stopTransformMeth') -AddEventHandler('esx_drugs:stopTransformMeth', function() - local _source = source - - PlayersTransformingMeth[_source] = false -end) - -local function SellMeth(source) - if CopsConnected < Config.RequiredCopsMeth then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsMeth)) - return - end - - SetTimeout(Config.TimeToSell, function() - if PlayersSellingMeth[source] then - local xPlayer = ESX.GetPlayerFromId(source) - local poochQuantity = xPlayer.getInventoryItem('meth_pooch').count - - if poochQuantity == 0 then - TriggerClientEvent('esx:showNotification', source, _U('no_pouches_sale')) - else - xPlayer.removeInventoryItem('meth_pooch', 1) - if CopsConnected == 0 then - xPlayer.addAccountMoney('black_money', 276) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) - elseif CopsConnected == 1 then - xPlayer.addAccountMoney('black_money', 374) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) - elseif CopsConnected == 2 then - xPlayer.addAccountMoney('black_money', 474) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) - elseif CopsConnected == 3 then - xPlayer.addAccountMoney('black_money', 552) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) - elseif CopsConnected == 4 then - xPlayer.addAccountMoney('black_money', 616) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) - elseif CopsConnected == 5 then - xPlayer.addAccountMoney('black_money', 654) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) - elseif CopsConnected >= 6 then - xPlayer.addAccountMoney('black_money', 686) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth')) - end - - SellMeth(source) - end - end - end) -end - -RegisterServerEvent('esx_drugs:startSellMeth') -AddEventHandler('esx_drugs:startSellMeth', function() - local _source = source - - if not PlayersSellingMeth[_source] then - PlayersSellingMeth[_source] = true - - TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog')) - SellMeth(_source) - else - print(('esx_drugs: %s attempted to exploit the zone!'):format(GetPlayerIdentifiers(_source)[1])) - end -end) - -RegisterServerEvent('esx_drugs:stopSellMeth') -AddEventHandler('esx_drugs:stopSellMeth', function() - local _source = source - - PlayersSellingMeth[_source] = false -end) - ---weed -local function HarvestWeed(source) - if CopsConnected < Config.RequiredCopsWeed then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsWeed)) - return - end - - SetTimeout(Config.TimeToFarm, function() - if PlayersHarvestingWeed[source] then - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) - local weed = xPlayer.getInventoryItem('weed') - - if weed.limit ~= -1 and weed.count >= weed.limit then - TriggerClientEvent('esx:showNotification', source, _U('inv_full_weed')) - else - xPlayer.addInventoryItem('weed', 1) - HarvestWeed(source) - end - end - end) -end - -RegisterServerEvent('esx_drugs:startHarvestWeed') -AddEventHandler('esx_drugs:startHarvestWeed', function() - local _source = source - - if not PlayersHarvestingWeed[_source] then - PlayersHarvestingWeed[_source] = true - - TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog')) - HarvestWeed(_source) - else - print(('esx_drugs: %s attempted to exploit the zone!'):format(GetPlayerIdentifiers(_source)[1])) - end -end) - -RegisterServerEvent('esx_drugs:stopHarvestWeed') -AddEventHandler('esx_drugs:stopHarvestWeed', function() - local _source = source - - PlayersHarvestingWeed[_source] = false -end) - -local function TransformWeed(source) - if CopsConnected < Config.RequiredCopsWeed then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsWeed)) - return - end - - SetTimeout(Config.TimeToProcess, function() - if PlayersTransformingWeed[source] then - local xPlayer = ESX.GetPlayerFromId(source) - local weedQuantity = xPlayer.getInventoryItem('weed').count - local pooch = xPlayer.getInventoryItem('weed_pooch') - - if pooch.limit ~= -1 and pooch.count >= pooch.limit then - TriggerClientEvent('esx:showNotification', source, _U('too_many_pouches')) - elseif weedQuantity < 5 then - TriggerClientEvent('esx:showNotification', source, _U('not_enough_weed')) - else - xPlayer.removeInventoryItem('weed', 5) - xPlayer.addInventoryItem('weed_pooch', 1) - - TransformWeed(source) - end - end - end) -end - -RegisterServerEvent('esx_drugs:startTransformWeed') -AddEventHandler('esx_drugs:startTransformWeed', function() - local _source = source - - if not PlayersTransformingWeed[_source] then - PlayersTransformingWeed[_source] = true - - TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog')) - TransformWeed(_source) - else - print(('esx_drugs: %s attempted to exploit the zone!'):format(GetPlayerIdentifiers(_source)[1])) - end -end) - -RegisterServerEvent('esx_drugs:stopTransformWeed') -AddEventHandler('esx_drugs:stopTransformWeed', function() - local _source = source - - PlayersTransformingWeed[_source] = false -end) - -local function SellWeed(source) - if CopsConnected < Config.RequiredCopsWeed then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsWeed)) - return - end - - SetTimeout(Config.TimeToSell, function() - if PlayersSellingWeed[source] then - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) - local poochQuantity = xPlayer.getInventoryItem('weed_pooch').count - - if poochQuantity == 0 then - TriggerClientEvent('esx:showNotification', source, _U('no_pouches_sale')) - else - xPlayer.removeInventoryItem('weed_pooch', 1) - if CopsConnected == 0 then - xPlayer.addAccountMoney('black_money', 108) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_weed')) - elseif CopsConnected == 1 then - xPlayer.addAccountMoney('black_money', 128) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_weed')) - elseif CopsConnected == 2 then - xPlayer.addAccountMoney('black_money', 152) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_weed')) - elseif CopsConnected == 3 then - xPlayer.addAccountMoney('black_money', 165) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_weed')) - elseif CopsConnected >= 4 then - xPlayer.addAccountMoney('black_money', 180) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_weed')) - end - - SellWeed(source) - end - end - end) -end - -RegisterServerEvent('esx_drugs:startSellWeed') -AddEventHandler('esx_drugs:startSellWeed', function() - local _source = source - - if not PlayersSellingWeed[_source] then - PlayersSellingWeed[_source] = true - - TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog')) - SellWeed(_source) - else - print(('esx_drugs: %s attempted to exploit the zone!'):format(GetPlayerIdentifiers(_source)[1])) - end -end) - -RegisterServerEvent('esx_drugs:stopSellWeed') -AddEventHandler('esx_drugs:stopSellWeed', function() - local _source = source - - PlayersSellingWeed[_source] = false -end) - ---opium -local function HarvestOpium(source) - if CopsConnected < Config.RequiredCopsOpium then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsOpium)) - return - end - - SetTimeout(Config.TimeToFarm, function() - if PlayersHarvestingOpium[source] then - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) - local opium = xPlayer.getInventoryItem('opium') - - if opium.limit ~= -1 and opium.count >= opium.limit then - TriggerClientEvent('esx:showNotification', _source, _U('inv_full_opium')) - else - xPlayer.addInventoryItem('opium', 1) - HarvestOpium(_source) - end - end - end) -end - -RegisterServerEvent('esx_drugs:startHarvestOpium') -AddEventHandler('esx_drugs:startHarvestOpium', function() - local _source = source - - if not PlayersHarvestingOpium[_source] then - PlayersHarvestingOpium[_source] = true - - TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog')) - HarvestOpium(_source) - else - print(('esx_drugs: %s attempted to exploit the zone!'):format(GetPlayerIdentifiers(_source)[1])) - end -end) - -RegisterServerEvent('esx_drugs:stopHarvestOpium') -AddEventHandler('esx_drugs:stopHarvestOpium', function() - local _source = source - - PlayersHarvestingOpium[_source] = false -end) - -local function TransformOpium(source) - if CopsConnected < Config.RequiredCopsOpium then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsOpium)) - return - end - - SetTimeout(Config.TimeToProcess, function() - if PlayersTransformingOpium[source] then - local xPlayer = ESX.GetPlayerFromId(source) - local opiumQuantity = xPlayer.getInventoryItem('opium').count - local pooch = xPlayer.getInventoryItem('opium_pooch') - - if pooch.limit ~= -1 and pooch.count >= pooch.limit then - TriggerClientEvent('esx:showNotification', source, _U('too_many_pouches')) - elseif opiumQuantity < 5 then - TriggerClientEvent('esx:showNotification', source, _U('not_enough_opium')) - else - xPlayer.removeInventoryItem('opium', 5) - xPlayer.addInventoryItem('opium_pooch', 1) - - TransformOpium(source) - end - end - end) -end - -RegisterServerEvent('esx_drugs:startTransformOpium') -AddEventHandler('esx_drugs:startTransformOpium', function() - local _source = source - - if not PlayersTransformingOpium[_source] then - PlayersTransformingOpium[_source] = true - - TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog')) - TransformOpium(_source) - else - print(('esx_drugs: %s attempted to exploit the zone!'):format(GetPlayerIdentifiers(_source)[1])) - end -end) - -RegisterServerEvent('esx_drugs:stopTransformOpium') -AddEventHandler('esx_drugs:stopTransformOpium', function() - local _source = source - - PlayersTransformingOpium[_source] = false -end) - -local function SellOpium(source) - if CopsConnected < Config.RequiredCopsOpium then - TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsOpium)) - return - end - - SetTimeout(Config.TimeToSell, function() - if PlayersSellingOpium[source] then - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) - local poochQuantity = xPlayer.getInventoryItem('opium_pooch').count - - if poochQuantity == 0 then - TriggerClientEvent('esx:showNotification', source, _U('no_pouches_sale')) - else - xPlayer.removeInventoryItem('opium_pooch', 1) - if CopsConnected == 0 then - xPlayer.addAccountMoney('black_money', 300) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) - elseif CopsConnected == 1 then - xPlayer.addAccountMoney('black_money', 500) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) - elseif CopsConnected == 2 then - xPlayer.addAccountMoney('black_money', 700) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) - elseif CopsConnected == 3 then - xPlayer.addAccountMoney('black_money', 800) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) - elseif CopsConnected == 4 then - xPlayer.addAccountMoney('black_money', 900) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) - elseif CopsConnected >= 5 then - xPlayer.addAccountMoney('black_money', 1000) - TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium')) - end - - SellOpium(source) - end - end - end) -end - -RegisterServerEvent('esx_drugs:startSellOpium') -AddEventHandler('esx_drugs:startSellOpium', function() - local _source = source - - if not PlayersSellingOpium[_source] then - PlayersSellingOpium[_source] = true - - TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog')) - SellOpium(_source) - else - print(('esx_drugs: %s attempted to exploit the zone!'):format(GetPlayerIdentifiers(_source)[1])) - end -end) - -RegisterServerEvent('esx_drugs:stopSellOpium') -AddEventHandler('esx_drugs:stopSellOpium', function() - local _source = source - - PlayersSellingOpium[_source] = false -end) - -RegisterServerEvent('esx_drugs:GetUserInventory') -AddEventHandler('esx_drugs:GetUserInventory', function(currentZone) - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) - TriggerClientEvent('esx_drugs:ReturnInventory', - _source, - xPlayer.getInventoryItem('coke').count, - xPlayer.getInventoryItem('coke_pooch').count, - xPlayer.getInventoryItem('meth').count, - xPlayer.getInventoryItem('meth_pooch').count, - xPlayer.getInventoryItem('weed').count, - xPlayer.getInventoryItem('weed_pooch').count, - xPlayer.getInventoryItem('opium').count, - xPlayer.getInventoryItem('opium_pooch').count, - xPlayer.job.name, - currentZone - ) -end) - -ESX.RegisterUsableItem('weed', function(source) - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) - - xPlayer.removeInventoryItem('weed', 1) - - TriggerClientEvent('esx_drugs:onPot', _source) - TriggerClientEvent('esx:showNotification', _source, _U('used_one_weed')) -end) From 83df73db40eea70148ade3c749fe9aaa2a5c181b Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Fri, 30 Nov 2018 22:42:59 +0100 Subject: [PATCH 42/66] Add new files --- .editorconfig | 9 + .gitattributes | 2 + LICENSE | 674 ++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 3 + __resource.lua | 27 ++ client/main.lua | 125 +++++++++ client/weed.lua | 198 ++++++++++++++ config.lua | 20 ++ locales/en.lua | 23 ++ locales/sv.lua | 23 ++ server/main.lua | 102 ++++++++ 11 files changed, 1206 insertions(+) create mode 100644 .editorconfig create mode 100644 .gitattributes create mode 100644 LICENSE create mode 100644 README.md create mode 100644 __resource.lua create mode 100644 client/main.lua create mode 100644 client/weed.lua create mode 100644 config.lua create mode 100644 locales/en.lua create mode 100644 locales/sv.lua create mode 100644 server/main.lua diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..9b425256 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +indent_size = 4 +indent_style = tab +end_of_line = crlf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true \ No newline at end of file diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..dfe07704 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..9e419e04 --- /dev/null +++ b/LICENSE @@ -0,0 +1,674 @@ +GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 00000000..897c0f4b --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# esx_drugs + +This is a WIP re-write of the resource. Currently feautures a weed farm with actual weed plant objects. \ No newline at end of file diff --git a/__resource.lua b/__resource.lua new file mode 100644 index 00000000..8931eafe --- /dev/null +++ b/__resource.lua @@ -0,0 +1,27 @@ +resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937' + +description 'ESX Drugs' + +version '0.1.0' + +server_scripts { + '@mysql-async/lib/MySQL.lua', + '@es_extended/locale.lua', + 'locales/en.lua', + 'locales/sv.lua', + 'config.lua', + 'server/main.lua' +} + +client_scripts { + '@es_extended/locale.lua', + 'locales/en.lua', + 'locales/sv.lua', + 'config.lua', + 'client/main.lua', + 'client/weed.lua' +} + +dependencies { + 'es_extended' +} \ No newline at end of file diff --git a/client/main.lua b/client/main.lua new file mode 100644 index 00000000..54d535c6 --- /dev/null +++ b/client/main.lua @@ -0,0 +1,125 @@ +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 +} + +ESX = nil +local shopOpen = false + +Citizen.CreateThread(function() + while ESX == nil do + TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) + Citizen.Wait(0) + end + + while ESX.GetPlayerData().job == nil do + Citizen.Wait(100) + end + + ESX.PlayerData = ESX.GetPlayerData() +end) + +Citizen.CreateThread(function() + while true do + Citizen.Wait(0) + local playerPed = PlayerPedId() + local coords = GetEntityCoords(playerPed) + + if GetDistanceBetweenCoords(coords, Config.CircleZones.DrugDealer.coords, true) < 0.5 then + if not shopOpen then + ESX.ShowHelpNotification(_U('dealer_prompt')) + + if IsControlJustReleased(0, Keys['E']) then + OpenDrugShop() + end + else + Citizen.Wait(500) + end + else + if shopOpen then + ESX.UI.Menu.CloseAll() + shopOpen = false + end + + Citizen.Wait(500) + end + end +end) + +function OpenDrugShop() + ESX.UI.Menu.CloseAll() + local elements = {} + shopOpen = true + + for k, v in pairs(ESX.GetPlayerData().inventory) do + local price = Config.DrugDealerItems[v.name] + + if price and v.count > 0 then + table.insert(elements, { + label = ('%s - %s'):format(v.label, _U('dealer_item', ESX.Math.GroupDigits(price))), + name = v.name, + price = price, + + -- menu properties + type = 'slider', + value = 1, + min = 1, + max = v.count + }) + end + end + + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'drug_shop', { + title = _U('dealer_title'), + align = 'top-left', + elements = elements + }, function(data, menu) + TriggerServerEvent('esx_drugs:sellDrug', data.current.name, data.current.value) + end, function(data, menu) + menu.close() + shopOpen = false + end) +end + +AddEventHandler('onResourceStop', function(resource) + if resource == GetCurrentResourceName() then + if shopOpen then + ESX.UI.Menu.CloseAll() + end + end +end) + +function CreateBlipCircle(coords, text, radius, color, sprite) + local blip = AddBlipForRadius(coords, radius) + + SetBlipHighDetail(blip, true) + SetBlipColour(blip, 1) + SetBlipAlpha (blip, 128) + + -- create a blip in the middle + blip = AddBlipForCoord(coords) + + SetBlipHighDetail(blip, true) + SetBlipSprite (blip, sprite) + SetBlipScale (blip, 1.0) + SetBlipColour (blip, color) + SetBlipAsShortRange(blip, true) + + BeginTextCommandSetBlipName("STRING") + AddTextComponentString(text) + EndTextCommandSetBlipName(blip) +end + +Citizen.CreateThread(function() + for k,zone in pairs(Config.CircleZones) do + + CreateBlipCircle(zone.coords, zone.name, zone.radius, zone.color, zone.sprite) + end +end) \ No newline at end of file diff --git a/client/weed.lua b/client/weed.lua new file mode 100644 index 00000000..898581d4 --- /dev/null +++ b/client/weed.lua @@ -0,0 +1,198 @@ +local spawnedWeeds = 0 +local weedPlants = {} +local isPickingUp, isProcessing = false, false + + +Citizen.CreateThread(function() + while true do + Citizen.Wait(10) + local coords = GetEntityCoords(PlayerPedId()) + + if GetDistanceBetweenCoords(coords, Config.CircleZones.WeedField.coords, true) < 50 then + SpawnWeedPlants() + Citizen.Wait(500) + else + Citizen.Wait(500) + end + end +end) + +Citizen.CreateThread(function() + while true do + Citizen.Wait(10) + local playerPed = PlayerPedId() + local coords = GetEntityCoords(playerPed) + + if GetDistanceBetweenCoords(coords, Config.CircleZones.WeedProcessing.coords, true) < 1 then + if not isProcessing then + ESX.ShowHelpNotification(_U('weed_processprompt')) + end + + if IsControlJustReleased(0, Keys['E']) and not isProcessing then + isProcessing = true + ESX.ShowNotification(_U('weed_processingstarted')) + TriggerServerEvent('esx_drugs:processCannabis') + local timeLeft = Config.Delays.WeedProcessing / 1000 + + while timeLeft > 0 do + Citizen.Wait(1000) + timeLeft = timeLeft - 1 + + if GetDistanceBetweenCoords(GetEntityCoords(playerPed), Config.CircleZones.WeedProcessing.coords, false) > 4 then + ESX.ShowNotification(_U('weed_processingtoofar')) + TriggerServerEvent('esx_drugs:cancelProcessing') + break + end + end + + isProcessing = false + end + else + Citizen.Wait(500) + end + end +end) + +Citizen.CreateThread(function() + while true do + Citizen.Wait(10) + local playerPed = PlayerPedId() + local coords = GetEntityCoords(playerPed) + local nearbyObject, nearbyID = nil, nil + + for i=1, #weedPlants, 1 do + if GetDistanceBetweenCoords(coords, GetEntityCoords(weedPlants[i]), false) < 1 then + nearbyObject, nearbyID = weedPlants[i], i + end + end + + if nearbyObject and IsPedOnFoot(playerPed) then + + if not isPickingUp then + ESX.ShowHelpNotification(_U('weed_pickupprompt')) + end + + if IsControlJustReleased(0, Keys['E']) and not isPickingUp then + isPickingUp = true + + ESX.TriggerServerCallback('esx_drugs:canPickUp', function(canPickUp) + + if canPickUp then + TaskStartScenarioInPlace(playerPed, 'world_human_gardener_plant', 0, false) + + Citizen.Wait(2000) + ClearPedTasks(playerPed) + Citizen.Wait(1500) + + ESX.Game.DeleteObject(nearbyObject) + + table.remove(weedPlants, nearbyID) + spawnedWeeds = spawnedWeeds - 1 + + TriggerServerEvent('esx_drugs:pickedUpCannabis') + else + ESX.ShowNotification(_U('weed_inventoryfull')) + end + + isPickingUp = false + + end, 'cannabis') + end + + end + + end + +end) + +AddEventHandler('onResourceStop', function(resource) + if resource == GetCurrentResourceName() then + for k, v in pairs(weedPlants) do + ESX.Game.DeleteObject(v) + end + end +end) + +function SpawnWeedPlants() + while spawnedWeeds < 25 do + Citizen.Wait(0) + local weedCoords = GenerateWeedCoords() + + ESX.Game.SpawnLocalObject('prop_weed_02', weedCoords, function(obj) + PlaceObjectOnGroundProperly(obj) + FreezeEntityPosition(obj, true) + + table.insert(weedPlants, obj) + spawnedWeeds = spawnedWeeds + 1 + end) + end +end + +function ValidateWeedCoord(plantCoord) + if spawnedWeeds > 0 then + local validate = true + + for k, v in pairs(weedPlants) do + if GetDistanceBetweenCoords(plantCoord, GetEntityCoords(v), true) < 5 then + validate = false + end + end + + if GetDistanceBetweenCoords(plantCoord, Config.CircleZones.WeedField.coords, false) > 50 then + validate = false + end + + return validate + else + return true + end +end + +function GenerateWeedCoords() + while true do + Citizen.Wait(1) + + local weedCoordX, weedCoordY + + math.randomseed(GetGameTimer()) + local modX = math.random(-90, 90) + + Citizen.Wait(100) + + math.randomseed(GetGameTimer()) + local modY = math.random(-90, 90) + + if modX > 0 then + weedCoordX = Config.CircleZones.WeedField.coords.x + modX + else + weedCoordX = Config.CircleZones.WeedField.coords.x - modX + end + + if modY > 0 then + weedCoordY = Config.CircleZones.WeedField.coords.y + modY + else + weedCoordY = Config.CircleZones.WeedField.coords.y - modY + end + + local coordZ = GetCoordZ(weedCoordX, weedCoordY) + local coord = vector3(weedCoordX, weedCoordY, coordZ) + + if ValidateWeedCoord(coord) then + return coord + end + end +end + +function GetCoordZ(x, y) + local groundCheckHeights = { 40.0, 41.0, 42.0, 43.0, 44.0, 45.0, 46.0, 47.0, 48.0, 49.0, 50.0 } + + for i, height in ipairs(groundCheckHeights) do + local foundGround, z = GetGroundZFor_3dCoord(x, y, height) + + if foundGround then + return z + end + end + + return 43.0 +end \ No newline at end of file diff --git a/config.lua b/config.lua new file mode 100644 index 00000000..7166134e --- /dev/null +++ b/config.lua @@ -0,0 +1,20 @@ +Config = {} + +Config.Locale = 'en' + +Config.Delays = { + WeedProcessing = 1000 * 10 +} + +Config.DrugDealerItems = { + marijuana = 91 +} + +Config.GiveBlack = true -- give black money? if disabled it'll give regular cash. + +Config.CircleZones = { + WeedField = {coords = vector3(310.91, 4290.87, 45.15), name = _U('blip_weedfield'), color = 25, sprite = 496, radius = 100.0}, + WeedProcessing = {coords = vector3(2329.02, 2571.29, 46.68), name = _U('blip_weedprocessing'), color = 25, sprite = 496, radius = 100.0}, + + DrugDealer = {coords = vector3(-1172.02, -1571.98, 4.66), name = _U('blip_drugdealer'), color = 6, sprite = 378, radius = 25.0}, +} \ No newline at end of file diff --git a/locales/en.lua b/locales/en.lua new file mode 100644 index 00000000..4fcd32e8 --- /dev/null +++ b/locales/en.lua @@ -0,0 +1,23 @@ +Locales ['en'] = { + -- weed + ['weed_pickupprompt'] = 'press ~INPUT_CONTEXT~ to harvest the ~g~Cannabis~s~ plant.', + ['weed_inventoryfull'] = 'you do not have any more inventory space for ~g~Cannabis~s~.', + ['weed_processprompt'] = 'press ~INPUT_CONTEXT~ to start ~g~Process Cannabis~s~.', + ['weed_processingstarted'] = 'processing ~g~Cannabis~s~ into ~g~Marijuana~s~...', + ['weed_processingfull'] = 'processing ~r~canceled~s~ due to full inventory!', + ['weed_processingenough'] = 'you must have ~b~3x~s~ ~g~Cannabis~s~ in order to process.', + ['weed_processed'] = 'you\'ve processed ~b~3x~s~ ~g~Cannabis~s~ to ~b~1x~s~ ~g~Marijuana~s~', + ['weed_processingtoofar'] = 'the processing has been ~r~canceled~s~ due to you abandoning the area.', + + -- drug dealer + ['dealer_prompt'] = 'press ~INPUT_CONTEXT~ to talk with the ~r~Drug Dealer~s~.', + ['dealer_title'] = 'drug Dealer', + ['dealer_item'] = '$%s', + ['dealer_notenough'] = 'you don\'t have enough of that to sell!', + ['dealer_sold'] = 'you\'ve sold ~b~%sx~s~ ~y~%s~s~ for ~g~$%s~s~', + + -- blips + ['blip_weedfield'] = 'weed Field', + ['blip_weedprocessing'] = 'weed Processing', + ['blip_drugdealer'] = 'drug Dealer', +} diff --git a/locales/sv.lua b/locales/sv.lua new file mode 100644 index 00000000..eb973f09 --- /dev/null +++ b/locales/sv.lua @@ -0,0 +1,23 @@ +Locales ['sv'] = { + -- weed + ['weed_pickupprompt'] = 'tryck ~INPUT_CONTEXT~ för att skörda ~g~Cannabisväxten~s~.', + ['weed_inventoryfull'] = 'du har ingen mer plats för ~g~Cannabis~s~.', + ['weed_processprompt'] = 'tryck ~INPUT_CONTEXT~ för att börja ~g~Processera Cannabis~s~.', + ['weed_processingstarted'] = 'processera ~g~Cannabis~s~ till ~g~Marijuana~s~...', + ['weed_processingfull'] = 'processeringen ~r~avbröts~s~ för att utrymmet är slut!', + ['weed_processingenough'] = 'du måste ha ~b~3x~s~ ~g~Cannabis~s~ för att kunna bearbeta den.', + ['weed_processed'] = 'du har processerat ~b~3x~s~ ~g~Cannabis~s~ till ~b~1x~s~ ~g~Marijuana~s~', + ['weed_processingtoofar'] = 'processeringen har ~r~har avbrutit~s~ på grund av att du lämnade området.', + + -- drug dealer + ['dealer_prompt'] = 'tryck ~INPUT_CONTEXT~ för att prata med ~r~Drågsäljaren~s~.', + ['dealer_title'] = 'drogsäljare', + ['dealer_item'] = '%s SEK', + ['dealer_notenough'] = 'du har inte tillräckligt med det till salu!', + ['dealer_sold'] = 'duhar sålt ~b~%sx~s~ ~y~%s~s~ för ~g~%s SEK~s~', + + -- blips + ['blip_weedfield'] = 'marijuana plock', + ['blip_weedprocessing'] = 'marijuana processering', + ['blip_drugdealer'] = 'drogsäljare', +} diff --git a/server/main.lua b/server/main.lua new file mode 100644 index 00000000..3efa8545 --- /dev/null +++ b/server/main.lua @@ -0,0 +1,102 @@ +ESX = nil +local playersProcessingCannabis = {} + +TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) + +RegisterServerEvent('esx_drugs:sellDrug') +AddEventHandler('esx_drugs:sellDrug', function(itemName, amount) + local xPlayer = ESX.GetPlayerFromId(source) + local price = Config.DrugDealerItems[itemName] + local xItem = xPlayer.getInventoryItem(itemName) + + if not price then + print(('esx_drugs: %s attempted to sell an invalid drug!'):format(xPlayer.identifier)) + return + end + + if xItem.count < amount then + TriggerClientEvent('esx:showNotification', source, _U('dealer_notenough')) + return + end + + price = ESX.Math.Round(price * amount) + + if Config.GiveBlack then + xPlayer.addAccountMoney('black_money', price) + else + xPlayer.addMoney(price) + end + + xPlayer.removeInventoryItem(xItem.name, amount) + + TriggerClientEvent('esx:showNotification', source, _U('dealer_sold', amount, xItem.label, ESX.Math.GroupDigits(price))) +end) + +RegisterServerEvent('esx_drugs:pickedUpCannabis') +AddEventHandler('esx_drugs:pickedUpCannabis', function() + local xPlayer = ESX.GetPlayerFromId(source) + local xItem = xPlayer.getInventoryItem('cannabis') + + if xItem.limit ~= -1 and (xItem.count + 1) > xItem.limit then + TriggerClientEvent('esx:showNotification', _source, _U('weed_inventoryfull')) + else + xPlayer.addInventoryItem(xItem.name, 1) + end +end) + +ESX.RegisterServerCallback('esx_drugs:canPickUp', function(source, cb, item) + local xPlayer = ESX.GetPlayerFromId(source) + local xItem = xPlayer.getInventoryItem(item) + + if xItem.limit ~= -1 and xItem.count >= xItem.limit then + cb(false) + else + cb(true) + end +end) + +RegisterServerEvent('esx_drugs:processCannabis') +AddEventHandler('esx_drugs:processCannabis', function() + if not playersProcessingCannabis[source] then + local _source = source + + playersProcessingCannabis[_source] = ESX.SetTimeout(Config.Delays.WeedProcessing, function() + local xPlayer = ESX.GetPlayerFromId(_source) + local xCannabis, xMarijuana = xPlayer.getInventoryItem('cannabis'), xPlayer.getInventoryItem('marijuana') + + if xMarijuana.limit ~= -1 and (xMarijuana.count + 1) >= xMarijuana.limit then + TriggerClientEvent('esx:showNotification', _source, _U('weed_processingfull')) + elseif xCannabis.count < 3 then + TriggerClientEvent('esx:showNotification', _source, _U('weed_processingenough')) + else + xPlayer.removeInventoryItem('cannabis', 3) + xPlayer.addInventoryItem('marijuana', 1) + + TriggerClientEvent('esx:showNotification', _source, _U('weed_processed')) + end + end) + else + print(('esx_drugs: %s attempted to exploit weed processing!'):format(GetPlayerIdentifiers(source)[1])) + end +end) + +function CancelProcessing(playerID) + if playersProcessingCannabis[playerID] then + ESX.ClearTimeout(playersProcessingCannabis[playerID]) + playersProcessingCannabis[playerID] = nil + end +end + +RegisterServerEvent('esx_drugs:cancelProcessing') +AddEventHandler('esx_drugs:cancelProcessing', function() + CancelProcessing(source) +end) + +AddEventHandler('esx:playerDropped', function(playerID, reason) + CancelProcessing(playerID) +end) + +RegisterServerEvent('esx:onPlayerDeath') +AddEventHandler('esx:onPlayerDeath', function(data) + CancelProcessing(source) +end) From fd6931fb0c5426011cf287c35b1d67585212f4f0 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Fri, 30 Nov 2018 22:48:00 +0100 Subject: [PATCH 43/66] Final commit v2.0.0 --- README.md | 39 ++++++++++++++++++++++++++++++++++++++- __resource.lua | 2 +- esx_drugs.sql | 6 ++++++ 3 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 esx_drugs.sql diff --git a/README.md b/README.md index 897c0f4b..bb1588a3 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,40 @@ # esx_drugs -This is a WIP re-write of the resource. Currently feautures a weed farm with actual weed plant objects. \ No newline at end of file +Adds the well-known drugs for the people who want to make quick money. Weed Field require you to run around and harvest weed plants, process and then sell at the beach of San Andreas! + +## Download & Installation + +### Using [fvm](https://github.com/qlaffont/fvm-installer) +``` +fvm install --save --folder=esx esx-org/esx_drugs +``` + +### Using Git +``` +cd resources +git clone https://github.com/ESX-Org/esx_drugs [esx]/esx_drugs +``` + +### Manually +- Download https://github.com/ESX-Org/esx_drugs/archive/master.zip +- Put it in the `[esx]` directory + +## Installation +- Import `esx_drugs.sql` in your database +- Add this in your `server.cfg`: + +``` +start esx_drugs +``` + +# Legal +### License +esx_drugs - drugs job + +Copyright (C) 2015-2018 Jérémie N'gadi + +This program Is free software: you can redistribute it And/Or modify it under the terms Of the GNU General Public License As published by the Free Software Foundation, either version 3 Of the License, Or (at your option) any later version. + +This program Is distributed In the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty Of MERCHANTABILITY Or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License For more details. + +You should have received a copy Of the GNU General Public License along with this program. If Not, see http://www.gnu.org/licenses/. \ No newline at end of file diff --git a/__resource.lua b/__resource.lua index 8931eafe..020d2642 100644 --- a/__resource.lua +++ b/__resource.lua @@ -2,7 +2,7 @@ resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937' description 'ESX Drugs' -version '0.1.0' +version '2.0.0' server_scripts { '@mysql-async/lib/MySQL.lua', diff --git a/esx_drugs.sql b/esx_drugs.sql new file mode 100644 index 00000000..9aa7f626 --- /dev/null +++ b/esx_drugs.sql @@ -0,0 +1,6 @@ +USE `essentialmode`; + +INSERT INTO `items` (`name`, `label`, `limit`, `rare`, `can_remove`) VALUES + ('cannabis', 'Cannabis', 40, 0, 1) + ('marijuana', 'Marijuana', 14, 0, 1) +; \ No newline at end of file From 5823610ce013fa985460ab9275fc1f757dcda86d Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sat, 1 Dec 2018 15:55:31 +0100 Subject: [PATCH 44/66] Clear processing after finished --- server/main.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/main.lua b/server/main.lua index 3efa8545..be4bf7ec 100644 --- a/server/main.lua +++ b/server/main.lua @@ -74,6 +74,8 @@ AddEventHandler('esx_drugs:processCannabis', function() TriggerClientEvent('esx:showNotification', _source, _U('weed_processed')) end + + playersProcessingCannabis[_source] = nil end) else print(('esx_drugs: %s attempted to exploit weed processing!'):format(GetPlayerIdentifiers(source)[1])) From 3276231cde5fa7e37666861b3b60ae59d20036c6 Mon Sep 17 00:00:00 2001 From: x1mart Date: Sat, 1 Dec 2018 15:57:21 +0000 Subject: [PATCH 45/66] Missing comma --- esx_drugs.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/esx_drugs.sql b/esx_drugs.sql index 9aa7f626..575f57f8 100644 --- a/esx_drugs.sql +++ b/esx_drugs.sql @@ -1,6 +1,6 @@ USE `essentialmode`; INSERT INTO `items` (`name`, `label`, `limit`, `rare`, `can_remove`) VALUES - ('cannabis', 'Cannabis', 40, 0, 1) + ('cannabis', 'Cannabis', 40, 0, 1), ('marijuana', 'Marijuana', 14, 0, 1) -; \ No newline at end of file +; From 7974aea5a1c491ac44a2ca3648d6357410e0bdeb Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sat, 8 Dec 2018 13:30:26 +0100 Subject: [PATCH 46/66] Implemented processing license --- client/main.lua | 58 +++++++++++++++++++++++++++++++++++++++++++------ client/weed.lua | 46 +++++++++++++++++++++++++++------------ config.lua | 6 +++++ esx_drugs.sql | 4 ++++ locales/en.lua | 7 ++++++ locales/sv.lua | 13 ++++++++--- server/main.lua | 20 +++++++++++++++++ 7 files changed, 130 insertions(+), 24 deletions(-) diff --git a/client/main.lua b/client/main.lua index 54d535c6..c7c00efd 100644 --- a/client/main.lua +++ b/client/main.lua @@ -11,7 +11,8 @@ Keys = { } ESX = nil -local shopOpen = false +local menuOpen = false +local wasOpen = false Citizen.CreateThread(function() while ESX == nil do @@ -33,19 +34,20 @@ Citizen.CreateThread(function() local coords = GetEntityCoords(playerPed) if GetDistanceBetweenCoords(coords, Config.CircleZones.DrugDealer.coords, true) < 0.5 then - if not shopOpen then + if not menuOpen then ESX.ShowHelpNotification(_U('dealer_prompt')) if IsControlJustReleased(0, Keys['E']) then + wasOpen = true OpenDrugShop() end else Citizen.Wait(500) end else - if shopOpen then + if wasOpen then + wasOpen = false ESX.UI.Menu.CloseAll() - shopOpen = false end Citizen.Wait(500) @@ -56,7 +58,7 @@ end) function OpenDrugShop() ESX.UI.Menu.CloseAll() local elements = {} - shopOpen = true + menuOpen = true for k, v in pairs(ESX.GetPlayerData().inventory) do local price = Config.DrugDealerItems[v.name] @@ -84,18 +86,60 @@ function OpenDrugShop() TriggerServerEvent('esx_drugs:sellDrug', data.current.name, data.current.value) end, function(data, menu) menu.close() - shopOpen = false + menuOpen = false end) end AddEventHandler('onResourceStop', function(resource) if resource == GetCurrentResourceName() then - if shopOpen then + if menuOpen then ESX.UI.Menu.CloseAll() end end end) +function OpenBuyLicenseMenu(licenseName) + menuOpen = true + local license = Config.LicensePrices[licenseName] + + local elements = { + { + label = _U('license_no'), + value = 'no' + }, + + { + label = ('%s - %s'):format(license.label, _U('dealer_item', ESX.Math.GroupDigits(license.price))), + value = licenseName, + price = license.price, + licenseName = license.label + } + } + + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'license_shop', { + title = _U('license_title'), + align = 'top-left', + elements = elements + }, function(data, menu) + + if data.current.value ~= 'no' then + ESX.TriggerServerCallback('esx_drugs:buyLicense', function(boughtLicense) + if boughtLicense then + ESX.ShowNotification(_U('license_bought', data.current.licenseName, ESX.Math.GroupDigits(data.current.price))) + else + ESX.ShowNotification(_U('license_bought_fail', data.current.licenseName)) + end + end, data.current.value) + else + menu.close() + end + + end, function(data, menu) + menu.close() + menuOpen = false + end) +end + function CreateBlipCircle(coords, text, radius, color, sprite) local blip = AddBlipForRadius(coords, radius) diff --git a/client/weed.lua b/client/weed.lua index 898581d4..2016225e 100644 --- a/client/weed.lua +++ b/client/weed.lua @@ -29,23 +29,19 @@ Citizen.CreateThread(function() end if IsControlJustReleased(0, Keys['E']) and not isProcessing then - isProcessing = true - ESX.ShowNotification(_U('weed_processingstarted')) - TriggerServerEvent('esx_drugs:processCannabis') - local timeLeft = Config.Delays.WeedProcessing / 1000 - while timeLeft > 0 do - Citizen.Wait(1000) - timeLeft = timeLeft - 1 - - if GetDistanceBetweenCoords(GetEntityCoords(playerPed), Config.CircleZones.WeedProcessing.coords, false) > 4 then - ESX.ShowNotification(_U('weed_processingtoofar')) - TriggerServerEvent('esx_drugs:cancelProcessing') - break - end + if Config.LicenseEnable then + ESX.TriggerServerCallback('esx_license:checkLicense', function(hasProcessingLicense) + if hasProcessingLicense then + ProcessWeed() + else + OpenBuyLicenseMenu('weed_processing') + end + end, GetPlayerServerId(PlayerId()), 'weed_processing') + else + ProcessWeed() end - isProcessing = false end else Citizen.Wait(500) @@ -53,6 +49,28 @@ Citizen.CreateThread(function() end end) +function ProcessWeed() + isProcessing = true + + ESX.ShowNotification(_U('weed_processingstarted')) + TriggerServerEvent('esx_drugs:processCannabis') + local timeLeft = Config.Delays.WeedProcessing / 1000 + local playerPed = PlayerPedId() + + while timeLeft > 0 do + Citizen.Wait(1000) + timeLeft = timeLeft - 1 + + if GetDistanceBetweenCoords(GetEntityCoords(playerPed), Config.CircleZones.WeedProcessing.coords, false) > 4 then + ESX.ShowNotification(_U('weed_processingtoofar')) + TriggerServerEvent('esx_drugs:cancelProcessing') + break + end + end + + isProcessing = false +end + Citizen.CreateThread(function() while true do Citizen.Wait(10) diff --git a/config.lua b/config.lua index 7166134e..dfb500ae 100644 --- a/config.lua +++ b/config.lua @@ -10,6 +10,12 @@ Config.DrugDealerItems = { marijuana = 91 } +Config.LicenseEnable = false -- enable processing licenses? The player will be required to buy a license in order to process drugs. Requires esx_license + +Config.LicensePrices = { + weed_processing = {label = _U('license_weed'), price = 15000} +} + Config.GiveBlack = true -- give black money? if disabled it'll give regular cash. Config.CircleZones = { diff --git a/esx_drugs.sql b/esx_drugs.sql index 575f57f8..6981b9e8 100644 --- a/esx_drugs.sql +++ b/esx_drugs.sql @@ -4,3 +4,7 @@ INSERT INTO `items` (`name`, `label`, `limit`, `rare`, `can_remove`) VALUES ('cannabis', 'Cannabis', 40, 0, 1), ('marijuana', 'Marijuana', 14, 0, 1) ; + +INSERT INTO `licenses` (`type`, `label`) VALUES + ('weed_processing', 'Weed Processing License') +; \ No newline at end of file diff --git a/locales/en.lua b/locales/en.lua index 4fcd32e8..9d644700 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -16,6 +16,13 @@ Locales ['en'] = { ['dealer_notenough'] = 'you don\'t have enough of that to sell!', ['dealer_sold'] = 'you\'ve sold ~b~%sx~s~ ~y~%s~s~ for ~g~$%s~s~', + -- license + ['license_title'] = 'you are required to own a processing license to process this product, it can be bought here.', + ['license_no'] = 'no', + ['license_bought'] = 'you bought the ~b~%s~s~ for ~r~$%s~s~', + ['license_bought_fail'] = 'you cannot afford an ~b~%s~s~!', + ['license_weed'] = 'weed Processing License', + -- blips ['blip_weedfield'] = 'weed Field', ['blip_weedprocessing'] = 'weed Processing', diff --git a/locales/sv.lua b/locales/sv.lua index eb973f09..d3f18526 100644 --- a/locales/sv.lua +++ b/locales/sv.lua @@ -3,9 +3,9 @@ Locales ['sv'] = { ['weed_pickupprompt'] = 'tryck ~INPUT_CONTEXT~ för att skörda ~g~Cannabisväxten~s~.', ['weed_inventoryfull'] = 'du har ingen mer plats för ~g~Cannabis~s~.', ['weed_processprompt'] = 'tryck ~INPUT_CONTEXT~ för att börja ~g~Processera Cannabis~s~.', - ['weed_processingstarted'] = 'processera ~g~Cannabis~s~ till ~g~Marijuana~s~...', + ['weed_processingstarted'] = 'processerar ~g~Cannabis~s~ till ~g~Marijuana~s~...', ['weed_processingfull'] = 'processeringen ~r~avbröts~s~ för att utrymmet är slut!', - ['weed_processingenough'] = 'du måste ha ~b~3x~s~ ~g~Cannabis~s~ för att kunna bearbeta den.', + ['weed_processingenough'] = 'du måste ha ~b~3x~s~ ~g~Cannabis~s~ för att kunna bearbeta det.', ['weed_processed'] = 'du har processerat ~b~3x~s~ ~g~Cannabis~s~ till ~b~1x~s~ ~g~Marijuana~s~', ['weed_processingtoofar'] = 'processeringen har ~r~har avbrutit~s~ på grund av att du lämnade området.', @@ -14,7 +14,14 @@ Locales ['sv'] = { ['dealer_title'] = 'drogsäljare', ['dealer_item'] = '%s SEK', ['dealer_notenough'] = 'du har inte tillräckligt med det till salu!', - ['dealer_sold'] = 'duhar sålt ~b~%sx~s~ ~y~%s~s~ för ~g~%s SEK~s~', + ['dealer_sold'] = 'du har sålt ~b~%sx~s~ ~y~%s~s~ för ~g~%s SEK~s~', + + -- license + ['license_title'] = 'du måste ha ett visst processeringslicens för att kunna bearbeta denna produkt, detta kan dock köpas här.', + ['license_no'] = 'nej', + ['license_bought'] = 'du köpte ~b~%s~s~ för ~r~%s SEK~s~', + ['license_bought_fail'] = 'du har inte råd för ~b~%s~s~!', + ['license_weed'] = 'marijuana processeringslicens', -- blips ['blip_weedfield'] = 'marijuana plock', diff --git a/server/main.lua b/server/main.lua index be4bf7ec..44eded52 100644 --- a/server/main.lua +++ b/server/main.lua @@ -32,6 +32,26 @@ AddEventHandler('esx_drugs:sellDrug', function(itemName, amount) TriggerClientEvent('esx:showNotification', source, _U('dealer_sold', amount, xItem.label, ESX.Math.GroupDigits(price))) end) +ESX.RegisterServerCallback('esx_drugs:buyLicense', function(source, cb, licenseName) + local xPlayer = ESX.GetPlayerFromId(source) + local license = Config.LicensePrices[licenseName] + + if license == nil then + print(('esx_drugs: %s attempted to buy an invalid license!'):format(xPlayer.identifier)) + cb(false) + end + + if xPlayer.getMoney() >= license.price then + xPlayer.removeMoney(license.price) + + TriggerEvent('esx_license:addLicense', source, licenseName, function() + cb(true) + end) + else + cb(false) + end +end) + RegisterServerEvent('esx_drugs:pickedUpCannabis') AddEventHandler('esx_drugs:pickedUpCannabis', function() local xPlayer = ESX.GetPlayerFromId(source) From d17ab90ac90277b41f45df059d218a0663faeb20 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sun, 30 Dec 2018 21:00:03 +0100 Subject: [PATCH 47/66] Check IsControlJustReleased() every frame --- client/weed.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/client/weed.lua b/client/weed.lua index 2016225e..a9027344 100644 --- a/client/weed.lua +++ b/client/weed.lua @@ -19,7 +19,7 @@ end) Citizen.CreateThread(function() while true do - Citizen.Wait(10) + Citizen.Wait(0) local playerPed = PlayerPedId() local coords = GetEntityCoords(playerPed) @@ -73,10 +73,10 @@ end Citizen.CreateThread(function() while true do - Citizen.Wait(10) + Citizen.Wait(0) local playerPed = PlayerPedId() local coords = GetEntityCoords(playerPed) - local nearbyObject, nearbyID = nil, nil + local nearbyObject, nearbyID for i=1, #weedPlants, 1 do if GetDistanceBetweenCoords(coords, GetEntityCoords(weedPlants[i]), false) < 1 then @@ -117,6 +117,8 @@ Citizen.CreateThread(function() end, 'cannabis') end + else + Citizen.Wait(500) end end From c357edfe7ca2e30fbace6c4aa88679f9d0480713 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Wed, 2 Jan 2019 21:48:31 +0100 Subject: [PATCH 48/66] Fixed arithmetic --- client/weed.lua | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/client/weed.lua b/client/weed.lua index a9027344..41e48a56 100644 --- a/client/weed.lua +++ b/client/weed.lua @@ -182,17 +182,8 @@ function GenerateWeedCoords() math.randomseed(GetGameTimer()) local modY = math.random(-90, 90) - if modX > 0 then - weedCoordX = Config.CircleZones.WeedField.coords.x + modX - else - weedCoordX = Config.CircleZones.WeedField.coords.x - modX - end - - if modY > 0 then - weedCoordY = Config.CircleZones.WeedField.coords.y + modY - else - weedCoordY = Config.CircleZones.WeedField.coords.y - modY - end + weedCoordX = Config.CircleZones.WeedField.coords.x + modX + weedCoordY = Config.CircleZones.WeedField.coords.y + modY local coordZ = GetCoordZ(weedCoordX, weedCoordY) local coord = vector3(weedCoordX, weedCoordY, coordZ) From 997e75e43369a9f4950e6e2bc500c4ee649d45c5 Mon Sep 17 00:00:00 2001 From: Oldarorn <36448848+Oldarorn@users.noreply.github.com> Date: Sat, 5 Jan 2019 14:20:54 +0100 Subject: [PATCH 49/66] add french translation (#70) * Create fr.lua * Update __resource.lua --- __resource.lua | 4 +++- locales/fr.lua | 31 +++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 locales/fr.lua diff --git a/__resource.lua b/__resource.lua index 020d2642..b9e66cda 100644 --- a/__resource.lua +++ b/__resource.lua @@ -8,6 +8,7 @@ server_scripts { '@mysql-async/lib/MySQL.lua', '@es_extended/locale.lua', 'locales/en.lua', + 'locales/fr.lua', 'locales/sv.lua', 'config.lua', 'server/main.lua' @@ -16,6 +17,7 @@ server_scripts { client_scripts { '@es_extended/locale.lua', 'locales/en.lua', + 'locales/fr.lua', 'locales/sv.lua', 'config.lua', 'client/main.lua', @@ -24,4 +26,4 @@ client_scripts { dependencies { 'es_extended' -} \ No newline at end of file +} diff --git a/locales/fr.lua b/locales/fr.lua new file mode 100644 index 00000000..251ebc31 --- /dev/null +++ b/locales/fr.lua @@ -0,0 +1,31 @@ +Locales ['fr'] = { + -- weed + ['weed_pickupprompt'] = 'appuyez sur ~INPUT_CONTEXT~ pour récolter un plan de ~g~Cannabis~s~.', + ['weed_inventoryfull'] = 'vous n\'avez plus assez de place dans votre inventaire pour récolter du ~g~Cannabis~s~.', + ['weed_processprompt'] = 'appuyez ~INPUT_CONTEXT~ pour démarrer la ~g~tranformation du Cannabis~s~.', + ['weed_processingstarted'] = 'transformation du ~g~Cannabis~s~ en ~g~Marijuana~s~...', + ['weed_processingfull'] = 'transformation ~r~annulée~s~. Votre inventaire est plein!', + ['weed_processingenough'] = 'vous devez avoir ~b~3x~s~ ~g~Cannabis~s~ pour lancer une transformation.', + ['weed_processed'] = 'vous avez transformé ~b~3x~s~ ~g~Cannabis~s~ en ~b~1x~s~ ~g~Marijuana~s~', + ['weed_processingtoofar'] = 'la transformation a été ~r~annulée~s~. Vous êtes sorti de la zone.', + + -- drug dealer + ['dealer_prompt'] = 'appuyez sur ~INPUT_CONTEXT~ pour parler avec le ~r~Drug Dealer~s~.', + ['dealer_title'] = 'drug Dealer', + ['dealer_item'] = '$%s', + ['dealer_notenough'] = 't\'en as pas assez à vendre!', + ['dealer_sold'] = 'vous avez vendu ~b~%sx~s~ ~y~%s~s~ pour ~g~$%s~s~', + + -- license + ['license_title'] = 'you are required to own a processing license to process this product, it can be bought here.', + ['license_title'] = 'vous devez posséder une license spécifique vous autorisant à transformer ce produit. Vous pouvez l\'acheter ici.', + ['license_no'] = 'non', + ['license_bought'] = 'vous avez acheté ~b~%s~s~ pour ~r~$%s~s~', + ['license_bought_fail'] = 'vous ne pouvez pas acheter ~b~%s~s~!', + ['license_weed'] = 'permis de transformation de weed', + + -- blips + ['blip_weedfield'] = 'champs de weed', + ['blip_weedprocessing'] = 'transformation de weed', + ['blip_drugdealer'] = 'drug Dealer', +} From 077cc4222821c56968eea677bf2504b9cfb3bcbe Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Fri, 15 Mar 2019 13:10:16 +0100 Subject: [PATCH 50/66] Removed duplicate entry --- locales/fr.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/locales/fr.lua b/locales/fr.lua index 251ebc31..4306447e 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -17,7 +17,6 @@ Locales ['fr'] = { ['dealer_sold'] = 'vous avez vendu ~b~%sx~s~ ~y~%s~s~ pour ~g~$%s~s~', -- license - ['license_title'] = 'you are required to own a processing license to process this product, it can be bought here.', ['license_title'] = 'vous devez posséder une license spécifique vous autorisant à transformer ce produit. Vous pouvez l\'acheter ici.', ['license_no'] = 'non', ['license_bought'] = 'vous avez acheté ~b~%s~s~ pour ~r~$%s~s~', From f3046e599a17d10ac483bd5438793fa99afa6b96 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Mon, 22 Apr 2019 11:17:51 +0200 Subject: [PATCH 51/66] Fixed indent mistake --- __resource.lua | 4 ++-- locales/fr.lua | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/__resource.lua b/__resource.lua index b9e66cda..bd8d6c69 100644 --- a/__resource.lua +++ b/__resource.lua @@ -8,7 +8,7 @@ server_scripts { '@mysql-async/lib/MySQL.lua', '@es_extended/locale.lua', 'locales/en.lua', - 'locales/fr.lua', + 'locales/fr.lua', 'locales/sv.lua', 'config.lua', 'server/main.lua' @@ -17,7 +17,7 @@ server_scripts { client_scripts { '@es_extended/locale.lua', 'locales/en.lua', - 'locales/fr.lua', + 'locales/fr.lua', 'locales/sv.lua', 'config.lua', 'client/main.lua', diff --git a/locales/fr.lua b/locales/fr.lua index 4306447e..8d8a4656 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -17,7 +17,7 @@ Locales ['fr'] = { ['dealer_sold'] = 'vous avez vendu ~b~%sx~s~ ~y~%s~s~ pour ~g~$%s~s~', -- license - ['license_title'] = 'vous devez posséder une license spécifique vous autorisant à transformer ce produit. Vous pouvez l\'acheter ici.', + ['license_title'] = 'vous devez posséder une license spécifique vous autorisant à transformer ce produit. Vous pouvez l\'acheter ici.', ['license_no'] = 'non', ['license_bought'] = 'vous avez acheté ~b~%s~s~ pour ~r~$%s~s~', ['license_bought_fail'] = 'vous ne pouvez pas acheter ~b~%s~s~!', From 4220c1471a22c0508c2bd32ea391a47b0bcd0765 Mon Sep 17 00:00:00 2001 From: BackrndSource Date: Mon, 20 May 2019 09:19:50 +0200 Subject: [PATCH 52/66] Add Spanish Translate (#81) * Create es.lua * Update __resource.lua * Create en_esx_drugs.sql * Create es_esx_drugs.sql --- __resource.lua | 2 ++ locales/es.lua | 30 ++++++++++++++++++++++++++++++ localization/en_esx_drugs.sql | 10 ++++++++++ localization/es_esx_drugs.sql | 10 ++++++++++ 4 files changed, 52 insertions(+) create mode 100644 locales/es.lua create mode 100644 localization/en_esx_drugs.sql create mode 100644 localization/es_esx_drugs.sql diff --git a/__resource.lua b/__resource.lua index bd8d6c69..101f3a7a 100644 --- a/__resource.lua +++ b/__resource.lua @@ -8,6 +8,7 @@ server_scripts { '@mysql-async/lib/MySQL.lua', '@es_extended/locale.lua', 'locales/en.lua', + 'locales/es.lua', 'locales/fr.lua', 'locales/sv.lua', 'config.lua', @@ -17,6 +18,7 @@ server_scripts { client_scripts { '@es_extended/locale.lua', 'locales/en.lua', + 'locales/es.lua', 'locales/fr.lua', 'locales/sv.lua', 'config.lua', diff --git a/locales/es.lua b/locales/es.lua new file mode 100644 index 00000000..a25b83d6 --- /dev/null +++ b/locales/es.lua @@ -0,0 +1,30 @@ +Locales ['es'] = { + -- weed + ['weed_pickupprompt'] = 'pulsa ~INPUT_CONTEXT~ para recolectar ~g~Marijuana húmeda~s~.', + ['weed_inventoryfull'] = 'no puedes llevar más ~g~Marijuana húmeda~s~!', + ['weed_processprompt'] = 'pulsa ~INPUT_CONTEXT~ para ~g~secar la Marijuana~s~.', + ['weed_processingstarted'] = 'secando la ~g~Marijuana húmeda~s~...', + ['weed_processingfull'] = 'no puedes llevar más ~g~Marijuana~s~!', + ['weed_processingenough'] = 'necesitas ~b~3x~s~ ~g~Marijuana húmeda~s~.', + ['weed_processed'] = 'de ~b~3x~s~ ~g~Marijuana húmeda~s~ has obtenido ~b~1x~s~ ~g~Marijuana~s~', + ['weed_processingtoofar'] = 'el secado se ha ~r~cancelado~s~ por que has abandonado el área.', + + -- drug dealer + ['dealer_prompt'] = 'pulsa ~INPUT_CONTEXT~ para hablar con el ~r~Camello~s~.', + ['dealer_title'] = 'camello', + ['dealer_item'] = '$%s', + ['dealer_notenough'] = 'esa mierda no es cantidad suficiente para vender!', + ['dealer_sold'] = 'has vendido ~b~%sx~s~ ~y~%s~s~ por ~g~$%s~s~', + + -- license + ['license_title'] = 'necesitas un permiso para poder tratar con ese producto, puedes comprarlo aquí.', + ['license_no'] = 'no', + ['license_bought'] = 'has comprado ~b~%s~s~ por ~r~$%s~s~', + ['license_bought_fail'] = 'no puedes permitirte ~b~%s~s~!', + ['license_weed'] = 'permiso de cultivo de Marijuana', + + -- blips + ['blip_weedfield'] = 'plantación de Marijuana', + ['blip_weedprocessing'] = 'preparación de Marijuana', + ['blip_drugdealer'] = 'camello' +} diff --git a/localization/en_esx_drugs.sql b/localization/en_esx_drugs.sql new file mode 100644 index 00000000..fe2a3b18 --- /dev/null +++ b/localization/en_esx_drugs.sql @@ -0,0 +1,10 @@ +USE `essentialmode`; + +INSERT INTO `items` (`name`, `label`, `limit`, `rare`, `can_remove`) VALUES + ('cannabis', 'Cannabis', 40, 0, 1), + ('marijuana', 'Marijuana', 14, 0, 1) +; + +INSERT INTO `licenses` (`type`, `label`) VALUES + ('weed_processing', 'Weed Processing License') +; diff --git a/localization/es_esx_drugs.sql b/localization/es_esx_drugs.sql new file mode 100644 index 00000000..496d860a --- /dev/null +++ b/localization/es_esx_drugs.sql @@ -0,0 +1,10 @@ +USE `essentialmode`; + +INSERT INTO `items` (`name`, `label`, `limit`, `rare`, `can_remove`) VALUES + ('cannabis', 'Marijuana húmeda', 40, 0, 1), + ('marijuana', 'Marijuana', 14, 0, 1) +; + +INSERT INTO `licenses` (`type`, `label`) VALUES + ('weed_processing', 'permiso de cultivo de Marijuana') +; From a2daba053d85f8ffecad8db3f0cdd7ad39fbf181 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sun, 27 Oct 2019 00:40:50 +0200 Subject: [PATCH 53/66] use new esx carry limit code --- client/main.lua | 15 +--------- client/weed.lua | 21 ++++---------- localization/en_esx_drugs.sql | 6 ++-- localization/es_esx_drugs.sql | 6 ++-- server/main.lua | 52 +++++++++++++++-------------------- 5 files changed, 34 insertions(+), 66 deletions(-) diff --git a/client/main.lua b/client/main.lua index c7c00efd..c6ec9a38 100644 --- a/client/main.lua +++ b/client/main.lua @@ -1,15 +1,3 @@ -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 -} - ESX = nil local menuOpen = false local wasOpen = false @@ -37,7 +25,7 @@ Citizen.CreateThread(function() if not menuOpen then ESX.ShowHelpNotification(_U('dealer_prompt')) - if IsControlJustReleased(0, Keys['E']) then + if IsControlJustReleased(0, 38) then wasOpen = true OpenDrugShop() end @@ -163,7 +151,6 @@ end Citizen.CreateThread(function() for k,zone in pairs(Config.CircleZones) do - CreateBlipCircle(zone.coords, zone.name, zone.radius, zone.color, zone.sprite) end end) \ No newline at end of file diff --git a/client/weed.lua b/client/weed.lua index 41e48a56..78cfe74d 100644 --- a/client/weed.lua +++ b/client/weed.lua @@ -2,17 +2,13 @@ local spawnedWeeds = 0 local weedPlants = {} local isPickingUp, isProcessing = false, false - Citizen.CreateThread(function() while true do - Citizen.Wait(10) + Citizen.Wait(500) local coords = GetEntityCoords(PlayerPedId()) if GetDistanceBetweenCoords(coords, Config.CircleZones.WeedField.coords, true) < 50 then SpawnWeedPlants() - Citizen.Wait(500) - else - Citizen.Wait(500) end end end) @@ -28,8 +24,7 @@ Citizen.CreateThread(function() ESX.ShowHelpNotification(_U('weed_processprompt')) end - if IsControlJustReleased(0, Keys['E']) and not isProcessing then - + if IsControlJustReleased(0, 38) and not isProcessing then if Config.LicenseEnable then ESX.TriggerServerCallback('esx_license:checkLicense', function(hasProcessingLicense) if hasProcessingLicense then @@ -41,7 +36,6 @@ Citizen.CreateThread(function() else ProcessWeed() end - end else Citizen.Wait(500) @@ -74,6 +68,7 @@ end Citizen.CreateThread(function() while true do Citizen.Wait(0) + local playerPed = PlayerPedId() local coords = GetEntityCoords(playerPed) local nearbyObject, nearbyID @@ -85,16 +80,14 @@ Citizen.CreateThread(function() end if nearbyObject and IsPedOnFoot(playerPed) then - if not isPickingUp then ESX.ShowHelpNotification(_U('weed_pickupprompt')) end - if IsControlJustReleased(0, Keys['E']) and not isPickingUp then + if IsControlJustReleased(0, 38) and not isPickingUp then isPickingUp = true ESX.TriggerServerCallback('esx_drugs:canPickUp', function(canPickUp) - if canPickUp then TaskStartScenarioInPlace(playerPed, 'world_human_gardener_plant', 0, false) @@ -113,16 +106,12 @@ Citizen.CreateThread(function() end isPickingUp = false - end, 'cannabis') end - else Citizen.Wait(500) end - end - end) AddEventHandler('onResourceStop', function(resource) @@ -206,4 +195,4 @@ function GetCoordZ(x, y) end return 43.0 -end \ No newline at end of file +end diff --git a/localization/en_esx_drugs.sql b/localization/en_esx_drugs.sql index fe2a3b18..aa88673d 100644 --- a/localization/en_esx_drugs.sql +++ b/localization/en_esx_drugs.sql @@ -1,8 +1,8 @@ USE `essentialmode`; -INSERT INTO `items` (`name`, `label`, `limit`, `rare`, `can_remove`) VALUES - ('cannabis', 'Cannabis', 40, 0, 1), - ('marijuana', 'Marijuana', 14, 0, 1) +INSERT INTO `items` (`name`, `label`, `weight`, `rare`, `can_remove`) VALUES + ('cannabis', 'Cannabis', 3, 0, 1), + ('marijuana', 'Marijuana', 2, 0, 1) ; INSERT INTO `licenses` (`type`, `label`) VALUES diff --git a/localization/es_esx_drugs.sql b/localization/es_esx_drugs.sql index 496d860a..4c3bec8a 100644 --- a/localization/es_esx_drugs.sql +++ b/localization/es_esx_drugs.sql @@ -1,8 +1,8 @@ USE `essentialmode`; -INSERT INTO `items` (`name`, `label`, `limit`, `rare`, `can_remove`) VALUES - ('cannabis', 'Marijuana húmeda', 40, 0, 1), - ('marijuana', 'Marijuana', 14, 0, 1) +INSERT INTO `items` (`name`, `label`, `weight`, `rare`, `can_remove`) VALUES + ('cannabis', 'Marijuana húmeda', 3, 0, 1), + ('marijuana', 'Marijuana', 2, 0, 1) ; INSERT INTO `licenses` (`type`, `label`) VALUES diff --git a/server/main.lua b/server/main.lua index 44eded52..6a6fc240 100644 --- a/server/main.lua +++ b/server/main.lua @@ -15,7 +15,7 @@ AddEventHandler('esx_drugs:sellDrug', function(itemName, amount) end if xItem.count < amount then - TriggerClientEvent('esx:showNotification', source, _U('dealer_notenough')) + xPlayer.showNotification(_U('dealer_notenough')) return end @@ -28,26 +28,25 @@ AddEventHandler('esx_drugs:sellDrug', function(itemName, amount) end xPlayer.removeInventoryItem(xItem.name, amount) - - TriggerClientEvent('esx:showNotification', source, _U('dealer_sold', amount, xItem.label, ESX.Math.GroupDigits(price))) + xPlayer.showNotification(_U('dealer_sold', amount, xItem.label, ESX.Math.GroupDigits(price))) end) ESX.RegisterServerCallback('esx_drugs:buyLicense', function(source, cb, licenseName) local xPlayer = ESX.GetPlayerFromId(source) local license = Config.LicensePrices[licenseName] - if license == nil then - print(('esx_drugs: %s attempted to buy an invalid license!'):format(xPlayer.identifier)) - cb(false) - end - - if xPlayer.getMoney() >= license.price then - xPlayer.removeMoney(license.price) - - TriggerEvent('esx_license:addLicense', source, licenseName, function() - cb(true) - end) + if license then + if xPlayer.getMoney() >= license.price then + xPlayer.removeMoney(license.price) + + TriggerEvent('esx_license:addLicense', source, licenseName, function() + cb(true) + end) + else + cb(false) + end else + print(('esx_drugs: %s attempted to buy an invalid license!'):format(xPlayer.identifier)) cb(false) end end) @@ -55,24 +54,17 @@ end) RegisterServerEvent('esx_drugs:pickedUpCannabis') AddEventHandler('esx_drugs:pickedUpCannabis', function() local xPlayer = ESX.GetPlayerFromId(source) - local xItem = xPlayer.getInventoryItem('cannabis') - if xItem.limit ~= -1 and (xItem.count + 1) > xItem.limit then - TriggerClientEvent('esx:showNotification', _source, _U('weed_inventoryfull')) + if xPlayer.canCarryItem('cannabis', 1) then + xPlayer.showNotification(_U('weed_inventoryfull')) else - xPlayer.addInventoryItem(xItem.name, 1) + xPlayer.addInventoryItem('cannabis', 1) end end) ESX.RegisterServerCallback('esx_drugs:canPickUp', function(source, cb, item) local xPlayer = ESX.GetPlayerFromId(source) - local xItem = xPlayer.getInventoryItem(item) - - if xItem.limit ~= -1 and xItem.count >= xItem.limit then - cb(false) - else - cb(true) - end + cb(xPlayer.canCarryItem(item, 1)) end) RegisterServerEvent('esx_drugs:processCannabis') @@ -82,17 +74,17 @@ AddEventHandler('esx_drugs:processCannabis', function() playersProcessingCannabis[_source] = ESX.SetTimeout(Config.Delays.WeedProcessing, function() local xPlayer = ESX.GetPlayerFromId(_source) - local xCannabis, xMarijuana = xPlayer.getInventoryItem('cannabis'), xPlayer.getInventoryItem('marijuana') + local xCannabis = xPlayer.getInventoryItem('cannabis') - if xMarijuana.limit ~= -1 and (xMarijuana.count + 1) >= xMarijuana.limit then - TriggerClientEvent('esx:showNotification', _source, _U('weed_processingfull')) + if not xPlayer.canCarryItem('marijuana', 1) then + xPlayer.showNotification(_U('weed_processingfull')) elseif xCannabis.count < 3 then - TriggerClientEvent('esx:showNotification', _source, _U('weed_processingenough')) + xPlayer.showNotification(_U('weed_processingenough')) else xPlayer.removeInventoryItem('cannabis', 3) xPlayer.addInventoryItem('marijuana', 1) - TriggerClientEvent('esx:showNotification', _source, _U('weed_processed')) + xPlayer.showNotification(_U('weed_processed')) end playersProcessingCannabis[_source] = nil From a35a3b8b8486005a025dc306df1b5256d974d480 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Tue, 29 Oct 2019 20:45:50 +0100 Subject: [PATCH 54/66] Fixed statement --- server/main.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/main.lua b/server/main.lua index 6a6fc240..7edbbf2a 100644 --- a/server/main.lua +++ b/server/main.lua @@ -56,9 +56,9 @@ AddEventHandler('esx_drugs:pickedUpCannabis', function() local xPlayer = ESX.GetPlayerFromId(source) if xPlayer.canCarryItem('cannabis', 1) then - xPlayer.showNotification(_U('weed_inventoryfull')) - else xPlayer.addInventoryItem('cannabis', 1) + else + xPlayer.showNotification(_U('weed_inventoryfull')) end end) From 5d924d4b8ad7ebcda433267f7ad5953ce2f91199 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Wed, 15 Jan 2020 21:48:13 +0100 Subject: [PATCH 55/66] Use canSwapItem() test --- README.md | 2 +- server/main.lua | 34 ++++++++++++++++++---------------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index bb1588a3..0dd5146c 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ start esx_drugs ### License esx_drugs - drugs job -Copyright (C) 2015-2018 Jérémie N'gadi +Copyright (C) 2015-2020 Jérémie N'gadi This program Is free software: you can redistribute it And/Or modify it under the terms Of the GNU General Public License As published by the Free Software Foundation, either version 3 Of the License, Or (at your option) any later version. diff --git a/server/main.lua b/server/main.lua index 7edbbf2a..26c13db0 100644 --- a/server/main.lua +++ b/server/main.lua @@ -76,28 +76,30 @@ AddEventHandler('esx_drugs:processCannabis', function() local xPlayer = ESX.GetPlayerFromId(_source) local xCannabis = xPlayer.getInventoryItem('cannabis') - if not xPlayer.canCarryItem('marijuana', 1) then - xPlayer.showNotification(_U('weed_processingfull')) - elseif xCannabis.count < 3 then - xPlayer.showNotification(_U('weed_processingenough')) + if xCannabis.count > 3 then + if xPlayer.canSwapItem('cannabis', 3, 'marijuana', 1) then + xPlayer.removeInventoryItem('cannabis', 3) + xPlayer.addInventoryItem('marijuana', 1) + + xPlayer.showNotification(_U('weed_processed')) + else + xPlayer.showNotification(_U('weed_processingfull')) + playersProcessingCannabis[_source] = nil + end else - xPlayer.removeInventoryItem('cannabis', 3) - xPlayer.addInventoryItem('marijuana', 1) - - xPlayer.showNotification(_U('weed_processed')) + xPlayer.showNotification(_U('weed_processingenough')) + playersProcessingCannabis[_source] = nil end - - playersProcessingCannabis[_source] = nil end) else print(('esx_drugs: %s attempted to exploit weed processing!'):format(GetPlayerIdentifiers(source)[1])) end end) -function CancelProcessing(playerID) - if playersProcessingCannabis[playerID] then - ESX.ClearTimeout(playersProcessingCannabis[playerID]) - playersProcessingCannabis[playerID] = nil +function CancelProcessing(playerId) + if playersProcessingCannabis[playerId] then + ESX.ClearTimeout(playersProcessingCannabis[playerId]) + playersProcessingCannabis[playerId] = nil end end @@ -106,8 +108,8 @@ AddEventHandler('esx_drugs:cancelProcessing', function() CancelProcessing(source) end) -AddEventHandler('esx:playerDropped', function(playerID, reason) - CancelProcessing(playerID) +AddEventHandler('esx:playerDropped', function(playerId, reason) + CancelProcessing(playerId) end) RegisterServerEvent('esx:onPlayerDeath') From 7120de4ab5df55e4ccf11647366248da581ea457 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Wed, 15 Jan 2020 21:49:17 +0100 Subject: [PATCH 56/66] Update esx_drugs.sql --- esx_drugs.sql | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/esx_drugs.sql b/esx_drugs.sql index 6981b9e8..aa88673d 100644 --- a/esx_drugs.sql +++ b/esx_drugs.sql @@ -1,10 +1,10 @@ USE `essentialmode`; -INSERT INTO `items` (`name`, `label`, `limit`, `rare`, `can_remove`) VALUES - ('cannabis', 'Cannabis', 40, 0, 1), - ('marijuana', 'Marijuana', 14, 0, 1) +INSERT INTO `items` (`name`, `label`, `weight`, `rare`, `can_remove`) VALUES + ('cannabis', 'Cannabis', 3, 0, 1), + ('marijuana', 'Marijuana', 2, 0, 1) ; INSERT INTO `licenses` (`type`, `label`) VALUES ('weed_processing', 'Weed Processing License') -; \ No newline at end of file +; From 3c5a76eaff446dfe0c4eaed90daa9d1320a69b1d Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Wed, 15 Jan 2020 21:50:48 +0100 Subject: [PATCH 57/66] Update main.lua --- server/main.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/main.lua b/server/main.lua index 26c13db0..49b9d9b6 100644 --- a/server/main.lua +++ b/server/main.lua @@ -38,7 +38,7 @@ ESX.RegisterServerCallback('esx_drugs:buyLicense', function(source, cb, licenseN if license then if xPlayer.getMoney() >= license.price then xPlayer.removeMoney(license.price) - + TriggerEvent('esx_license:addLicense', source, licenseName, function() cb(true) end) @@ -80,16 +80,16 @@ AddEventHandler('esx_drugs:processCannabis', function() if xPlayer.canSwapItem('cannabis', 3, 'marijuana', 1) then xPlayer.removeInventoryItem('cannabis', 3) xPlayer.addInventoryItem('marijuana', 1) - + xPlayer.showNotification(_U('weed_processed')) else xPlayer.showNotification(_U('weed_processingfull')) - playersProcessingCannabis[_source] = nil end else xPlayer.showNotification(_U('weed_processingenough')) - playersProcessingCannabis[_source] = nil end + + playersProcessingCannabis[_source] = nil end) else print(('esx_drugs: %s attempted to exploit weed processing!'):format(GetPlayerIdentifiers(source)[1])) From ee42aca4d8e3a65880f583136fcaf6c0094f8e28 Mon Sep 17 00:00:00 2001 From: rex2630 Date: Sun, 19 Jan 2020 17:03:28 +0100 Subject: [PATCH 58/66] Replace __resource.lua with fxmanifest.lua --- __resource.lua => fxmanifest.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) rename __resource.lua => fxmanifest.lua (87%) diff --git a/__resource.lua b/fxmanifest.lua similarity index 87% rename from __resource.lua rename to fxmanifest.lua index 101f3a7a..88bae9ed 100644 --- a/__resource.lua +++ b/fxmanifest.lua @@ -1,4 +1,6 @@ -resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937' +fx_version 'adamant' + +game 'gta5' description 'ESX Drugs' From 87801b9385d9e663c304cf1e1103bd8f19e05bc1 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Tue, 14 Apr 2020 16:50:11 +0200 Subject: [PATCH 59/66] Latest ESX code --- esx_drugs.sql | 2 +- localization/en_esx_drugs.sql | 2 +- localization/es_esx_drugs.sql | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/esx_drugs.sql b/esx_drugs.sql index aa88673d..cae56632 100644 --- a/esx_drugs.sql +++ b/esx_drugs.sql @@ -1,4 +1,4 @@ -USE `essentialmode`; +USE `es_extended`; INSERT INTO `items` (`name`, `label`, `weight`, `rare`, `can_remove`) VALUES ('cannabis', 'Cannabis', 3, 0, 1), diff --git a/localization/en_esx_drugs.sql b/localization/en_esx_drugs.sql index aa88673d..cae56632 100644 --- a/localization/en_esx_drugs.sql +++ b/localization/en_esx_drugs.sql @@ -1,4 +1,4 @@ -USE `essentialmode`; +USE `es_extended`; INSERT INTO `items` (`name`, `label`, `weight`, `rare`, `can_remove`) VALUES ('cannabis', 'Cannabis', 3, 0, 1), diff --git a/localization/es_esx_drugs.sql b/localization/es_esx_drugs.sql index 4c3bec8a..ea3b17e3 100644 --- a/localization/es_esx_drugs.sql +++ b/localization/es_esx_drugs.sql @@ -1,4 +1,4 @@ -USE `essentialmode`; +USE `es_extended`; INSERT INTO `items` (`name`, `label`, `weight`, `rare`, `can_remove`) VALUES ('cannabis', 'Marijuana húmeda', 3, 0, 1), From 547c8a3365b8d59bf6d058fdae958a6fedd29c5e Mon Sep 17 00:00:00 2001 From: Rikydc01 <49121547+Rikydc01@users.noreply.github.com> Date: Mon, 6 Jul 2020 21:06:02 +0200 Subject: [PATCH 60/66] modified processing weed (#126) * modified processing weed now you can process all the weed by pressing E * cleaned code --- client/weed.lua | 16 +++++++---- config.lua | 8 +++--- locales/en.lua | 1 + server/main.lua | 73 ++++++++++++++++++++++++++++++++++++------------- 4 files changed, 70 insertions(+), 28 deletions(-) diff --git a/client/weed.lua b/client/weed.lua index 78cfe74d..ec462ef1 100644 --- a/client/weed.lua +++ b/client/weed.lua @@ -34,7 +34,10 @@ Citizen.CreateThread(function() end end, GetPlayerServerId(PlayerId()), 'weed_processing') else - ProcessWeed() + ESX.TriggerServerCallback('esx_drugs:cannabis_count', function(xCannabis) + ProcessWeed(xCannabis) + end) + end end else @@ -43,12 +46,14 @@ Citizen.CreateThread(function() end end) -function ProcessWeed() +function ProcessWeed(xCannabis) isProcessing = true - ESX.ShowNotification(_U('weed_processingstarted')) TriggerServerEvent('esx_drugs:processCannabis') - local timeLeft = Config.Delays.WeedProcessing / 1000 + if(xCannabis<3) then + xCannabis=0 + end + local timeLeft = (Config.Delays.WeedProcessing * xCannabis) / 1000 local playerPed = PlayerPedId() while timeLeft > 0 do @@ -58,6 +63,7 @@ function ProcessWeed() if GetDistanceBetweenCoords(GetEntityCoords(playerPed), Config.CircleZones.WeedProcessing.coords, false) > 4 then ESX.ShowNotification(_U('weed_processingtoofar')) TriggerServerEvent('esx_drugs:cancelProcessing') + TriggerServerEvent('esx_drugs:outofbound') break end end @@ -184,7 +190,7 @@ function GenerateWeedCoords() end function GetCoordZ(x, y) - local groundCheckHeights = { 40.0, 41.0, 42.0, 43.0, 44.0, 45.0, 46.0, 47.0, 48.0, 49.0, 50.0 } + local groundCheckHeights = { 48.0, 49.0, 50.0, 51.0, 52.0, 53.0, 54.0, 55.0, 56.0, 57.0, 58.0 } for i, height in ipairs(groundCheckHeights) do local foundGround, z = GetGroundZFor_3dCoord(x, y, height) diff --git a/config.lua b/config.lua index dfb500ae..15ea4251 100644 --- a/config.lua +++ b/config.lua @@ -3,7 +3,7 @@ Config = {} Config.Locale = 'en' Config.Delays = { - WeedProcessing = 1000 * 10 + WeedProcessing = 1000 * 7 } Config.DrugDealerItems = { @@ -19,8 +19,8 @@ Config.LicensePrices = { Config.GiveBlack = true -- give black money? if disabled it'll give regular cash. Config.CircleZones = { - WeedField = {coords = vector3(310.91, 4290.87, 45.15), name = _U('blip_weedfield'), color = 25, sprite = 496, radius = 100.0}, - WeedProcessing = {coords = vector3(2329.02, 2571.29, 46.68), name = _U('blip_weedprocessing'), color = 25, sprite = 496, radius = 100.0}, + WeedField = {coords = vector3(2220.72, 5582.52, 53.81), name = _U('blip_weedfield'), color = 25, sprite = 496, radius = 100.0}, + WeedProcessing = {coords = vector3(2329.02, 2571.29, 46.68), name = _U('blip_weedprocessing'), color = 25, sprite = 496}, - DrugDealer = {coords = vector3(-1172.02, -1571.98, 4.66), name = _U('blip_drugdealer'), color = 6, sprite = 378, radius = 25.0}, + DrugDealer = {coords = vector3(-1172.02, -1571.98, 4.66), name = _U('blip_drugdealer'), color = 6, sprite = 378}, } \ No newline at end of file diff --git a/locales/en.lua b/locales/en.lua index 9d644700..17994079 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -1,6 +1,7 @@ Locales ['en'] = { -- weed ['weed_pickupprompt'] = 'press ~INPUT_CONTEXT~ to harvest the ~g~Cannabis~s~ plant.', + ['weed_quitprocess'] = 'press ~INPUT_CONTEXT~ to stop ~g~Process Cannabis~s~.', ['weed_inventoryfull'] = 'you do not have any more inventory space for ~g~Cannabis~s~.', ['weed_processprompt'] = 'press ~INPUT_CONTEXT~ to start ~g~Process Cannabis~s~.', ['weed_processingstarted'] = 'processing ~g~Cannabis~s~ into ~g~Marijuana~s~...', diff --git a/server/main.lua b/server/main.lua index 49b9d9b6..72e9472f 100644 --- a/server/main.lua +++ b/server/main.lua @@ -1,5 +1,7 @@ ESX = nil local playersProcessingCannabis = {} +local outofbound = true +local alive = true TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) @@ -54,9 +56,10 @@ end) RegisterServerEvent('esx_drugs:pickedUpCannabis') AddEventHandler('esx_drugs:pickedUpCannabis', function() local xPlayer = ESX.GetPlayerFromId(source) + local cime = math.random(5,10) - if xPlayer.canCarryItem('cannabis', 1) then - xPlayer.addInventoryItem('cannabis', 1) + if xPlayer.canCarryItem('cannabis', cime) then + xPlayer.addInventoryItem('cannabis', cime) else xPlayer.showNotification(_U('weed_inventoryfull')) end @@ -67,30 +70,62 @@ ESX.RegisterServerCallback('esx_drugs:canPickUp', function(source, cb, item) cb(xPlayer.canCarryItem(item, 1)) end) +RegisterServerEvent('esx_drugs:outofbound') +AddEventHandler('esx_drugs:outofbound', function() + outofbound = true +end) + +RegisterServerEvent('esx_drugs:quitprocess') +AddEventHandler('esx_drugs:quitprocess', function() + can = false +end) + +ESX.RegisterServerCallback('esx_drugs:cannabis_count', function(source, cb) + local xPlayer = ESX.GetPlayerFromId(source) + local xCannabis = xPlayer.getInventoryItem('cannabis').count + cb(xCannabis) +end) + RegisterServerEvent('esx_drugs:processCannabis') AddEventHandler('esx_drugs:processCannabis', function() if not playersProcessingCannabis[source] then local _source = source + local xPlayer = ESX.GetPlayerFromId(_source) + local xCannabis = xPlayer.getInventoryItem('cannabis') + TriggerClientEvent('esx_drugs:getPlayer',xCannabis.count,_source) + local can = true + outofbound = false + if xCannabis.count >=3 then + while outofbound == false and can and GetEntityHealth(GetPlayerPed(_source))>0 do + if playersProcessingCannabis[_source] == nil then + playersProcessingCannabis[_source] = ESX.SetTimeout(Config.Delays.WeedProcessing , function() + if xCannabis.count >= 3 then + if xPlayer.canSwapItem('cannabis', 3, 'marijuana', 1) then + xPlayer.removeInventoryItem('cannabis', 3) + xPlayer.addInventoryItem('marijuana', 1) + xPlayer.showNotification(_U('weed_processed')) + else + can = false + xPlayer.showNotification(_U('weed_processingfull')) + TriggerEvent('esx_drugs:cancelProcessing') + end + else + can = false + xPlayer.showNotification(_U('weed_processingenough')) + TriggerEvent('esx_drugs:cancelProcessing') + end - playersProcessingCannabis[_source] = ESX.SetTimeout(Config.Delays.WeedProcessing, function() - local xPlayer = ESX.GetPlayerFromId(_source) - local xCannabis = xPlayer.getInventoryItem('cannabis') - - if xCannabis.count > 3 then - if xPlayer.canSwapItem('cannabis', 3, 'marijuana', 1) then - xPlayer.removeInventoryItem('cannabis', 3) - xPlayer.addInventoryItem('marijuana', 1) - - xPlayer.showNotification(_U('weed_processed')) + playersProcessingCannabis[_source] = nil + end) else - xPlayer.showNotification(_U('weed_processingfull')) - end - else - xPlayer.showNotification(_U('weed_processingenough')) + Wait(Config.Delays.WeedProcessing) + end end - - playersProcessingCannabis[_source] = nil - end) + else + xPlayer.showNotification(_U('weed_processingenough')) + TriggerEvent('esx_drugs:cancelProcessing') + end + else print(('esx_drugs: %s attempted to exploit weed processing!'):format(GetPlayerIdentifiers(source)[1])) end From b9977d7c6da8ed36d368898b26d2f09b80c2e8f8 Mon Sep 17 00:00:00 2001 From: Kjerne <59027271+Kjerne@users.noreply.github.com> Date: Mon, 6 Jul 2020 21:07:08 +0200 Subject: [PATCH 61/66] Danish translation (#118) Co-authored-by: kevi2796 <59027271+kevi2796@users.noreply.github.com> --- locales/dk.lua | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 locales/dk.lua diff --git a/locales/dk.lua b/locales/dk.lua new file mode 100644 index 00000000..b74c3dbc --- /dev/null +++ b/locales/dk.lua @@ -0,0 +1,30 @@ +Locales ['dk'] = { + -- weed + ['weed_pickupprompt'] = 'tryk ~INPUT_CONTEXT~ for at høste ~g~Cannabis~s~ planten.', + ['weed_inventoryfull'] = 'du har ikke mere plads i dit inventory til ~g~Cannabis~s~.', + ['weed_processprompt'] = 'tryk ~INPUT_CONTEXT~ for at starte ~g~Behandling af Cannabis~s~.', + ['weed_processingstarted'] = 'laver ~g~Cannabis~s~ om til ~g~Marihuana~s~...', + ['weed_processingfull'] = 'behandling ~r~annulleret~s~ på grund af dit inventory er fuldt!', + ['weed_processingenough'] = 'du skal have ~b2 stks~s~ ~g~Cannabis~s~ for at lave dem om.', + ['weed_processed'] = 'du har lavet ~b~2 stks~s~ ~g~Cannabis~s~ om til ~b~1 stks~s~ ~g~Marihuana~s~', + ['weed_processingtoofar'] = 'din behandling er blevet ~r~annulleret~s~ fordi du kom ud af rækkevidde.', + + -- drug dealer + ['dealer_prompt'] = 'tryk ~INPUT_CONTEXT~ for at snakke med ~r~Pusheren~s~.', + ['dealer_title'] = 'Pusher', + ['dealer_item'] = '$%s', + ['dealer_notenough'] = 'Du har ikke nok til at sælge!', + ['dealer_sold'] = 'Du har solgt ~b~%sx~s~ ~y~%s~s~ for ~g~$%s~s~', + + -- license + ['license_title'] = 'Du er forpligtet til at eje et behandlingslicens for at lave stoffer, det kan købes her.', + ['license_no'] = 'nej', + ['license_bought'] = 'du købte ~b~%s~s~ for ~r~$%s~s~', + ['license_bought_fail'] = 'du har ikke råd til en ~b~%s~s~!', + ['license_weed'] = 'Cannabis behandlings licens', + + -- blips + ['blip_weedfield'] = 'Cannabis Mark', + ['blip_weedprocessing'] = 'Cannabis Behandlingscenter', + ['blip_drugdealer'] = 'Pusher', +} From 17f83e2392876135bb6ab6d77792a3328845e68e Mon Sep 17 00:00:00 2001 From: Gabriel Julio Date: Sun, 2 Aug 2020 19:56:13 -0300 Subject: [PATCH 62/66] Created translation 'br' Added translation 'br' (brazilian portuguese) --- locales/br.lua | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 locales/br.lua diff --git a/locales/br.lua b/locales/br.lua new file mode 100644 index 00000000..fdd09309 --- /dev/null +++ b/locales/br.lua @@ -0,0 +1,31 @@ +Locales ['br'] = { + -- weed + ['weed_pickupprompt'] = 'aperte ~INPUT_CONTEXT~ para colher a planta ~g~Cannabis~s~.', + ['weed_quitprocess'] = 'aperte ~INPUT_CONTEXT~ para parar ~g~Processar Cannabis~s~.', + ['weed_inventoryfull'] = 'você não tem mais espaço no inventário para ~g~Cannabis~s~.', + ['weed_processprompt'] = 'aperte ~INPUT_CONTEXT~ para começar ~g~Processar Cannabis~s~.', + ['weed_processingstarted'] = 'processando ~g~Cannabis~s~ em ~g~Maconha~s~...', + ['weed_processingfull'] = 'processando ~r~cancelado~s~ porque o inventário está cheio!', + ['weed_processingenough'] = 'você prescisa ter ~b~3x~s~ ~g~Cannabis~s~ para poder processar.', + ['weed_processed'] = 'você processou ~b~3x~s~ ~g~Cannabis~s~ para ~b~1x~s~ ~g~Maconha~s~', + ['weed_processingtoofar'] = 'o processamento foi ~r~cancelado~s~ porque você abandonou a área.', + + -- drug dealer + ['dealer_prompt'] = aperte ~INPUT_CONTEXT~ para falar com o ~r~Drug Dealer~s~.', + ['dealer_title'] = 'traficante de drogas', + ['dealer_item'] = '$%s', + ['dealer_notenough'] = 'você não tem o suficiente disso para vender!', + ['dealer_sold'] = 'você vendeu ~b~%sx~s~ ~y~%s~s~ para~g~$%s~s~', + + -- license + ['license_title'] = 'você precisa tirar uma Licença de Processamento de Ervas para processar este produto, a liçenca pode ser comprada aqui.', + ['license_no'] = 'não', + ['license_bought'] = 'você comprou o(a) ~b~%s~s~ para ~r~$%s~s~', + ['license_bought_fail'] = 'você não pode pagar um ~b~%s~s~!', + ['license_weed'] = 'Licença de Processamento de Ervas', + + -- blips + ['blip_weedfield'] = 'campo de ervas', + ['blip_weedprocessing'] = 'Processamento de ervas', + ['blip_drugdealer'] = 'traficante de drogas', +} From e80c0e8736f9cb3f6e12cecc5193acd35796d28b Mon Sep 17 00:00:00 2001 From: Gabriel Julio Date: Sun, 2 Aug 2020 20:01:37 -0300 Subject: [PATCH 63/66] Update README.md Added missing requirement *esx_license* --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0dd5146c..99c4267a 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,10 @@ Adds the well-known drugs for the people who want to make quick money. Weed Field require you to run around and harvest weed plants, process and then sell at the beach of San Andreas! +## Requirements +* ESX License Support + * [esx_license](https://github.com/ESX-Org/esx_license) + ## Download & Installation ### Using [fvm](https://github.com/qlaffont/fvm-installer) @@ -37,4 +41,4 @@ This program Is free software: you can redistribute it And/Or modify it under th This program Is distributed In the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty Of MERCHANTABILITY Or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License For more details. -You should have received a copy Of the GNU General Public License along with this program. If Not, see http://www.gnu.org/licenses/. \ No newline at end of file +You should have received a copy Of the GNU General Public License along with this program. If Not, see http://www.gnu.org/licenses/. From 584f53964d628249a9e91f53e991313cfd0710ce Mon Sep 17 00:00:00 2001 From: Gabriel Julio Date: Sun, 2 Aug 2020 20:18:00 -0300 Subject: [PATCH 64/66] Update fxmanifest.lua Added 'br.lua' to fxmanifest.lua --- fxmanifest.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fxmanifest.lua b/fxmanifest.lua index 88bae9ed..b6cd44d3 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -13,6 +13,7 @@ server_scripts { 'locales/es.lua', 'locales/fr.lua', 'locales/sv.lua', + 'locales/br.lua', 'config.lua', 'server/main.lua' } @@ -23,6 +24,7 @@ client_scripts { 'locales/es.lua', 'locales/fr.lua', 'locales/sv.lua', + 'locales/br.lua', 'config.lua', 'client/main.lua', 'client/weed.lua' From 0cb3af3bcf2794c7f1b716300947c8883d2982fc Mon Sep 17 00:00:00 2001 From: Gabriel Julio Date: Sun, 2 Aug 2020 20:31:58 -0300 Subject: [PATCH 65/66] Update br.lua missing single quote on line 14. --- locales/br.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locales/br.lua b/locales/br.lua index fdd09309..da61c20c 100644 --- a/locales/br.lua +++ b/locales/br.lua @@ -11,7 +11,7 @@ Locales ['br'] = { ['weed_processingtoofar'] = 'o processamento foi ~r~cancelado~s~ porque você abandonou a área.', -- drug dealer - ['dealer_prompt'] = aperte ~INPUT_CONTEXT~ para falar com o ~r~Drug Dealer~s~.', + ['dealer_prompt'] = 'aperte ~INPUT_CONTEXT~ para falar com o ~r~Drug Dealer~s~.', ['dealer_title'] = 'traficante de drogas', ['dealer_item'] = '$%s', ['dealer_notenough'] = 'você não tem o suficiente disso para vender!', From 06c51025646a601dfd662d5950b9cc67629d41cd Mon Sep 17 00:00:00 2001 From: Christopher Date: Sun, 6 Dec 2020 15:38:33 +0100 Subject: [PATCH 66/66] fix(drugs/server): removing check for health, becuause why the fuck --- client/weed.lua | 8 ++++---- server/main.lua | 15 +++++++-------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/client/weed.lua b/client/weed.lua index ec462ef1..658817fc 100644 --- a/client/weed.lua +++ b/client/weed.lua @@ -49,11 +49,11 @@ end) function ProcessWeed(xCannabis) isProcessing = true ESX.ShowNotification(_U('weed_processingstarted')) - TriggerServerEvent('esx_drugs:processCannabis') - if(xCannabis<3) then - xCannabis=0 + TriggerServerEvent('esx_drugs:processCannabis') + if(xCannabis <= 3) then + xCannabis = 0 end - local timeLeft = (Config.Delays.WeedProcessing * xCannabis) / 1000 + local timeLeft = (Config.Delays.WeedProcessing * xCannabis) / 1000 local playerPed = PlayerPedId() while timeLeft > 0 do diff --git a/server/main.lua b/server/main.lua index 72e9472f..10730cf2 100644 --- a/server/main.lua +++ b/server/main.lua @@ -88,21 +88,20 @@ end) RegisterServerEvent('esx_drugs:processCannabis') AddEventHandler('esx_drugs:processCannabis', function() - if not playersProcessingCannabis[source] then + if not playersProcessingCannabis[source] then local _source = source local xPlayer = ESX.GetPlayerFromId(_source) local xCannabis = xPlayer.getInventoryItem('cannabis') - TriggerClientEvent('esx_drugs:getPlayer',xCannabis.count,_source) local can = true outofbound = false - if xCannabis.count >=3 then - while outofbound == false and can and GetEntityHealth(GetPlayerPed(_source))>0 do + if xCannabis.count >= 3 then + while outofbound == false and can do if playersProcessingCannabis[_source] == nil then playersProcessingCannabis[_source] = ESX.SetTimeout(Config.Delays.WeedProcessing , function() - if xCannabis.count >= 3 then - if xPlayer.canSwapItem('cannabis', 3, 'marijuana', 1) then - xPlayer.removeInventoryItem('cannabis', 3) - xPlayer.addInventoryItem('marijuana', 1) + if xCannabis.count >= 3 then + if xPlayer.canSwapItem('cannabis', 3, 'marijuana', 1) then + xPlayer.removeInventoryItem('cannabis', 3) + xPlayer.addInventoryItem('marijuana', 1) xPlayer.showNotification(_U('weed_processed')) else can = false