Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
DoPeMan17 authored Mar 30, 2020
1 parent d3b2241 commit 64759d7
Show file tree
Hide file tree
Showing 13 changed files with 361 additions and 150 deletions.
4 changes: 2 additions & 2 deletions __resource.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937'

description 'ESX Drugs by DoPeMan'
description 'ESX Illegal'

version '1.0.0'
version '2.0.0'

server_scripts {
'@mysql-async/lib/MySQL.lua',
Expand Down
53 changes: 33 additions & 20 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,15 @@ Citizen.CreateThread(function()
OpenDrugShop()
end
else
Citizen.Wait(0)
Citizen.Wait(500)
end
else
--[[else
if wasOpen then
wasOpen = false
ESX.UI.Menu.CloseAll()
end
Citizen.Wait(0)
Citizen.Wait(500)--]]
end
end
end)
Expand Down Expand Up @@ -139,24 +140,36 @@ function OpenBuyLicenseMenu(licenseName)
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)
function CreateBlipCircle(coords, text, radius, color, sprite)

if Config.EnableMapsBlimps then
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
end

Citizen.CreateThread(function()
for k,zone in pairs(Config.CircleZones) do
CreateBlipCircle(zone.coords, zone.name, zone.radius, zone.color, zone.sprite)
if Config.EnableMapsBlimps then
for k,zone in pairs(Config.CircleZones) do
if zone.enabled then
CreateBlipCircle(zone.blimpcoords, zone.name, zone.radius, zone.color, zone.sprite)
end
end
end
end)
44 changes: 23 additions & 21 deletions config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ Config.ChemicalsConvertionItems = {
lsa = 0,
}

Config.ChemicalsLicenseEnabled = false --Will Enable or Disable the need for a Chemicals License.
Config.MoneyWashLicenseEnabled = false --Will Enable or Disable the need for a MoneyWash License.
Config.ChemicalsLicenseEnabled = true --Will Enable or Disable the need for a Chemicals License.
Config.MoneyWashLicenseEnabled = true --Will Enable or Disable the need for a MoneyWash License.

