RegisterNetEvent('drugs:sell')
AddEventHandler('drugs:sell', function()
local user_id = vRP.getUserId({source})
if success then
TriggerClientEvent("pNotify:SetQueueMax", source, "lmao", 5)
if vRP.tryGetInventoryItem({user_id, "coke_pooch", 1, true}) then
-- Cocaine
local amount = math.random(500,1000)
TriggerClientEvent("pNotify:SendNotification", source, {
text = "You sold some cocain for $" .. amount ,
type = "success",
progressBar = false,
queue = "lmao",
timeout = 2000,
layout = "CenterLeft"
})
TriggerClientEvent("animation", source)
vRP.giveInventoryItem({user_id, "black_money", amount, true})
elseif vRP.tryGetInventoryItem({user_id, "weed_pooch", 1, true}) then
-- Weed
local amount = math.random(150,300)
TriggerClientEvent("pNotify:SendNotification", source, {
text = "You unloaded some weed for $" .. amount ,
type = "success",
progressBar = false,
queue = "lmao",
timeout = 2000,
layout = "CenterLeft"
})
TriggerClientEvent("animation", source)
vRP.giveInventoryItem({user_id, "black_money", amount, true})
elseif vRP.tryGetInventoryItem({user_id, "meth_pooch", 1, true}) then
-- Meth
local amount = math.random(300,700)
TriggerClientEvent("pNotify:SendNotification", source, {
text = "You sold some Meth for $" .. amount ,
type = "success",
progressBar = false,
queue = "lmao",
timeout = 2000,
layout = "CenterLeft"
})
TriggerClientEvent("animation", source)
vRP.giveInventoryItem({user_id, "black_money", amount, true})
elseif vRP.tryGetInventoryItem({user_id, "opium_pooch", 1, true}) then
-- Opium
local amount = math.random(150,300)
TriggerClientEvent("pNotify:SendNotification", source, {
text = "You have sold some Opium for $" .. amount ,
type = "success",
progressBar = false,
queue = "lmao",
timeout = 2000,
layout = "CenterLeft"
})
TriggerClientEvent("animation", source)
vRP.giveInventoryItem({user_id, "black_money", amount, true})
else
-- No drugs
end
else
-- Sale was a failure
end
end)
Comments
0 B
|👍
/👎
0 B
|👍
/👎