[Release]drugs to npc's [ESX]

How can i get the notification to the police trough the mobile and not the chatmessage?

When it says they are calling the cops it doesn’t do nothing… the cops doesn’t get notifications

is your wanted turned on…do they come with other things you do, like shot someone and stuff

yeah it doesnt work thats why i removed it from the features list

This happends to me when i try to run the script ;-(

Script is working normally.

When you sell to NPCs will there be a chance when they reject that it will alert the police?

yeah they will reject but police alert isnt working

the script doesnt notify the police exxept the one that sells the drugs!

Everyone that is having the police notification problem, here is the fixed files!

Add this to server.lua

RegisterServerEvent('SendMessageToClients')
AddEventHandler('SendMessageToClients', function(text)
    TriggerClientEvent('chatMessage', -1, '', {255, 255, 255}, text)
end)

And change the old notification to this

RegisterNetEvent('notifyc')
AddEventHandler('notifyc', function()

    local x,y,z = table.unpack(GetEntityCoords(GetPlayerPed(-1), false))
    local plyPos = GetEntityCoords(GetPlayerPed(-1),  true)
    local streetName, crossing = Citizen.InvokeNative( 0x2EB41072B4C1E4C0, plyPos.x, plyPos.y, plyPos.z, Citizen.PointerValueInt(), Citizen.PointerValueInt() )
    local streetName, crossing = GetStreetNameAtCoord(x, y, z)
    streetName = GetStreetNameFromHashKey(streetName)
	TriggerServerEvent('fetchjob')

	if myJob == 'police' then
		if crossing ~= nil then
			crossing = GetStreetNameFromHashKey(crossing)
			TriggerServerEvent('SendMessageToClients','^7Someone was trying to sell me drugs on ^1' .. streetName .. ' ^7and ^1' .. crossing .. ' ^7please hurry')
		else
			TriggerServerEvent('SendMessageToClients' ,'^7Someone was trying to sell me drugs on ^1' .. streetName .. ' ^7please hurry')
		end
	end
end)

There ya go, it works on mine so…

Your a god send. Testing now.

1 Like

did it work for you?

it did, but i replaced opium with heroin and coke with xanax, and i cant get it to take the xanax or heroin, but the week and meth works fine.

I changed opium to heroin and coke to xanx in the scropt and its still not taking it. Any help?

can you send the file that you changed?

Yes, ill send you my esx_drugs file.

here: esx_drugs.rar (9.8 KB)

@Woopi any updates?
(20 char)

no, sorry. dont know, but try to reinstall, and change names, not anything else

Hmm, tried with your solution, the only things that happends when the NPC calls the cops, is that cops can see a text in the chat, saying just “911”

ahhh,sorry, new edit now

Not workin for me. [20]