Config.LicensePrices = {
weed_processing = {label = _U('license_weed'), price = 15000}
Expand All @@ -40,39 +40,41 @@ Config.Licenses = {

Config.GiveBlack = true -- give black money? if disabled it'll give regular cash.

Config.EnableMapsBlimps = true -- Enables the blimps on the map.

Config.CircleZones = {
--Weed
WeedField = {coords = vector3(2224.64, 5577.03, 53.85), name = _U('blip_WeedFarm'), color = 25, sprite = 496, radius = 100.0},
WeedProcessing = {coords = vector3(2329.12, 2571.86, 46.68), name = _U('blip_weedprocessing'), color = 25, sprite = 496, radius = 100.0},
WeedField = {coords = vector3(2224.64, 5577.03, 53.85), blimpcoords = vector3(2224.64, 5577.03, 53.85), name = _U('blip_weedfield'), color = 25, sprite = 496, radius = 0, enabled = true},
WeedProcessing = {coords = vector3(1035.86, -3205.20, -38.17), blimpcoords = vector3(-1127.86, 2708.03, 18.8), name = _U('blip_weedprocessing'), color = 25, sprite = 496, radius = 0.0, enabled = true},

--meth
MethProcessing = {coords = vector3(1390.33, 3608.5, 38.94), name = _U('blip_methprocessing'), color = 25, sprite = 496, radius = 0.0},
HydrochloricAcidFarm = {coords = vector3(2724.12, 1583.03, 24.5), name = _U('blip_HydrochloricAcidFarm'), color = 25, sprite = 496, radius = 7.0},
SulfuricAcidFarm = {coords = vector3(3333.34, 5160.22, 18.31), name = _U('blip_SulfuricAcidFarm'), color = 25, sprite = 496, radius = 5.0},
SodiumHydroxideFarm = {coords = vector3(3617.04, 3738.73, 28.69), name = _U('blip_SodiumHydroxideFarm'), color = 25, sprite = 496, radius = 7.0},
MethProcessing = {coords = vector3(1007.27, -3197.93, -38.99), blimpcoords = vector3(1454.78, -1651.42, 66.99), name = _U('blip_methprocessing'), color = 5, sprite = 51, radius = 0.0, enabled = true},
HydrochloricAcidFarm = {coords = vector3(2724.12, 1583.03, 24.5), blimpcoords = vector3(2724.12, 1583.03, 24.5), name = _U('blip_HydrochloricAcidFarm'), color = 5, sprite = 51, radius = 0.0, enabled = true},
SulfuricAcidFarm = {coords = vector3(3333.34, 5160.22, 18.31), blimpcoords = vector3(3333.34, 5160.22, 18.31), name = _U('blip_SulfuricAcidFarm'), color = 5, sprite = 51, radius = 0.0, enabled = true},
SodiumHydroxideFarm = {coords = vector3(3617.04, 3738.73, 28.69), blimpcoords = vector3(3617.04, 3738.73, 28.69), name = _U('blip_SodiumHydroxideFarm'), color = 5, sprite = 51, radius = 0.0, enabled = true},

--Chemicals
ChemicalsField = {coords = vector3(817.46, -3192.84, 5.9), name = _U('blip_ChemicalsFarm'), color = 25, sprite = 496, radius = 0.0},
ChemicalsConvertionMenu = {coords = vector3(3718.8, 4533.45, 21.67), name = _U('blip_ChemicalsProcessing'), color = 25, sprite = 496, radius = 0.0},
ChemicalsField = {coords = vector3(817.46, -3192.84, 5.9), blimpcoords = vector3(817.46, -3192.84, 5.9), name = _U('blip_ChemicalsFarm'), color = 3, sprite = 499, radius = 0.0, enabled = true},
ChemicalsConvertionMenu = {coords = vector3(3718.8, 4533.45, 21.67), blimpcoords = vector3(3718.8, 4533.45, 21.67), name = _U('blip_ChemicalsProcessing'), color = 3, sprite = 499, radius = 0.0, enabled = true},

--Coke
CokeField = {coords = vector3(-310.43, 2496.34, 76.60), name = _U('blip_CokeFarm'), color = 25, sprite = 496, radius = 20.0},
CokeProcessing = {coords = vector3(1689.14, 3291.36, 41.15), name = _U('blip_Cokeprocessing'),color = 25, sprite = 496, radius = 20.0},
CokeField = {coords = vector3(-310.43, 2496.34, 76.60), blimpcoords = vector3(-310.43, 2496.34, 76.60), name = _U('blip_CokeFarm'), color = 4, sprite = 501, radius = 0.0, enabled = true},
CokeProcessing = {coords = vector3(1090.00, -3194.93, -38.99), blimpcoords = vector3(143.66, -1656.21, 29.33), name = _U('blip_Cokeprocessing'),color = 4, sprite = 501, radius = 0.0, enabled = true},

--LSD
lsdProcessing = {coords = vector3(91.26, 3749.31, 40.77), name = _U('blip_lsdprocessing'),color = 25, sprite = 496, radius = 20.0},
thionylchlorideProcessing = {coords = vector3(1903.98, 4922.70, 48.16), name = _U('blip_lsdprocessing'),color = 25, sprite = 496, radius = 20.0},
lsdProcessing = {coords = vector3(91.26, 3749.31, 40.77), blimpcoords = vector3(91.26, 3749.31, 40.77), name = _U('blip_lsdprocessing'),color = 12, sprite = 364, radius = 0.0, enabled = true},
thionylchlorideProcessing = {coords = vector3(1903.98, 4922.70, 48.16), blimpcoords = vector3(1903.98, 4922.70, 48.16), name = _U('blip_thionylchlorideprocessing'),color = 12, sprite = 364, radius = 0.0, enabled = true},

--Heroin
HeroinField = {coords = vector3(16.34, 6875.94, 12.64), name = _U('blip_heroinfield'), color = 25, sprite = 496, radius = 20},
HeroinProcessing = {coords = vector3(-65.43, 6243.36, 31.08), name = _U('blip_heroinprocessing'), color = 25, sprite = 496, radius = 100.0},
HeroinField = {coords = vector3(16.34, 6875.94, 12.64), blimpcoords = vector3(16.34, 6875.94, 12.64), name = _U('blip_heroinfield'), color = 7, sprite = 497, radius = 0, enabled = true},
HeroinProcessing = {coords = vector3(-62.15, 6391.40, 31.49), blimpcoords = vector3(-62.15, 6391.40, 31.49), name = _U('blip_heroinprocessing'), color = 7, sprite = 497, radius = 0.0, enabled = true},

--DrugDealer
DrugDealer = {coords = vector3(-1172.02, -1571.98, 4.66), name = _U('blip_drugdealer'), color = 6, sprite = 378, radius = 25.0},

--License
LicenseShop = {coords = vector3(707.17, -962.5, 30.4), name = _U('blip_lsdprocessing'),color = 25, sprite = 496, radius = 20.0},
LicenseShop = {coords = vector3(707.17, -962.5, 30.4), blimpcoords = vector3(707.17, -962.5, 30.4), name = _U('blip_licenseshop'),color = 9, sprite = 498, radius = 0.0, enabled = true},

--DrugDealer
DrugDealer = {coords = vector3(-1172.02, -1571.98, 4.66), blimpcoords = vector3(-1172.02, -1571.98, 4.66), name = _U('blip_drugdealer'), color = 6, sprite = 378, radius = 0.0, enabled = true},

--MoneyWash
MoneyWash = {coords = vector3(8.84, -1103.8, -29.8), name = _U('blip_drugdealer'), color = 6, sprite = 378, radius = 25.0},
MoneyWash = {coords = vector3(1119.87, -3195.44, -39.40), blimpcoords = vector3(48.83, 6305.34, 31.36), name = _U('blip_moneywash'), color = 1, sprite = 500, radius = 0.0, enabled = true},
}
24 changes: 24 additions & 0 deletions esx_illegal.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
USE `essentialmode`;

INSERT INTO `items` (`name`, `label`, `weight`, `rare`, `can_remove`) VALUES
('cannabis', 'Cannabis', 3, 0, 1),
('marijuana', 'Marijuana', 2, 0, 1),
('chemicals', 'Chemicals', 0.5, 0, 1),
('chemicalslisence', 'Chemicals license', 0, 0, 1),
('moneywash', 'MoneyWash License', 0, 0, 1),
('coca_leaf', 'Coca Leaf', 3, 0, 1),
('coke', 'Coke', 3, 0, 1),
('poppyresin', 'Poppy Resin', 0.5, 0, 1),
('heroin', 'Heroin', 2, 0, 1),
('lsa', 'LSA', 1, 0, 1),
('lsd', 'LSD', 1, 0, 1),
('meth', 'Meth', 3, 0, 1),
('hydrochloric_acid', 'HydroChloric Acid', 2, 0, 1),
('sodium_hydroxide', 'Sodium Hydroxide', 2, 0, 1),
('sulfuric_acid', 'Sulfuric Acid', 2, 0, 1),
('thionyl_chloride', 'Thionyl Chloride', 0.5, 0, 1)
;

INSERT INTO `licenses` (`type`, `label`) VALUES
('weed_processing', 'Weed Processing License')
;
32 changes: 17 additions & 15 deletions locales/en.lua
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,22 @@ Locales ['en'] = {
['moneywash_prompt'] = 'press ~INPUT_CONTEXT~ to open the ~r~MoneyWash~s~.',

-- blips
['blip_weedfield'] = 'weed Field',
['blip_weedprocessing'] = 'weed Processing',
['blip_methfield'] = 'meth Field',
['blip_methprocessing'] = 'meth Processing',
['blip_drugdealer'] = 'drug Dealer',
['blip_ChemicalsProcessing'] = 'Chemische Verarbeitung',
['blip_ChemicalsFarm'] = 'Chemiefarm',
['blip_CokeFarm'] = 'Koks Farm',
['blip_Cokeprocessing'] = 'Koks Herstellung',
['blip_herionfield'] = 'Heroin Farm',
['blip_heroinprocessing'] = 'Heroin Herstellung',
['blip_HydrochloricAcidFarm'] = 'Salzsäure Bauernhof',
['blip_lsdprocessing'] = 'LSD Herstellung',
['blip_weedfield'] = 'Weed Field',
['blip_weedprocessing'] = 'Weed Processing',
['blip_HydrochloricAcidFarm'] = 'Hydrochloric Acid Farm',
['blip_SulfuricAcidFarm'] = 'Sulfuric Acid Farm',
['blip_SodiumHydroxideFarm'] = 'Sodium Hydroxide Farm',
['blip_SulfuricAcidFarm'] = 'SulfuricAcidFarm',
}
['blip_ChemicalsFarm'] = 'Chemicals Farm',
['blip_ChemicalsProcessing'] = 'Chemicals Processing',
['blip_CokeFarm'] = 'Coca Field',
['blip_Cokeprocessing'] = 'Coke Processing',
['blip_lsdprocessing'] = 'lsd Processing',
['blip_thionylchlorideprocessing'] = 'Thionyl Chloride Processing',
['blip_heroinfield'] = 'Ploppy Field',
['blip_heroinprocessing'] = 'Heroin Processing',
['blip_licenseshop'] = 'License Shop',
['blip_moneywash'] = 'MoneyWash',
['blip_methprocessing'] = 'Meth Processing',
['blip_drugdealer'] = 'Drug Dealer',

}
175 changes: 175 additions & 0 deletions main.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
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

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) < 1.50 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 wasOpen then
wasOpen = false
ESX.UI.Menu.CloseAll()
end
Citizen.Wait(500)--]]
end
end
end)

function OpenDrugShop()
ESX.UI.Menu.CloseAll()
local elements = {}
menuOpen = 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 - <span style="color:green;">%s</span>'):format(v.label, _U('dealer_item', ESX.Math.GroupDigits(price))),
name = v.name,
price = price,

-- menu properties
type = 'slider',
value = v.count,
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_illegal:sellDrug', data.current.name, data.current.value)
end, function(data, menu)
menu.close()
menuOpen = false
end)
end

AddEventHandler('onResourceStop', function(resource)
if resource == GetCurrentResourceName() 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 - <span style="color:green;">%s</span>'):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_illegal: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)

if Config.EnableMapsBlimps then
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
end

Citizen.CreateThread(function()
if Config.EnableMapsBlimps then
for k,zone in pairs(Config.CircleZones) do
if zone.enabled then
CreateBlipCircle(zone.coords, zone.name, zone.radius, zone.color, zone.sprite)
end
end
end
end)
Loading

0 comments on commit 64759d7

Please sign in to comment.