Hello, I changed to choose some of the existing drugs in my server, if you want to use it there
server.lua (search RegisterServerEvent(‘drugs:item’) and replace all lines) for:
RegisterServerEvent('drugs:item')
AddEventHandler('drugs:item', function()
local user_id = vRP.getUserId({source})
local player = vRP.getUserSource({user_id})
local drugs = {"weed", "cocaine", "lsd"} -- total drugs list
local t = math.random(1,#drugs) -- count and choose one drugs list
if vRP.tryGetInventoryItem({user_id,drugs[t],1,true}) then
TriggerClientEvent('cancel', player)
else
TriggerClientEvent('done', player)
TriggerClientEvent('cancel', player)
end
end)
I’m having some issue converting this to ESX. I understand some coders like to keep tight lips about code they create, but I know most of us are cool. I’m not really asking for a code, just some help getting this system to work on ESX. Can anyone be of some guidance?
Search for esx_boilerplate
With that template you can adapt most of the code.
Search for esx_fishing to see how to remove items.
Look at the existing esx scripts to see how they make things work.
I’ve got it to approach the NPC, offer the drug, and they have refused and denied. But I can’t get paid or get inventory to adjust. Also can’t get the refusals to notify police…
Upload your work to github and link it to me, I’ll see if I can take a look.
I don’t have FiveM installed now so all work will need to be tested by you later.
That would be really nice if someone could manage to translate this script in ESX because it would be perfect script for selling drugs… Thank you Kraker and Hypr9xa on your time spent on this !
My base is Vrpex vcs would know to inform me if I could install vrp sell drugs to npc for this base?
appears the button to tighten and sell to the NPC he does the animation but does not sell, the money does not enter and the drug does not leave the inventory, could any one help me?
Thank you
Not familiar with Vrpex vcs so I wouldn’t be able to answer that, perhaps someone else here is though
Never really looked at restricting to an area. I suppose you could. I know someone else had also added a check to see how many cops were online before you could sell, similar to the the bank-robbery script, but to me both of of those kind of kill the realism a bit. Even dirty money/ vs clean. I changed it to clean for our server because of the whole “why are civilians walking around buying drugs with marked bills” argument.
Hi guys, how can i delete markers on the map? i cant do that. And when i’m addin DrugsToNpcs it dont work. It say’s when im joinning on server ''couldn’t load DrugsToNpcs. Someone can help?
Please help i love this script but when i press h they cant move and i want them to be able to move after the deal is made but they are just stuck forever and when i press h it says person rejected even if they accepts HELP