[Release] [vRP] Sell drugs to NPC

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

https://pastebin.com/mnkRYXn2

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?

Shouldn’t work when that tired. I do have pNotify, but I had it commented out because I had been trying to resolve a different conflict. My bad. Works awesome now

exactly but instead of sending an sms it would add wanted level to the player so that it pings a police alert for. so far i still can’t find a way to make that function work, its more then a little frustrating.

You can use de service alert from vrp to send a call to all polices, and put a blip in the map (default is a blue star).

In client.lua line 63 add:

local randomReport = math.random(1, 3)
if randomReport == 2 then
  local plyPos = GetEntityCoords(GetPlayerPed(-1))
  TriggerServerEvent('vRP_drugNPC:policia',plyPos.x, plyPos.y, plyPos.z)
end

in server.lua add:

RegisterServerEvent('vRP_drugNPC:policia')
AddEventHandler('vRP_drugNPC:policia', function(x,y,z)
     vRP.sendServiceAlert({nil, "Policía",x,y,z,"Este señor me está ofreciendome droga para comprarle"})
end)

“Policía” its de name of your call police service, you can see it in vrp/cfg/phone.lua, and you can translate de mensaje “Este señor me está ofreciendome droga para comprarle”.

2 Likes

Do you mind if I add this to the Github?
More ease for everyone to use it.

No problem , if you have any problem send me mp

Did you test this? Or is this untested?

Trust me, it will work.
Once I get some spare time I’ll upload to github.

I got it if you want me to send to you: already added to the files

Submit a push request on Github.