[Release]drugs to npc's [ESX]

hey exotic! thanks for the good work! :smiley: if you could help a pleb like me make triggers of drugsale a 10% to the police that would be the magic last touch! <3 <3

Thanks for the feedback. I would but I really am too lazy to work on that xD

it shouldn’t be too hard.

change the pass or fail to have 1 number of the % trigger the client event

ahh isee ive tried… i cant get it to work. if anyone else in here manage please share your knowledge :stuck_out_tongue:

what did you try?
mind showing?

Awesome job! Its working great!
I changed successfully so that needs one cop on the server to make the deal happen. But i can´t trigger the event to police notification. Im a noob btw.
Other thing that would be amazing is that only some kinds of peds (gangsters, motobikers, homeless ppl etc… trigger the sale event.

As i said, im a noob, if you could give some help that would be amazing… Thanks in advance! :slight_smile:

Blockquote

local percent = math.random(1, 10)

	if percent == 8 or percent == 9 or percent == 10 then
		success = false
	elseif percent ~= 8 or percent ~= 9 or percent ~= 10 then
		success = true
	end

end)

RegisterNetEvent(‘sell_dis’)
AddEventHandler(‘sell_dis’, function()
TriggerClientEvent(“pNotify:SetQueueMax”, source, “lmao”, 5)
TriggerClientEvent(“pNotify:SendNotification”, source, {
text = “You moved too far away”,
type = “error”,
progressBar = false,
queue = “lmao”,
timeout = 2000,
layout = “CenterLeft”
})
end)

RegisterNetEvent(‘checkD’)
AddEventHandler(‘checkD’, function()
local xPlayer = ESX.GetPlayerFromId(source)
local meth = xPlayer.getInventoryItem(‘meth_pooch’).count
local coke = xPlayer.getInventoryItem(‘coke_pooch’).count
local weed = xPlayer.getInventoryItem(‘weed_pooch’).count
local opium = xPlayer.getInventoryItem(‘opium_pooch’).count

if meth >= 1 or coke >= 1 or weed >= 1 or opium >= 1 then
	TriggerClientEvent("checkR", source, true)
else
	TriggerClientEvent("checkR", source, false)
end

end)

RegisterNetEvent(‘cops’)
AddEventHandler(‘cops’, function()
local percent = math.random(1, 10)
if percent == 10 then
TriggerClientEvent(“pNotify:SetQueueMax”, source, “lmao”, 5)
TriggerClientEvent(“pNotify:SendNotification”, source, {
text = “they called the cops”,
type = “error”,
progressBar = false,
queue = “lmao”,
timeout = 2000,
layout = “CenterLeft”

})
end

end)

Blockquote

the last part is what i added i probbobly failed horrible

Other thing that would be amazing is that only some kinds of peds (gangsters, motobikers, homeless ppl etc… trigger the sale event.

you can add this via

if pedType ~= 28 and IsPedAPlayer(ped) == false then

But I can´t trigger the event to police notification. I’m a noob btw.

what have you tried I’m kinda done updating the script unless any big bugs come around. but ill help

Can you put it in a pastebin or do

3 ` of these for a code block

Also 1 thing the event isn’t being triggered at all. Plus this wont do anything for the cops.

hi again :slight_smile:
So this is what i made so far.
Server: https://pastebin.com/UugM9d4Y
Client: https://pastebin.com/e528pBbn

  • i cant get the event police notification to work :frowning:

well a few things

RegisterServerEvent('drugs:police')
AddEventHandler('drugs:police', function(text)
 
    local source = source
    local xPlayer = ESX.GetPlayerFromId(source)
    local xPlayers = ESX.GetPlayers()
    local cops = 0
    for i=1, #xPlayers, 1 do
        local xPlayer = ESX.GetPlayerFromId(xPlayers[i])
        if xPlayer.job.name == 'police' then
            cops = cops + 1
        end
    end
    for i=1, #xPlayers, 1 do
        local xPlayer = ESX.GetPlayerFromId(xPlayers[i])
        if xPlayer.job.name == 'police' then
            TriggerClientEvent('esx_phone:onMessage', xPlayer2.source, '', "Venda de droga nas ruas" , xPlayer.get('coords'), true, 'Alert Police', true)  
        end
    end
end)

most of this does nothing

and you want to determin the job on client

i dont know what more can i do… i tried, but im limited to my noobness.
Thanks anyway, tomorrow is another day, maybe ill come with a solution.
Great job on the resource, i wish i could understand more of this

i understand i may work on it idk tho

i hope so, that would be amazing. Anyway, if i can get it to work ill post it here.

i’ll help you some more in PMs if you need :smiley:

Would love the part that i can add notification to the police, like the outlaw thing with locations showing.

i might work on it idk yet

Basically it should work with codes that u have added by putting them into the server.lua file? Or do i have to add some code to add for the pNotify mod?

We really want this mod on our server but we want it to work like many others that the NPCs that rejects u have a chance to give an alert to the police that u will also be able to track via the police app in the phone

No that wouldn’t work at all.

Change that pass or fail to have a number that triggers a client event then on client check if the job is police and send an esx notification or something

If your server wants it so bad then make it!