[Release] [vRP] Sell drugs to NPC


This is based completely off: [For Developers] [Release] Sell drugs to NPCs

Darkcomichero’s edit: https://github.com/DarkComicHero/vrp_drugstonpc

My version: https://github.com/D3uxx/vrp_drugstonpc/archive/0.3.zip

It works with vRP, normal one, not vRPex.

Looking for a specific Drugs-to-Peds mod

Have already tried that - it seems nice! Thank you very much!
If you have several types of drugs, can you add them somehow?


I am thinking of maybe upgrading it in the future so it supports more than one.
Right now I have to think about it mostly because vRP doesn’t allow check if user has X item but only try to give, so it would be quite a mess.


Does this mod work with all drug mods?


It’s for vRP and you can change the drug you sell to whatever you want.
I was selling Tacos for testing.


How to make a sale of two items?
if not vRP.tryGetInventoryItem({user_id,“tacos”,1,notify}) then


Hey, first off love this script i am getting ready to add it to my community’s server but there is one thing missing and that is for a chance to send a police alert on a rejection. I am very new to coding so i probably did everything wrong but i tried for a day or two now to add an alert on a rejection and nothing i tired worked i was wondering if you or someone reading this would be kind enough to help me figure this out


What do you mean on rejection?

Explain a scenario and we’ll go from there.


ok in the original script it has this code that triggers a police alert on a 1 in 3 chance. it looks like this:

local randomReport = math.random(1, 3)
if randomReport == 2 then
local plyPos = GetEntityCoords(GetPlayerPed(-1), true)
local s1, s2 = Citizen.InvokeNative( 0x2EB41072B4C1E4C0, plyPos.x, plyPos.y, plyPos.z, Citizen.PointerValueInt(), Citizen.PointerValueInt() )
local street1 = GetStreetNameFromHashKey(s1)
local street2 = GetStreetNameFromHashKey(s2)
TriggerServerEvent(‘dispatch’, “drug”, street1, plyPos.x, plyPos.y, plyPos.z)

obviously that is not written for vRP so that code is worthless to us but i tried a few different ways to do something similar for vRP to make it do something similar to when players steal cars, basicly adding wanted level and polce get the blue star on the map but everything i tried failed.

Like i said i am brand new to coding i have maybe been doing this for a week so i probably did something wrong everytime i tried cause i barely know what i am doing.

this little feature is a huge deal for an RP server like it adds an element of risk to selling drugs and i am really hoping you guys can help me get this added not only for me but for others who use this script as well


If you have outlaw alert you could use that to trigger a different resource event or just add a start with vRP wanted system.


I’m still looking for a way to check if user has X item on vRP to work from there.


every time i try to use vRP to do it crashes the script and doesn’t give an error so i have no idea what is going wrong i was really hoping maybe you or someone else here knew how to make it work


If you press F8 in your console while in game you can see what error it gives.
Most likely you have something wrong, upload your client.lua to pastebin and send here the link.


i added this after line 63, i didn’t change anything else in the script. it is based off of the vRP/modules/police.lua for vehicle tracking. i attempted to do something similar for the way alerts on stealing cars works but i had already deleted that edit



Not sure if that’s how it’s made but I know for a fact the ,drug dealer reported without " is already gonna fuck it up.

Take a read at this [vRP Framework]-[Psycho Edited - FX 3.5]-[23/07/17]


Wanted 1 on rejection of selling the drug, is what I was working on, this is what im trying to do with the tvRP.applyWantedLevel(2)


i was unable to figure this out, i assume this is because of my severe lack of coding knowledge, if anyone does figure this out can you please share it with me


Works great until I get a ped that rejects the attempt. At that point the script crashes.
Psycho Edit. Only changes I made were item to “weed” and amount of dirty money to (200, 600)

Error resuming caourtine: citizen:/scripting/lua/scheduler: No such export SetQueMax in resource pNotify stack traceback:
[C]: in function 'error’
citizen:/scripting/lua/scheduler in metamethod '__index’
cliient.lua:53: in function client.lua:24

Any suggestions?


The way it works on LSL is that, if you attempt to sell drugs to an NPC.
They have the chance to send an automatic sms to the online player police with your location.
So if your sale fails, it triggers the police and they may come investigate.

That what he was probably trying to explain to you


Do you have pNotify?