[ESX] stasiek_selldrugs | stasiek_selldrugsv2 - selling drugs to NPCs

i can only sell weed or weed pooch in old esx_drugs
but i cant sell Cannabis or Marijuana
its say “You dont have more drugs!”

tried and still loads default scritp esx_drugs…

to be able to sell with 0 cops on server would 0 suffice ?

Having same issue where I cant sell because its asking for weed where ESX Drugs is Marijuana. Just want some guidance of what I need to change to get this script to work. Thanks

When i have the plugin running i get a error.

Error running call reference function for resource esx_skin: citizen:/scripting/lua/scheduler.lua:403: server/main.lua:39: attempt to index a nil value (local ‘xPlayer’)
stack traceback:
server/main.lua:39: in upvalue ‘ref’
citizen:/scripting/lua/scheduler.lua:389: in function <citizen:/scripting/lua/scheduler.lua:388>
[C]: in function ‘xpcall’
citizen:/scripting/lua/scheduler.lua:388: in function <citizen:/scripting/lua/scheduler.lua:387>
stack traceback:
[C]: in function ‘error’
citizen:/scripting/lua/scheduler.lua:403: in function <citizen:/scripting/lua/scheduler.lua:372>
Error running system event handling function for resource es_extended: citizen:/scripting/lua/scheduler.lua:41: Failed to execute thread: citizen:/scripting/lua/MessagePack.lua:830: missing bytes
stack traceback:
[C]: in function ‘error’
citizen:/scripting/lua/MessagePack.lua:830: in method ‘underflow’
citizen:/scripting/lua/MessagePack.lua:465: in field ‘any’
citizen:/scripting/lua/MessagePack.lua:860: in field ‘unpack’
citizen:/scripting/lua/scheduler.lua:626: in field ‘?’
server/functions.lua:33: in field ‘TriggerServerCallback’
server/common.lua:88: in upvalue ‘handler’
citizen:/scripting/lua/scheduler.lua:219: in function <citizen:/scripting/lua/scheduler.lua:218>
stack traceback:
[C]: in function ‘error’
citizen:/scripting/lua/scheduler.lua:41: in field ‘CreateThreadNow’
citizen:/scripting/lua/scheduler.lua:218: in function <citizen:/scripting/lua/scheduler.lua:182>
hitch warning: frame time of 346 milliseconds

When i disable the plugin there is no problem.

I updated esx_skin and es_extended but it didnt help,
any idea’s ?

Is there a solution so i can set the price of the sell?

Getting this error, could someone please help?

Summary

[C]: in function ‘error’
citizen:/scripting/lua/scheduler.lua:41: in field ‘CreateThreadNow’
citizen:/scripting/lua/scheduler.lua:218: in function citizen:/scripting/lua/scheduler.lua:182
Error running system event handling function for resource stasiek_selldrugs: citizen:/scripting/lua/scheduler.lua:41: Failed to execute thread: server/main.lua:169: attempt to index a nil value (global ‘ESX’)
stack traceback:
server/main.lua:169: in upvalue ‘handler’
citizen:/scripting/lua/scheduler.lua:219: in function citizen:/scripting/lua/scheduler.lua:218
stack traceback:
[C]: in function ‘error’
citizen:/scripting/lua/scheduler.lua:41: in field ‘CreateThreadNow’
citizen:/scripting/lua/scheduler.lua:218: in function citizen:/scripting/lua/scheduler.lua:182
Error running system event handling function for resource stasiek_selldrugs: citizen:/scripting/lua/scheduler.lua:41: Failed to execute thread: server/main.lua:169: attempt to index a nil value (global ‘ESX’)
stack traceback:

Hi, did you find the solution? Because I too have errors during the sale …

No i have not,

i have disabled the script ATM.
i got also the error when i hit “E” at the NPC.

the problem is from esx_skin.
install the latest version.
in the mean time try this:
line 35

ESX.RegisterServerCallback('esx_skin:getPlayerSkin', function(source, cb)
	local xPlayer = ESX.GetPlayerFromId(source)
	if xPlayer ~= nil then
	MySQL.Async.fetchAll('SELECT skin FROM users WHERE identifier = @identifier', {
		['@identifier'] = xPlayer.identifier
	}, function(users)
		local user = users[1]
		local skin = nil

		local jobSkin = {
			skin_male   = xPlayer.job.skin_male,
			skin_female = xPlayer.job.skin_female
		}

		if user.skin ~= nil then
			skin = json.decode(user.skin)
		end

		cb(skin, jobSkin)
		end)
	end
end)

did you change something in sever/main.lua?
do u have

ESX = nil

in line 1 ?

I didn’t change anything at all. I only changed, line 162 in server/main from (drugtype) to (‘drugtype’)

You need to change it to drugType
and that’s not where the problem is coming from.
send me your server/main.lua

Any planned updates

Example customize cops for drugs:

Weed = 1 cop online
coke = 2 cop online
xtc = 3 cops online

i am getting this error every time the transaction is complete between me and the npc not sure what to do the script is working except that error keeps happening when the sale is complete.
https://gyazo.com/77ee85a1564ce315ba9d93bcbd809da7

I have tried to change the animation in the file to amb@prop_human_atm@male@exit but when I do it doesn’t do any animation then and help would be apreciated - This is the code - I feel the animation for the ATM funciton is better than the original -

		--SUCCESS
		if secondsRemaining <= 1 then
			selling = false
			SetEntityAsMissionEntity(oldped)
			SetPedAsNoLongerNeeded(oldped)
			FreezeEntityPosition(oldped,false)
			StopAnimTask(pid, "amb@prop_human_atm@male@exit","exit", 1.0)
			playerHasDrugs = false
			sold = false
			TriggerServerEvent('sellDrugs')
		end	
		
		if secondsRemaining == 5 and Config.PlayAnimation then
			Citizen.Wait(1100) 
			RequestAnimDict("amb@prop_human_atm@male@exit")
			while (not HasAnimDictLoaded("amb@prop_human_atm@male@exit")) do 
				Citizen.Wait(0) 
			end
			TaskPlayAnim(pid,"amb@prop_human_atm@male@exit","exit",100.0, 200.0, 0.3, 120, 0.2, 0, 0, 0)
		end
	end	
end

end)

Hello, such an apology, the script is still working since I do not get anything to sell

does anyone know how to make the police notifications work because when it gets rejected the police dont get a notification i have it set like this so it should work
Config.CallCopsPercent = 1 – (min1) if 1 cops will be called every time=100%, 2=50%, 3=33%, 4=25%, 5=20%
Config.PedRejectPercent = 2 – (min1) if 1 ped reject offer=100%, 2=50%, 3=33%, 4=25%, 5=20%

1 Like

Anyone had this error??

Error parsing script server/main.lua in resource esx_selldrugs: server/main.lua:401: unexpected symbol near ‘)’
Failed to load script server/main.lua.

Standard server/main/lua??

1 Like

English only on this forum, @Simmon.