[Release] [ESX] Sell to NPC

i have a server with 100 players online and when i start the resourse it kills server. hitchs of 65000ms (65sec)

Try the other version.

Getting this error multiple times:

SCRIPT ERROR: @stasiek_selldrugs/server/main.lua:173: attempt to index a nil value

  • There is no __resource.lua

Maybe if you read the thread correctly, you’d realize that isn’t the script…

Yea I am using that one…

Well, it’s not a my resource issue.
SCRIPT ERROR: @stasiek_selldrugs/server/main.lua:173: attempt to index a nil value
Is related to another resource

nothing is show for me, i have weed on my inventory but nothing happens

There is no __resource.lua

Are you aware that the fxmanifest.lua is the new version of the __resource.lua?
Update your artifacts.

The resource works perfectly fine for me.

Check for any errors in F8 or server console.
Check to see if it’s called weed_pooch?

Required?

  • mythic_notify (i can’t download! It Error 404)

A simple google search will help you find it.

Does the multiple drugs item works?? or for now is only working the np_selltonpc-single?

i used this to stop NPC store keeper sales

if ped ~= oldped and not selling and (IsPedAPlayer(ped) == false and IsPedModel(ped, 416176080) == false and pedType ~= 28) then

1 Like

Hello, I have updated to be able to sell in a specific location. Sorry for my bad English.
If you want to use with location you need to change it in client / client.lua
This:

Citizen.CreateThread(function()
	while true do
		Citizen.Wait(10)
		if ped ~= 0 then 
			if not IsPedDeadOrDying(ped) and not IsPedInAnyVehicle(ped) then
                        local pedType = GetPedType(ped)
				if ped ~= oldped and not selling and (IsPedAPlayer(ped) == false and pedType ~= 28) then
					TriggerServerEvent('checkD')
					if drugtype ~= false then
						TriggerServerEvent('checkC')
						if numberofcops >= Config.NumberOfCops then
							local pos = GetEntityCoords(ped)
							DrawText3Ds(pos.x, pos.y, pos.z, 'Press E to sell ' .. drugtype)
							if IsControlJustPressed(1, 86) then
								selling = true
								interact(drugtype)
							end
						end
					end
				end
			else
				Citizen.Wait(500)
			end
		end
	end
end)

To This:

Citizen.CreateThread(function()
	while true do
		Citizen.Wait(10)
		if ped ~= 0 then 
			local player = GetPlayerPed(-1)
			local playerloc = GetEntityCoords(player, 0)
			local distanceFromCity = GetDistanceBetweenCoords(Config.CityPoint.x, Config.CityPoint.y, Config.CityPoint.z, playerloc['x'], playerloc['y'], playerloc['z'], true)
			if not IsPedDeadOrDying(ped) and not IsPedInAnyVehicle(ped) then
                        local pedType = GetPedType(ped)
				if ped ~= oldped and not selling and (IsPedAPlayer(ped) == false and pedType ~= 28) then
					if distanceFromCity < Config.DistanceFromCity then
						TriggerServerEvent('checkD')
						if drugtype ~= false then
							TriggerServerEvent('checkC')
							if numberofcops >= Config.NumberOfCops then
								local pos = GetEntityCoords(ped)
								DrawText3Ds(pos.x, pos.y, pos.z, 'Press E to sell ' .. drugtype)
								if IsControlJustPressed(1, 86) then
									selling = true
									interact(drugtype)
								end
							end
						end
					end
				end
			else
				Citizen.Wait(500)
			end
		end
	end
end)

And in the config lua add this two lines:

Config.DistanceFromCity = 370 -- set distance Radius
Config.CityPoint = {x= -1687.68, y= -1055.75, z= 13.09} -- Pier location

Enjoy!

3 Likes

HUGE thank you for this man, works a charm! @jonare

1 Like

Is there a possibility of adding a blip on the map for the police when they’re notified?

2 Likes

Police notification is very scarce, it would be nice to add a mark type on the map for a few minutes when it is warned.

I have tried installing the single version and the full version, but neither works for me. I use ESX 1.2 and I have dependencies, could someone help me? The message to sell does not appear. Should I go to a specific area? Thank you.

would it be possible to add more than one zone? and put a mark for a few minutes when the police are called?