You need to change it in the client lua If in not misstaken. Im think it was there i changed it. If not in client then its in the server lua
tried that and now I dont get the option to sell and if I walk up to NPCâs they dont do anything no error in the console but I see in f8,
Its gives me no options to sell at all with that removed , before I could at least hit E as the notification didnât come up.
Update es_extended
I am running the latest version that was released 5 days ago
I need help with dispatcheâs, So me and my friend was testing dispatches, and my friend sold like 100 pooches of weed and i dont get even one dispatch, can some one help me ??
The first thing I could suggest is to update essentialmode, as you are on version 5.2.1 and current is 6.0.2, and also es-extended.
doesnât come with the sql files
it would really help if you put the sql in the download. (weed, meth, cocaine, opium) b/c it CANT FUNCTION WITHOUT IT
@Shyricaus - It would be nice to mention what you fixed to get it working. I have however found the issue and will share it.
Line 162 in the server.lua
Original
TriggerClientEvent('esx:showNotification', _source, _U('you_have_sold') .. '~b~'..x..'~w~' .. _U(drugtype) .. blackMoney .. '$')
Fixed
TriggerClientEvent('esx:showNotification', _source, _U('you_have_sold') .. '~b~'..x..'~w~' .. _U('drugtype') .. blackMoney .. '$')
This did allow me to start selling drugs to the AI however there was still an issue where the drugs were not getting named in notifications.
I made a edit to the server main.lua and I give full credits to @Stasiek.
Here is my edited version of the server main.lua - main.lua (9.8 KB)
It basically has a call per each drug type and spits out an notification for only that one particular
drug.
Here is a small sample
-- ======= METH =======
-- ======= METH =======
-- ======= METH =======
RegisterServerEvent('sellDrugs')
AddEventHandler('sellDrugs', function()
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
local methqty = xPlayer.getInventoryItem('meth_pooch').count
local methqtySingle = xPlayer.getInventoryItem('meth').count
local x = 0
local blackMoney = 0
local drugType = nil
if Config.SellMeth and methqty > 0 or Config.SellMeth and methqtySingle > 0 then
if methqty > 0 and Config.SellPooch then
drugType = 'meth_pooch'
if methqty == 1 then
x = 1
elseif methqty == 2 then
x = math.random(1,2)
elseif methqty == 3 then
x = math.random(1,3)
elseif methqty == 4 then
x = math.random(1,4)
elseif methqty >= 5 then
x = math.random(1,5)
end
elseif methqtySingle > 0 and Config.SellSingle then
drugType = 'meth'
if methqtySingle == 1 then
x = 1
elseif methqtySingle == 2 then
x = math.random(1,2)
elseif methqtySingle == 3 then
x = math.random(1,3)
elseif methqtySingle == 4 then
x = math.random(1,4)
elseif methqtySingle >= 5 then
x = math.random(1,5)
end
end
else
TriggerClientEvent('nomoredrugs', _source)
return
end
if drugType=='meth_pooch' then
blackMoney = Config.MethPrice * 5 * x
elseif drugType=='meth' then
blackMoney = Config.MethPrice * x
end
if drugType ~= nil then
xPlayer.removeInventoryItem(drugType, x)
end
xPlayer.addAccountMoney('black_money', blackMoney)
TriggerClientEvent('sold', _source)
TriggerClientEvent('esx:showNotification', _source, _U('you_have_sold') .. '~b~'..x..'~w~' .. _U('meth') .. blackMoney .. '$')
end)
-- ======= COKE =======
-- ======= COKE =======
-- ======= COKE =======
RegisterServerEvent('sellDrugs')
AddEventHandler('sellDrugs', function()
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
local cokeqty = xPlayer.getInventoryItem('coke_pooch').count
local cokeqtySingle = xPlayer.getInventoryItem('coke').count
local x = 0
local blackMoney = 0
local drugType = nil
if Config.SellCoke and cokeqty > 0 or Config.SellCoke and cokeqtySingle > 0 then
if cokeqty > 0 and Config.SellPooch then
drugType = 'coke_pooch'
if cokeqty == 1 then
x = 1
elseif cokeqty == 2 then
x = math.random(1,2)
elseif cokeqty == 3 then
x = math.random(1,3)
elseif cokeqty == 4 then
x = math.random(1,4)
elseif cokeqty >= 5 then
x = math.random(1,5)
end
elseif cokeqtySingle > 0 and Config.SellSingle then
drugType = 'coke'
if cokeqtySingle == 1 then
x = 1
elseif cokeqtySingle == 2 then
x = math.random(1,2)
elseif cokeqtySingle == 3 then
x = math.random(1,3)
elseif cokeqtySingle == 4 then
x = math.random(1,4)
elseif cokeqtySingle >= 5 then
x = math.random(1,5)
end
end
else
TriggerClientEvent('nomoredrugs', _source)
return
end
if drugType=='coke' then
blackMoney = Config.CokePrice * x
elseif drugType=='coke_pooch' then
blackMoney = Config.CokePrice * 5 * x
end
if drugType ~= nil then
xPlayer.removeInventoryItem(drugType, x)
end
xPlayer.addAccountMoney('black_money', blackMoney)
TriggerClientEvent('sold', _source)
TriggerClientEvent('esx:showNotification', _source, _U('you_have_sold') .. '~b~'..x..'~w~' .. _U('coke') .. blackMoney .. '$')
end)
I also made a quick edit to the en.lua file
Original
['no_more_drugs'] = '~r~You dont have~s~ more ~g~drugs!',
Edited
['no_more_drugs'] = '~r~The person doesnt want any more drugs.~s~ or ~g~ Maybe you are out?',
After making the typo fix. The drugs were not getting named.
After my fix.
for those who use English translation do not need to modify much, that is to modify this line of commando in line 162.
Original
TriggerClientEvent('esx:showNotification', _source, _U('you_have_sold') .. '~b~'..x..'~w~' .. _U(drugtype) .. blackMoney .. '$')
Fixed
TriggerClientEvent('esx:showNotification', _source, _U('you_have_sold') .. '~b~' .. x .. '~w~ ' .. drugType .. ' por ' .. blackMoney .. '$')
Nice script, installed and went over settings. For some reason no matter where I go it says âYouâre too far away from cityâ and Itâs set to 10000 like it was from the start. Any ideas what could be wrong? Thanks
Change it to 20000
Okay well I did that, now I donât get any errors but it also doesnât sell. Is it because I donât have whatever mod that turns the marijuana into pooches? Sorry new to this so learning as I go. I have esxdrugs which only has Marijuana. Was told canât get the coke, meth, opium anymore. Anyway, Itâs setup to go to the Cannabis field, then take that to processor which turns the cannabis to marijuana then sell.
I have all of them, I just use esx_drugs for weed and older version of esx_drugs (renamed) as rest of the drugs Install older version of esx_drugs