- half done

This commit is contained in:
Mustache Dom committed 2026-01-16 02:57:26 -07:00
1 parent d2f70d78ed
commit ebc47ba5d7
41 files changed
+1491 -1004

No files matched your search

+1 -1
View File
@@ -7,7 +7,7 @@ local function spawn()
Freeze(ped, true, data.loc.w) Freeze(ped, true, data.loc.w)
ps.entityTarget(ped, { ps.entityTarget(ped, {
{ {
label = ps.lang('merchant.targetOpen'), label = Bridge.Language.Locale('merchant.targetOpen'),
action = function() action = function()
local options = {} local options = {}
for k, v in pairs (data.items) do for k, v in pairs (data.items) do
+24 -21
View File
@@ -1,11 +1,11 @@
local cuttingcoke = nil local cuttingcoke = nil
local baggingcoke = nil local baggingcoke = nil
local locations = ps.callback('md-drugs:server:GetCokeLocations') local locations = GlobalState.MDDrugsLocations.Cocaine
local function CutCoke(coords, offset, rotation) local function CutCoke(coords, offset, rotation)
cuttingcoke = true
local animDict, animName = "anim@amb@business@coc@coc_unpack_cut_left@", "coke_cut_v5_coccutter" local animDict, animName = "anim@amb@business@coc@coc_unpack_cut_left@", "coke_cut_v5_coccutter"
ps.requestAnim(animDict, 500) Bridge.Anim.RequestDict(animDict, 500)
local animDuration = GetAnimDuration(animDict, animName) * 1000 local animDuration = GetAnimDuration(animDict, animName) * 1000
local ped = PlayerPedId() local ped = PlayerPedId()
local scenePos, sceneRot = vector3(coords.x + offset.x, coords.y + offset.y,coords.z + offset.z), rotation local scenePos, sceneRot = vector3(coords.x + offset.x, coords.y + offset.y,coords.z + offset.z), rotation
@@ -48,12 +48,14 @@ local function CutCoke(coords, offset, rotation)
end end
RemoveAnimDict(animDict) RemoveAnimDict(animDict)
FreezeEntityPosition(ped, false) FreezeEntityPosition(ped, false)
cuttingcoke = nil
end end
local function BagCoke(coords, offset, rotation) local function BagCoke(coords, offset, rotation)
baggingcoke = true
local ver = "" local ver = ""
local animDict, animName = "anim@amb@business@meth@meth_smash_weight_check@", "break_weigh_"..ver.."char01" local animDict, animName = "anim@amb@business@meth@meth_smash_weight_check@", "break_weigh_"..ver.."char01"
ps.requestAnim(animDict, 500) Bridge.Anim.RequestDict(animDict, 500)
local animDuration = GetAnimDuration(animDict, animName) * 1000 local animDuration = GetAnimDuration(animDict, animName) * 1000
local ped = PlayerPedId() local ped = PlayerPedId()
local scenePos, sceneRot = vector3(coords.x + offset.x, coords.y + offset.y,coords.z + offset.z), rotation local scenePos, sceneRot = vector3(coords.x + offset.x, coords.y + offset.y,coords.z + offset.z), rotation
@@ -109,19 +111,20 @@ local function BagCoke(coords, offset, rotation)
end end
RemoveAnimDict(animDict) RemoveAnimDict(animDict)
FreezeEntityPosition(ped, false) FreezeEntityPosition(ped, false)
baggingcoke = nil
end end
for k, v in pairs (locations.MakePowder) do for k, v in pairs (locations.MakePowder) do
ps.boxTarget('cocaplant'..k, v.loc, {length = v.l, width = v.w, height = 1.0, rotation = v.rot}, { Bridge.Target.AddBoxZone('cocaplant'..k, v.loc, vector3(v.l, v.w, 2.0), v.loc.w or 180.0, {
{ {
label = ps.lang('coke.targetMakePow'), label = Bridge.Language.Locale('coke.targetMakePow'),
icon = 'fa-solid fa-seedling', icon = 'fa-solid fa-seedling',
action = function() action = function()
if not ps.hasItem('coca_leaf') then if not Bridge.Inventory.HasItem('coca_leaf') then
ps.notify(ps.lang('Catches.itemMissings', ps.getLabel('coca_leaf')), 'error') Bridge.Notify.SendNotify(Bridge.Language.Locale('Catches.itemMissings', Bridge.Inventory.GetItemInfo('coca_leaf').label), 'error')
return return
end end
if not ps.progressbar(ps.lang('coke.makePow'), 4000, 'uncuff') then return end if not progressbar(Bridge.Language.Locale('coke.makePow'), 4000, 'weld') then return end
TriggerServerEvent("md-drugs:server:makepowder", k) TriggerServerEvent("md-drugs:server:makepowder", k)
end, end,
canInteract = function() canInteract = function()
@@ -132,13 +135,13 @@ for k, v in pairs (locations.MakePowder) do
end end
for k, v in pairs (locations.CuttingCoke) do for k, v in pairs (locations.CuttingCoke) do
ps.boxTarget('cutcoke'..k, v.loc, {length = 1.0, width = 1.0, height = 1.0, rotation = 180.0}, { Bridge.Target.AddBoxZone('cutcoke'..k, v.loc, vector3(v.l, v.w, 2.0), v.loc.w or 180.0, {
{ {
label = ps.lang('coke.targetCutCoke'), label = Bridge.Language.Locale('coke.targetCutCoke'),
icon = 'fa-solid fa-mortar-pestle', icon = 'fa-solid fa-mortar-pestle',
action = function() action = function()
if not ps.hasItem('bakingsoda') then if not Bridge.Inventory.HasItem('bakingsoda') then
ps.notify(ps.lang('Catches.itemMissings', ps.getLabel('bakingsoda')), 'error') Bridge.Notify.SendNotify(Bridge.Language.Locale('Catches.itemMissings', Bridge.Inventory.GetItemInfo('bakingsoda').label), 'error')
return return
end end
CutCoke(v.loc, v.offset, v.rotation) CutCoke(v.loc, v.offset, v.rotation)
@@ -154,13 +157,13 @@ for k, v in pairs (locations.CuttingCoke) do
end end
for k, v in pairs (locations.BaggingCoke) do for k, v in pairs (locations.BaggingCoke) do
ps.boxTarget('bagcoke'..k, v.loc, {length = 1.0, width = 1.0, height = 1.0, rotation = 180.0}, { Bridge.Target.AddBoxZone('bagcoke'..k, v.loc, vector3(v.l, v.w, 2.0), v.loc.w or 180.0, {
{ {
label = ps.lang('coke.targetBagCoke'), label = Bridge.Language.Locale('coke.targetBagCoke'),
icon = 'fa-solid fa-sack-xmark', icon = 'fa-solid fa-sack-xmark',
action = function() action = function()
if not ps.hasItem('empty_weed_bag') then if not Bridge.Inventory.HasItem('empty_weed_bag') then
ps.notify(ps.lang('Catches.itemMissings', ps.getLabel('empty_weed_bag')), 'error') Bridge.Notify.SendNotify(Bridge.Language.Locale('Catches.itemMissings', Bridge.Inventory.GetItemInfo('empty_weed_bag').label), 'error')
return return
end end
BagCoke(v.loc, v.offset, v.rotation) BagCoke(v.loc, v.offset, v.rotation)
@@ -176,10 +179,10 @@ for k, v in pairs (locations.BaggingCoke) do
end end
for k, v in pairs (locations.cokeTele) do for k, v in pairs (locations.cokeTele) do
ps.boxTarget('coke_tele'..k, v.inside, {length = v.l, width = v.w, heading = v.rot}, { Bridge.Target.AddBoxZone('coke_tele'..k, v.inside, vector3(v.l, v.w, 2.0), v.inside.w or 180.0,{
{ {
icon = 'fa-solid fa-door-open', icon = 'fa-solid fa-door-open',
label = ps.lang('coke.teleOut'), label = Bridge.Language.Locale('coke.teleOut'),
action = function() action = function()
SetEntityCoords(PlayerPedId(), v.outside) SetEntityCoords(PlayerPedId(), v.outside)
end, end,
@@ -188,10 +191,10 @@ for k, v in pairs (locations.cokeTele) do
end end
} }
}) })
ps.boxTarget('coke_teleout'..k, v.outside, {length = v.l, width = v.w, heading = v.rot}, { Bridge.Target.AddBoxZone('coke_teleout'..k, v.outside, vector3(v.l, v.w, 2.0), v.outside.w or 180.0,{
{ {
icon = 'fa-solid fa-door-closed', icon = 'fa-solid fa-door-closed',
label = ps.lang('coke.teleIn'), label = Bridge.Language.Locale('coke.teleIn'),
action = function() action = function()
SetEntityCoords(PlayerPedId(), v.inside) SetEntityCoords(PlayerPedId(), v.inside)
end, end,
+58 -27
View File
@@ -9,31 +9,56 @@ end
local function sellDrug(item, amount, price, targ) local function sellDrug(item, amount, price, targ)
PoliceCall(20) PoliceCall(20)
if ps.vehicleData() then if IsPedInAnyVehicle(PlayerPedId(), true) then
ps.notify(ps.lang('Cornerselling.inVeh'), 'error') Bridge.Notify.SendNotify(Bridge.Language.Locale('Cornerselling.inVeh'), 'error')
walkAway(targ) walkAway(targ)
return return
end end
if not ps.progressbar(string.format(ps.lang('Cornerselling.selling', ps.getLabel(item), price)), 4000, 'uncuff') then walkAway(targ) return end if not progressbar(Bridge.Language.Locale('Cornerselling.selling', Bridge.Inventory.GetItemInfo(item).label, price), 4000, 'uncuff') then
walkAway(targ)
return
end
buyers[targ] = 'sold' buyers[targ] = 'sold'
TriggerServerEvent('md-drugs:server:sellCornerDrugs', item, amount, price) TriggerServerEvent('md-drugs:server:sellCornerDrugs', item, amount, price, NetworkGetNetworkIdFromEntity(targ))
walkAway(targ) walkAway(targ)
end end
local function deny(targ) local function deny(targ)
PoliceCall(20) PoliceCall(20)
buyers[targ] = 'sold' buyers[targ] = 'sold'
if not ps.progressbar(ps.lang('Cornerselling.deny'), 4000, 'argue5') then return end if not progressbar(Bridge.Language.Locale('Cornerselling.deny'), 4000, 'argue5') then return end
walkAway(targ) walkAway(targ)
end end
local function getClosestPed()
local coords = GetEntityCoords(PlayerPedId())
local distance = 10.0
local pedList = GetGamePool('CPed')
local closestDistance = 1000.0
local PED = nil
for i = 1, #pedList do
local ped = pedList[i]
if ped ~= PlayerPedId() then
local pedCoords = GetEntityCoords(ped)
local dist = #(coords - pedCoords)
if dist < closestDistance then
PED = ped
closestDistance = dist
end
end
end
if PED and closestDistance < distance then
return PED, closestDistance
else
return nil
end
end
local function findPed() local function findPed()
local targ = nil local targ = nil
repeat repeat
Wait(100) Wait(100)
targ = ps.getNearestPed(GetEntityCoords(PlayerPedId()), 8) targ = getClosestPed()
if IsPedInAnyVehicle(targ, false) or GetEntityHealth(targ) == 0 or not IsPedHuman(targ) then if IsPedInAnyVehicle(targ, false) or GetEntityHealth(targ) == 0 or not IsPedHuman(targ) then
targ = nil targ = nil
end end
@@ -47,15 +72,17 @@ local function findPed()
if not sell then return end if not sell then return end
buyers[targ] = true buyers[targ] = true
ps.drawText(ps.lang('Cornerselling.wait')) Bridge.HelpText.ShowHelpText(Bridge.Language.Locale('Cornerselling.wait'))
repeat repeat
Wait(1000) Wait(1000)
TaskGoToCoordAnyMeans(targ, GetEntityCoords(PlayerPedId()), 1.0, 0, 0, 0, 0) TaskGoToCoordAnyMeans(targ, GetEntityCoords(PlayerPedId()), 1.0, 0, 0, 0, 0)
until #(GetEntityCoords(PlayerPedId()) - GetEntityCoords(targ)) < 2.0 or sell == false or inZone until #(GetEntityCoords(PlayerPedId()) - GetEntityCoords(targ)) < 2.0 or sell == false or inZone
if not sell then return end if not sell then return end
TaskTurnPedToFaceEntity(targ, PlayerPedId(), -1) TaskTurnPedToFaceEntity(targ, PlayerPedId(), -1)
ps.hideText() Bridge.HelpText.HideHelpText()
CreateThread(function() CreateThread(function()
Wait(45000) Wait(45000)
walkAway(targ) walkAway(targ)
@@ -65,14 +92,17 @@ local function findPed()
end end
local function checkItems() local function checkItems()
local count = 0 local has = false
for k, v in pairs (GlobalState.DrugNames) do for k, v in pairs (GlobalState.DrugNames) do
if ps.hasItem(v) then if Bridge.Inventory.HasItem(v) then
count = count + 1 has = true
break break
end end
end end
if count == 0 then ps.notify(ps.lang('Cornerselling.nodrugs', 'error')) return false end if not has then
Bridge.Notify.SendNotify(Bridge.Language.Locale('Cornerselling.nodrugs', 'error'))
return false
end
return true return true
end end
@@ -89,10 +119,10 @@ local function Cornersell()
return return
end end
ps.drawText(ps.lang('Cornerselling.searching')) Bridge.HelpText.ShowHelpText(Bridge.Language.Locale('Cornerselling.searching'))
local targ = findPed() local targ = findPed()
local data = ps.callback('md-drugs:server:cornerselling:getAvailableDrugs', targ) local data = Bridge.Callback.Trigger('md-drugs:server:cornerselling:getAvailableDrugs', NetworkGetNetworkIdFromEntity(targ))
if data == false then if data == false then
sell = false sell = false
return return
@@ -102,13 +132,13 @@ local function Cornersell()
TaskGoStraightToCoord(targ, -1858.232910, -1242.395630, 8.60510, 100.0, -1, 0.0, 0.0) TaskGoStraightToCoord(targ, -1858.232910, -1242.395630, 8.60510, 100.0, -1, 0.0, 0.0)
SetPedMoveRateOverride(targ, 10.0) SetPedMoveRateOverride(targ, 10.0)
local got = false local got = false
ps.entityTarget(targ, { Bridge.Target.AddLocalEntity(targ, {
{ {
label = ps.lang('Cornerselling.targetTakeBack'), label = Bridge.Language.Locale('Cornerselling.targetTakeBack'),
icon ="fa-solid fa-money-bill", icon ="fa-solid fa-money-bill",
action = function() action = function()
got = true got = true
TriggerServerEvent('md-drugs:server:getBackRobbed') TriggerServerEvent('md-drugs:server:getBackRobbed', NetworkGetNetworkIdFromEntity(targ))
Cornersell() Cornersell()
end, end,
canInteract = function() canInteract = function()
@@ -116,14 +146,15 @@ local function Cornersell()
return true return true
end end
end, end,
}}, nil) }
})
else else
ps.requestAnim("rcmme_tracey1") Bridge.Anim.RequestDict("rcmme_tracey1")
TaskStartScenarioInPlace(targ, "WORLD_HUMAN_STAND_IMPATIENT_UPRIGHT", 0, false) TaskStartScenarioInPlace(targ, "WORLD_HUMAN_STAND_IMPATIENT_UPRIGHT", 0, false)
FreezeEntityPosition(targ, true) FreezeEntityPosition(targ, true)
ps.entityTarget(targ, { Bridge.Target.AddLocalEntity(targ, {
{ {
label = string.format(ps.lang('Cornerselling.targetSell'), data.amount, ps.getLabel(data.item), data.price), label = Bridge.Language.Locale('Cornerselling.targetSell', data.amount, Bridge.Inventory.GetItemInfo(data.item).label, data.price),
icon ="fa-solid fa-money-bill", icon ="fa-solid fa-money-bill",
action = function() action = function()
sellDrug(data.item, data.amount, data.price, targ) sellDrug(data.item, data.amount, data.price, targ)
@@ -136,7 +167,7 @@ local function Cornersell()
end, end,
}, },
{ {
label = ps.lang('Cornerselling.targetDeny'), label = Bridge.Language.Locale('Cornerselling.targetDeny'),
icon = "fa-solid fa-person-harassing", icon = "fa-solid fa-person-harassing",
action = function() action = function()
deny(targ) deny(targ)
@@ -156,11 +187,11 @@ end
RegisterNetEvent('md-drugs:client:cornerselling', function() RegisterNetEvent('md-drugs:client:cornerselling', function()
if sell then if sell then
sell = false sell = false
ps.hideText() Bridge.HelpText.HideHelpText()
ps.notify(ps.lang('Cornerselling.stopped'), 'error') Bridge.Notify.SendNotify(Bridge.Language.Locale('Cornerselling.stopped'), 'error')
else else
sell = true sell = true
ps.notify(ps.lang('Cornerselling.start'), 'success') Bridge.Notify.SendNotify(Bridge.Language.Locale('Cornerselling.start'), 'success')
Cornersell() Cornersell()
end end
end) end)
+11 -11
View File
@@ -1,20 +1,20 @@
local locations = ps.callback('md-drugs:server:GetCrackLocations') local locations = GlobalState.MDDrugsLocations.Crack
for k, v in pairs (locations.makecrack) do for k, v in pairs (locations.makecrack) do
ps.boxTarget('makeCrack'..k, v.loc, {length = v.l, width = v.w, height = 1.0, rotation = v.rot}, { Bridge.Target.AddBoxZone('makeCrack'..k, v.loc, vector3(v.l, v.w, 2.0), v.loc.w or 180.0, {
{ {
label = ps.lang('crack.targetMake'), label = Bridge.Language.Locale('crack.targetMake'),
icon = 'fa-solid fa-temperature-high', icon = 'fa-solid fa-temperature-high',
action = function() action = function()
if not ps.hasItem('bakingsoda') then if not Bridge.Inventory.HasItem('bakingsoda') then
ps.notify(ps.lang('Catches.itemMissings', ps.getLabel('bakingsoda')), 'error') Bridge.Notify.SendNotify(Bridge.Language.Locale('Catches.itemMissings', Bridge.Inventory.GetItemInfo('bakingsoda').label), 'error')
return return
end end
if not minigame() then if not minigame() then
TriggerServerEvent("md-drugs:server:failcrackone", k) TriggerServerEvent("md-drugs:server:failcrackone", k)
return return
end end
if not ps.progressbar(ps.lang('crack.cook'), 4000, 'uncuff') then return end if not progressbar(Bridge.Language.Locale('crack.cook'), 4000, 'uncuff') then return end
TriggerServerEvent('md-drugs:server:makecrackone', k) TriggerServerEvent('md-drugs:server:makecrackone', k)
end, end,
canInteract = function() canInteract = function()
@@ -26,16 +26,16 @@ for k, v in pairs (locations.makecrack) do
end end
for k, v in pairs (locations.bagcrack) do for k, v in pairs (locations.bagcrack) do
ps.boxTarget('bagCrack'..k, v.loc, {length = v.l, width = v.w, height = 1.0, rotation = v.rot}, { Bridge.Target.AddBoxZone('bagCrack'..k, v.loc, vector3(v.l, v.w, 2.0), v.loc.w or 180.0, {
{ {
label = ps.lang('crack.targetBag'), label = Bridge.Language.Locale('crack.targetBag'),
icon = 'fa-solid fa-weight-scale', icon = 'fa-solid fa-weight-scale',
action = function() action = function()
if not ps.hasItem('empty_weed_bag') then if not Bridge.Inventory.HasItem('empty_weed_bag') then
ps.notify(ps.lang('Catches.itemMissings', ps.getLabel('empty_weed_bag')), 'error') Bridge.Notify.SendNotify(Bridge.Language.Locale('Catches.itemMissings', Bridge.Inventory.GetItemInfo('empty_weed_bag').label), 'error')
return return
end end
if not ps.progressbar(ps.lang('crack.bag'), 4000, 'uncuff') then return end if not progressbar(Bridge.Language.Locale('crack.bag'), 4000, 'uncuff') then return end
TriggerServerEvent("md-drugs:server:bagcrack", k) TriggerServerEvent("md-drugs:server:bagcrack", k)
end, end,
canInteract = function() canInteract = function()
+27 -17
View File
@@ -1,20 +1,25 @@
local isActive = false local isActive = false
local dealer = {} local dealer = {}
--TODO: Finish Dealers
local function SpawnDealer() local function SpawnDealer()
local getDealers = ps.callback('md-drugs:server:getDealers') if #dealer >= 1 then
for k,v in pairs(getDealers) do for k,v in pairs (dealer) do
DeletePed(v)
end
dealer = {}
end
for k,v in pairs(GlobalState.MDDrugsLocations.Dealers) do
local Ped = "g_m_y_famdnf_01" local Ped = "g_m_y_famdnf_01"
ps.requestModel(Ped, 30000) requestModel(Ped, 30000)
local loc = json.decode(v.coords) local loc = json.decode(v.coords)
dealer[k] = CreatePed(0, Ped,loc.x,loc.y, loc.z-1, loc.h, false, false) dealer[k] = CreatePed(0, Ped,loc.x,loc.y, loc.z-1, loc.h, false, false)
Freeze(dealer[k], true, loc.h) Freeze(dealer[k], true, loc.h)
ps.entityTarget(dealer[k], { Bridge.Target.AddLocalEntity(dealer[k], {
{ {
icon = 'fas fa-user-secret', icon = 'fas fa-user-secret',
label = ps.lang('Deliveries.targetGetDel'), label = Bridge.Language.Locale('Deliveries.targetGetDel'),
action = function() action = function()
local data = ps.callback('md-drugs:server:GetDeliveryItem', k) local data = Bridge.Callback.Trigger('md-drugs:server:GetDeliveryItem', k)
if type(data) == 'table' and data.coords then if type(data) == 'table' and data.coords then
TriggerEvent('md-drugs:client:setLocation', data) TriggerEvent('md-drugs:client:setLocation', data)
end end
@@ -22,24 +27,29 @@ local function SpawnDealer()
}, },
{ {
icon = "fa-solid fa-store", icon = "fa-solid fa-store",
label = ps.lang('Deliveries.targetOpenShop'), label = Bridge.Language.Locale('Deliveries.targetOpenShop'),
action = function() action = function()
local rep = GetRep() local rep = GetRep()
local items = ps.callback('md-drugs:server:dealerList') local items = Bridge.Callback.Trigger('md-drugs:server:dealerList', k)
local options = {} local options = {}
for m, d in pairs (items) do for m, d in pairs (items) do
if rep.dealerrep >= d.minrep then if rep.dealerrep >= d.minrep then
options[#options+1] = { options[#options+1] = {
title = ps.getLabel(d.name), title = Bridge.Inventory.GetItemInfo(d.name).label,
description = '$' .. d.price, description = '$' .. d.price,
icon = ps.getImage(d.name), icon = Bridge.Inventory.GetItemInfo(d.name).image,
action = function() onSelect = function()
TriggerServerEvent('md-drugs:server:buyItemDealer', m) TriggerServerEvent('md-drugs:server:buyItemDealer', m, k)
end, end,
} }
end end
end end
ps.menu(ps.lang('Deliveries.shopHeader'), ps.lang('Deliveries.shopHeader'), options) Bridge.Menu.Open({
id = 'DealerMenu',
title = Bridge.Language.Locale('Deliveries.shopHeader'),
description = Bridge.Language.Locale('Deliveries.shopHeader'),
options = options
})
end, end,
} }
}) })
@@ -59,12 +69,12 @@ RegisterNetEvent('md-drugs:client:setLocation', function(data)
isActive = true isActive = true
local Buyer = CreatePed(0, "g_m_y_famdnf_01",coord.x, coord.y, coord.z-1, coord.w, false, false) local Buyer = CreatePed(0, "g_m_y_famdnf_01",coord.x, coord.y, coord.z-1, coord.w, false, false)
Freeze(Buyer, true, coord.w) Freeze(Buyer, true, coord.w)
ps.entityTarget(Buyer, { Bridge.Target.AddLocalEntity(Buyer, {
{ {
icon = 'fas fa-user-secret', icon = 'fas fa-user-secret',
label = ps.lang('Deliveries.targetHandOff'), label = Bridge.Language.Locale('Deliveries.targetHandOff'),
action = function() action = function()
if not ps.progressbar(ps.lang('Deliveries.delivering'), 4000, 'uncuff') then return end if not progressbar(Bridge.Language.Locale('Deliveries.delivering'), 4000, 'uncuff') then return end
isActive = false isActive = false
DeletePed(Buyer) DeletePed(Buyer)
TriggerServerEvent('md-drugs:server:giveDeliveryItems', data.item, data.amount) TriggerServerEvent('md-drugs:server:giveDeliveryItems', data.item, data.amount)
+101 -38
View File
@@ -2,6 +2,20 @@
local minigametype = Config.minigametype local minigametype = Config.minigametype
local dispatch = Config.Dispatch local dispatch = Config.Dispatch
function requestModel(ped, timeout)
timeout = timeout or 15000
local startTime = GetGameTimer()
RequestModel(ped)
while not HasModelLoaded(ped) do
Wait(0)
if GetGameTimer() - startTime > timeout then
Bridge.Prints.Debug('requestModel timed out', ped, GetGameTimer() - startTime)
return false
end
end
return true
end
function minigame() function minigame()
local time = 0 local time = 0
local game = Config.Minigames local game = Config.Minigames
@@ -90,39 +104,19 @@ end
function PoliceCall(chance) function PoliceCall(chance)
local math = math.random(1,100) local math = math.random(1,100)
if math <= chance then if math <= chance then
if dispatch == 'ps' then Bridge.Dispatch.SendAlert({
exports['ps-dispatch']:DrugSale() message = "Suspisous Handoff",
elseif dispatch == 'cd' then code = "10-31",
local data = exports['cd_dispatch']:GetPlayerInfo() coords = GetEntityCoords(PlayerPedId()),
TriggerServerEvent('cd_dispatch:AddNotification', { jobs = {"police"},
job_table = {'police', }, blipData = {
coords = data.coords, sprite = 161,
title = '420-69 Drug Sale', color = 1,
message = 'A '..data.sex..' robbing a store at '..data.street, scale = 1.0
flash = 0, },
unique_id = data.unique_id, time = 300000,
sound = 1, icon = "fas fa-exclamation-triangle"
blip = { sprite = 431, scale = 1.2, colour = 3, flashes = false, text = '420-69 Drug Sale', time = 5, radius = 0,} })
})
elseif dispatch == 'core' then
exports['core_dispatch']:addCall("420-69", "Drugs Are Being Sold", {
{icon="fa-ruler", info="4.5 MILES"},
}, {GetEntityCoords(PlayerPedId())}, "police", 3000, 11, 5 )
elseif dispatch == 'aty' then
exports["aty_dispatch"]:SendDispatch('Drug Sale', '420-69', 40, {'police'})
elseif dispatch == 'qs' then
exports['qs-dispatch']:DrugSale()
elseif dispatch == 'codem' then
local Data = {
type = 'Drug Sale',
header = 'Someone Selling Drugs',
text = 'Hurry up and save the community',
code = '420-69',
}
exports['codem-dispatch']:CustomDispatch(Data)
else
print('Congrats, You Choose 0 of the options :)')
end
else else
return return
end end
@@ -131,7 +125,7 @@ end
function GetCops(number) function GetCops(number)
if number == 0 then return true end if number == 0 then return true end
local amount = ps.callback('md-drugs:server:GetCoppers') local amount = ps.callback('md-drugs:server:GetCoppers')
if amount >= number then return true else ps.notify('You Need '.. number - amount .. ' More Cops To Do This', 'error') end if amount >= number then return true else Bridge.Notify.SendNotify('You Need '.. number - amount .. ' More Cops To Do This', 'error') end
end end
function Freeze(entity, toggle, head) function Freeze(entity, toggle, head)
@@ -249,8 +243,77 @@ RegisterCommand('DrugRep', function()
}) })
end, false) end, false)
function handleGang(gang) if Bridge.Framework.GetResourceName() == 'es_extended' then
if gang == nil or gang == '' or gang == "" then return true end function handleGang(gang)
if ps.getGangName() == gang or gang == 1 then return true end return true
return false end
else
function handleGang(gang)
if not gang then
return true
end
if #gang == 0 then
return true
end
local data = Bridge.Framework.GetPlayerData()
if not data.gang then
return false
end
return data.gang.name == gang
end
end
if Config.Emotes == 'rp' then
function playEmote(emote)
return exports["rpemotes"]:EmoteCommandStart(emote)
end
function stopEmote()
return exports["rpemotes"]:EmoteCancel()
end
end
if Config.Emotes == 'dp' then
function playEmote(emote)
TriggerEvent('animations:client:EmoteCommandStart', {emote})
end
function stopEmote()
TriggerEvent('animations:client:EmoteCommandStart', {"c"})
end
end
if Config.Emotes == 'scully' then
function playEmote(emote)
exports.scully_emotemenu:playEmoteByCommand(emote)
end
function stopEmote()
exports.scully_emotemenu:cancelEmote()
end
end
if Config.Emotes == 'custom' then
function playEmote(emote)
TriggerEvent('animations:client:EmoteCommandStart', {emote})
end
function stopEmote()
TriggerEvent('animations:client:EmoteCommandStart', {"c"})
end
end
function progressbar(text, time, emote, cancel)
playEmote(emote)
if not cancel then
cancel = {
move = true,
car = true,
combat = true
}
end
local success = Bridge.ProgressBar.Open({
duration = time,
label = text,
canCancel = true,
disable = cancel,
})
stopEmote()
return success
end end
+36 -35
View File
@@ -1,32 +1,32 @@
local herointable = false local herointable = false
local dirty = false local dirty = false
local locations = ps.callback('md-drugs:server:GetHeroinLocations') local locations = GlobalState.MDDrugsLocations.Heroin
local function createLabKit(coord, head) local function createLabKit(coord, head)
local heroinlabkit = CreateObject("v_ret_ml_tablea", coord.x, coord.y, coord.z - 1, true, false,false) local heroinlabkit = CreateObject("v_ret_ml_tablea", coord.x, coord.y, coord.z - 1, true, false,false)
SetEntityHeading(heroinlabkit, head) SetEntityHeading(heroinlabkit, head)
PlaceObjectOnGroundProperly(heroinlabkit) PlaceObjectOnGroundProperly(heroinlabkit)
ps.entityTarget(heroinlabkit, { Bridge.Target.AddLocalEntity(heroinlabkit, {
{ {
icon = "fa-solid fa-temperature-high", icon = "fa-solid fa-temperature-high",
label = ps.lang('heroin.targetCook'), label = Bridge.Language.Locale('heroin.targetCook'),
action = function() action = function()
if not ps.hasItem('emptyvial') then if not Bridge.Inventory.HasItem('emptyvial') then
ps.notify(ps.lang('Catches.itemMissings', ps.getLabel('emptyvial')), 'error') Bridge.Notify.SendNotify(Bridge.Language.Locale('Catches.itemMissings', Bridge.Inventory.GetItemInfo('emptyvial').label), 'error')
return return
end end
if not minigame() then if not minigame() then
dirty = true dirty = true
TriggerServerEvent("md-drugs:server:failheatingheroin") TriggerServerEvent("md-drugs:server:failheatingheroin")
ps.requestPTFX("core") local coords = GetEntityCoords(heroinlabkit)
local heroinkit = StartParticleFxLoopedOnEntity("exp_air_molotov", heroinlabkit, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.5, false, false, false) AddExplosion(coords.x, coords.y, coords.z-1.0, 34, 0.0, true, false, true)
SetParticleFxLoopedAlpha(heroinkit, 3.0) SetParticleFxLoopedAlpha(heroinkit, 3.0)
SetPedToRagdoll(PlayerPedId(), 1300, 1300, 0, 0, 0, 0) SetPedToRagdoll(PlayerPedId(), 1300, 1300, 0, 0, 0, 0)
return end return
end
if not ps.progressbar(ps.lang('heroin.pbCook'), 4000, 'uncuff') then return end if not progressbar(Bridge.Language.Locale('heroin.pbCook'), 4000, 'uncuff') then return end
TriggerServerEvent("md-drugs:server:heatliquidheroin") TriggerServerEvent("md-drugs:server:heatliquidheroin")
end, end,
canInteract = function() canInteract = function()
@@ -35,9 +35,9 @@ local function createLabKit(coord, head)
}, },
{ {
icon = "fas fa-box-circle-check", icon = "fas fa-box-circle-check",
label = ps.lang('heroin.targetPickup'), label = Bridge.Language.Locale('heroin.targetPickup'),
action = function() action = function()
if not ps.progressbar(ps.lang('heroin.pbPickup'), 4000, 'uncuff') then return end if not progressbar(Bridge.Language.Locale('heroin.pbPickup'), 4000, 'uncuff') then return end
herointable = false herointable = false
DeleteObject(heroinlabkit) DeleteObject(heroinlabkit)
TriggerServerEvent("md-drugs:server:getheroinlabkitback") TriggerServerEvent("md-drugs:server:getheroinlabkitback")
@@ -49,14 +49,14 @@ local function createLabKit(coord, head)
}, },
{ {
icon = "fa-solid fa-hand-sparkles", icon = "fa-solid fa-hand-sparkles",
label = ps.lang('heroin.targetClean'), label = Bridge.Language.Locale('heroin.targetClean'),
action = function() action = function()
if not ps.hasItem('cleaningkit') then if not Bridge.Inventory.HasItem('cleaningkit') then
ps.notify(ps.lang('Catches.itemMissings', ps.getLabel('cleaningkit')), 'error') Bridge.Notify.SendNotify(Bridge.Language.Locale('Catches.itemMissings', Bridge.Inventory.GetItemInfo('cleaningkit').label), 'error')
return return
end end
if not ps.progressbar(ps.lang('heroin.pbClean'), 4000, 'clean') then return end if not progressbar(Bridge.Language.Locale('heroin.pbClean'), 4000, 'clean') then return end
local done = ps.callback('removeCleaningkit', false) local done = Bridge.Callback.Trigger('md-drugs:server:removeCleaningKitHeroin', false)
if done then dirty = false end if done then dirty = false end
end, end,
canInteract = function() canInteract = function()
@@ -67,12 +67,12 @@ local function createLabKit(coord, head)
end end
for k, v in pairs (locations.dryplant) do for k, v in pairs (locations.dryplant) do
ps.boxTarget('dryHeroin'..k, v.loc, {length = v.l, width = v.w, height = 1.0, rotation = v.rot}, { Bridge.Target.AddBoxZone('dryHeroin'..k, v.loc, vector3(v.l, v.w, 2.0), v.loc.w or 180.0, {
{ {
label = ps.lang('heroin.targetDry'), label = Bridge.Language.Locale('heroin.targetDry'),
icon = 'fa-solid fa-temperature-high', icon = 'fa-solid fa-temperature-high',
action = function() action = function()
if not ps.progressbar(ps.lang('heroin.pbDry'), 4000, 'uncuff') then return end if not progressbar(Bridge.Language.Locale('heroin.pbDry'), 4000, 'uncuff') then return end
TriggerServerEvent("md-drugs:server:dryplant", k) TriggerServerEvent("md-drugs:server:dryplant", k)
end, end,
canInteract = function() canInteract = function()
@@ -83,16 +83,16 @@ for k, v in pairs (locations.dryplant) do
end end
for k, v in pairs (locations.cutheroinone) do for k, v in pairs (locations.cutheroinone) do
ps.boxTarget('cutHeroin'..k, v.loc, {length = v.l, width = v.w, height = 1.0, rotation = v.rot}, { Bridge.Target.AddBoxZone('cutHeroin'..k, v.loc, vector3(v.l, v.w, 2.0), v.loc.w or 180.0, {
{ {
label = ps.lang('heroin.targetCutHeroin'), label = Bridge.Language.Locale('heroin.targetCutHeroin'),
icon = 'fa-solid fa-seedling', icon = 'fa-solid fa-seedling',
action = function() action = function()
if not ps.hasItem('bakingsoda') then if not Bridge.Inventory.HasItem('bakingsoda') then
ps.notify(ps.lang('Catches.itemMissings', ps.getLabel('bakingsoda')), 'error') Bridge.Notify.SendNotify(Bridge.Language.Locale('Catches.itemMissings', Bridge.Inventory.GetItemInfo('bakingsoda').label), 'error')
return return
end end
if not ps.progressbar(ps.lang('heroin.pbCutHeroin'), 4000, 'uncuff') then return end if not progressbar(Bridge.Language.Locale('heroin.pbCutHeroin'), 4000, 'uncuff') then return end
TriggerServerEvent("md-drugs:server:cutheroin", k) TriggerServerEvent("md-drugs:server:cutheroin", k)
end, end,
canInteract = function() canInteract = function()
@@ -101,19 +101,20 @@ for k, v in pairs (locations.cutheroinone) do
} }
}) })
end end
local peds = {} local peds = {}
for k, v in pairs (locations.buyKit) do for k, v in pairs (locations.buyKit) do
ps.requestModel(v.ped, 1000) requestModel(v.ped, 1000)
peds[k] = CreatePed(4, v.ped, v.loc.x, v.loc.y, v.loc.z, v.loc.w, false, false) peds[k] = CreatePed(4, v.ped, v.loc.x, v.loc.y, v.loc.z, v.loc.w, false, false)
Freeze(peds[k], true, v.loc.w) Freeze(peds[k], true, v.loc.w)
SetBlockingOfNonTemporaryEvents(peds[k], true) SetBlockingOfNonTemporaryEvents(peds[k], true)
SetEntityInvincible(peds[k], true) SetEntityInvincible(peds[k], true)
ps.entityTarget(peds[k], { Bridge.Target.AddLocalEntity(peds[k], {
{ {
label = ps.lang('heroin.targetBuyKit'), label = Bridge.Language.Locale('heroin.targetBuyKit'),
icon = 'fa-solid fa-box-open', icon = 'fa-solid fa-box-open',
action = function() action = function()
if not ps.progressbar(ps.lang('heroin.pbBuyKit'), 4000, 'uncuff') then return end if not progressbar(Bridge.Language.Locale('heroin.pbBuyKit'), 4000, 'uncuff') then return end
TriggerServerEvent("md-drugs:server:getheroinlabkit", k) TriggerServerEvent("md-drugs:server:getheroinlabkit", k)
end, end,
canInteract = function() canInteract = function()
@@ -125,28 +126,28 @@ for k, v in pairs (locations.buyKit) do
end end
ps.registerCallback("md-drugs:client:setheroinlabkit", function() Bridge.Callback.Register("md-drugs:client:setheroinlabkit", function()
if herointable then if herointable then
ps.notify(ps.lang('heroin.tableout'), 'error') Bridge.Notify.SendNotify(Bridge.Language.Locale('heroin.tableout'), 'error')
return false return false
else else
herointable = true herointable = true
local location, head = StartRay() local location, head = StartRay()
if not location then herointable = false return end if not location then herointable = false return end
if not ps.progressbar(ps.lang('heroin.placing'), 4000, 'uncuff') then return end if not progressbar(Bridge.Language.Locale('heroin.placing'), 4000, 'uncuff') then return end
createLabKit(location, head) createLabKit(location, head)
return true, location return true, location
end end
end) end)
for k, v in pairs (locations.fillneedle) do for k, v in pairs (locations.fillneedle) do
ps.boxTarget('fillNeedle'..k, v.loc, {length = v.l, width = v.w, height = 1.0, rotation = v.rot}, { Bridge.Target.AddBoxZone('fillNeedle'..k, v.loc, vector3(v.l, v.w, 2.0), v.loc.w or 180.0, {
{ {
label = ps.lang('heroin.targetFill'), label = Bridge.Language.Locale('heroin.targetFill'),
icon = 'fa-solid fa-syringe', icon = 'fa-solid fa-syringe',
action = function() action = function()
if not minigame() then TriggerServerEvent("md-drugs:server:failheroin", k) return end if not minigame() then TriggerServerEvent("md-drugs:server:failheroin", k) return end
if not ps.progressbar(ps.lang('heroin.pbFill'), 4000, 'uncuff') then return end if not progressbar(Bridge.Language.Locale('heroin.pbFill'), 4000, 'uncuff') then return end
TriggerServerEvent("md-drugs:server:fillneedle", k) TriggerServerEvent("md-drugs:server:fillneedle", k)
end, end,
canInteract = function() canInteract = function()
+3 -3
View File
@@ -7,7 +7,7 @@ local function SpawnCarPedChase()
local stoploc = vector3(-1157.63, -3056.71, 13.94) local stoploc = vector3(-1157.63, -3056.71, 13.94)
local start = location.StartLoc[math.random(1,#location.StartLoc)] local start = location.StartLoc[math.random(1,#location.StartLoc)]
if started then ps.notify(ps.lang('lean.alreadyChasing'), 'error') return end if started then Bridge.Notify.SendNotify(Bridge.Language.Locale('lean.alreadyChasing'), 'error') return end
started = true started = true
ps.callback('md-drugs:server:RegisterLean') ps.callback('md-drugs:server:RegisterLean')
@@ -39,7 +39,7 @@ local function SpawnCarPedChase()
{ {
name = 'leancar', name = 'leancar',
icon = 'fa-solid fa-car', icon = 'fa-solid fa-car',
label = ps.lang('lean.stealFromTruck'), label = Bridge.Language.Locale('lean.stealFromTruck'),
action = function() action = function()
hit = hit + 1 hit = hit + 1
if not minigame() then return end if not minigame() then return end
@@ -69,7 +69,7 @@ for k, v in pairs (location.SyrupVendor) do
ps.entityTarget(leanPeds[k], { ps.entityTarget(leanPeds[k], {
{ {
icon = "fa-solid fa-hand-holding-medical", icon = "fa-solid fa-hand-holding-medical",
label = ps.lang('lean.startMission'), label = Bridge.Language.Locale('lean.startMission'),
action = function() action = function()
SpawnCarPedChase() SpawnCarPedChase()
end, end,
+41 -50
View File
@@ -1,18 +1,10 @@
local tableout = false local tableout = false
local dirtylsd = false local dirtylsd = false
local locations = ps.callback('md-drugs:server:GetLSDLocations') local locations = GlobalState.MDDrugsLocations.LSD
local function loadParticle(dict)
if not HasNamedPtfxAssetLoaded(dict) then
RequestNamedPtfxAsset(dict)
end
while not HasNamedPtfxAssetLoaded(dict) do
Wait(0)
end
SetPtfxAssetNextCall(dict)
end
local function createLabKit(coord, head) local function createLabKit(coord, head)
requestModel("v_ret_ml_tablea")
local labkit = CreateObject("v_ret_ml_tablea", coord.x, coord.y, coord.z - 1, true, false) local labkit = CreateObject("v_ret_ml_tablea", coord.x, coord.y, coord.z - 1, true, false)
SetEntityHeading(labkit, head) SetEntityHeading(labkit, head)
PlaceObjectOnGroundProperly(labkit) PlaceObjectOnGroundProperly(labkit)
@@ -21,17 +13,16 @@ local function createLabKit(coord, head)
local options = { local options = {
{ {
icon = "fa-solid fa-temperature-high", icon = "fa-solid fa-temperature-high",
label = ps.lang('lsd.targetHeat'), label = Bridge.Language.Locale('lsd.targetHeat'),
action = function() action = function()
local dict = "scr_ie_svm_technical2"
if not minigame() then if not minigame() then
local coords = GetEntityCoords(labkit)
AddExplosion(coords.x, coords.y, coords.z-1.0, 34, 0.0, true, false, true)
dirtylsd = true dirtylsd = true
loadParticle(dict) TriggerServerEvent("md-drugs:server:failheating")
local exitPtfx = StartParticleFxLoopedOnEntity("scr_dst_cocaine", labkit, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.5, false, false, false)
SetParticleFxLoopedAlpha(exitPtfx, 3.0)
return return
end end
if not ps.progressbar(ps.lang('lsd.heating'), 7000, 'uncuff') then return end if not progressbar(Bridge.Language.Locale('lsd.heating'), 7000, 'uncuff') then return end
TriggerServerEvent("md-drugs:server:heatliquid") TriggerServerEvent("md-drugs:server:heatliquid")
end, end,
canInteract = function() canInteract = function()
@@ -40,14 +31,14 @@ local function createLabKit(coord, head)
}, },
{ {
icon = "fa-solid fa-temperature-high", icon = "fa-solid fa-temperature-high",
label = ps.lang('lsd.targetRefine'), label = Bridge.Language.Locale('lsd.targetRefine'),
action = function() action = function()
if not ps.hasItem('lsd_one_vial') then if not Bridge.Inventory.HasItem('lsd_one_vial') then
ps.notify(ps.lang('Catches.itemNeeded', ps.getLabel('lsd_one_vial')), 'error') Bridge.Notify.SendNotify(Bridge.Language.Locale('Catches.itemNeeded', Bridge.Inventory.GetItemInfo('lsd_one_vial').label), 'error')
return return
end end
if not minigame() then TriggerServerEvent("md-drugs:server:failrefinequality") return end if not minigame() then TriggerServerEvent("md-drugs:server:failrefinequality") return end
if not ps.progressbar(ps.lang('lsd.refining'), 4000, 'uncuff') then return end if not progressbar(Bridge.Language.Locale('lsd.refining'), 4000, 'uncuff') then return end
TriggerServerEvent("md-drugs:server:refinequalityacid") TriggerServerEvent("md-drugs:server:refinequalityacid")
end, end,
canInteract = function() canInteract = function()
@@ -56,14 +47,14 @@ local function createLabKit(coord, head)
}, },
{ {
icon = "fa-regular fa-note-sticky", icon = "fa-regular fa-note-sticky",
label = ps.lang('lsd.targetDipping'), label = Bridge.Language.Locale('lsd.targetDipping'),
action = function() action = function()
if not ps.hasItem('tab_paper') then if not Bridge.Inventory.HasItem('tab_paper') then
ps.notify(ps.lang('Catches.itemNeeded', ps.getLabel('tab_paper')), 'error') Bridge.Notify.SendNotify(Bridge.Language.Locale('Catches.itemNeeded', Bridge.Inventory.GetItemInfo('tab_paper').label), 'error')
return return
end end
if not minigame() then TriggerServerEvent("md-drugs:server:failtabs") return end if not minigame() then TriggerServerEvent("md-drugs:server:failtabs") return end
if not ps.progressbar(ps.lang('lsd.dipping'), 4000, 'uncuff') then return end if not progressbar(Bridge.Language.Locale('lsd.dipping'), 4000, 'uncuff') then return end
TriggerServerEvent("md-drugs:server:maketabpaper") TriggerServerEvent("md-drugs:server:maketabpaper")
end, end,
canInteract = function() canInteract = function()
@@ -71,11 +62,10 @@ local function createLabKit(coord, head)
end end
}, },
{ {
event = "md-drugs:client:getlabkitback",
icon = "fas fa-box-circle-check", icon = "fas fa-box-circle-check",
label = ps.lang('lsd.targetPickup'), label = Bridge.Language.Locale('lsd.targetPickup'),
action = function() action = function()
if not ps.progressbar(ps.lang('lsd.packup'), 4000, 'uncuff') then return end if not progressbar(Bridge.Language.Locale('lsd.packup'), 4000, 'uncuff') then return end
DeleteObject(labkit) DeleteObject(labkit)
TriggerServerEvent('md-drugs:server:getlabkitback') TriggerServerEvent('md-drugs:server:getlabkitback')
tableout = false tableout = false
@@ -86,14 +76,14 @@ local function createLabKit(coord, head)
}, },
{ {
icon = "fa-solid fa-hand-sparkles", icon = "fa-solid fa-hand-sparkles",
label = ps.lang('lsd.targetClean'), label = Bridge.Language.Locale('lsd.targetClean'),
action = function() action = function()
if not ps.hasItem('cleaningkit') then if not Bridge.Inventory.HasItem('cleaningkit') then
ps.notify(ps.lang('Catches.itemNeeded', ps.getLabel('cleaningkit')), 'error') Bridge.Notify.SendNotify(Bridge.Language.Locale('Catches.itemNeeded', Bridge.Inventory.GetItemInfo('cleaningkit').label), 'error')
return return
end end
if not ps.progressbar(ps.lang('lsd.cleaning'), 4000, 'clean') then return end if not progressbar(Bridge.Language.Locale('lsd.cleaning'), 4000, 'clean') then return end
local check = ps.callback('md-drugs:server:removecleaningkit') local check = Bridge.Callback.Trigger('md-drugs:server:removecleaningkit')
if check then if check then
dirtylsd = false dirtylsd = false
end end
@@ -101,17 +91,17 @@ local function createLabKit(coord, head)
canInteract = function() if dirtylsd then return true end end canInteract = function() if dirtylsd then return true end end
} }
} }
ps.entityTarget(labkit, options) Bridge.Target.AddLocalEntity(labkit, options)
end end
for k, v in pairs (locations.lysergicacid) do for k, v in pairs (locations.lysergicacid) do
ps.boxTarget('lysergicacid'..k, v.loc, {length = v.l, width = v.w, height = 1.0, rotation = v.rot}, { Bridge.Target.AddBoxZone('lysergicacid'..k,v.loc, vector3(v.l, v.w, 2.0), v.loc.w or 180.0, {
{ {
label = ps.lang('lsd.targetLys'), label = Bridge.Language.Locale('lsd.targetLys'),
icon = 'fa-solid fa-temperature-high', icon = 'fa-solid fa-temperature-high',
action = function() action = function()
if not minigame() then TriggerServerEvent("md-drugs:server:faillysergic") return end if not minigame() then TriggerServerEvent("md-drugs:server:faillysergic") return end
if not ps.progressbar(ps.lang('lsd.stealLys'), 4000, 'uncuff') then return end if not progressbar(Bridge.Language.Locale('lsd.stealLys'), 4000, 'uncuff') then return end
TriggerServerEvent("md-drugs:server:getlysergic", k) TriggerServerEvent("md-drugs:server:getlysergic", k)
end, end,
canInteract = function() canInteract = function()
@@ -123,13 +113,13 @@ for k, v in pairs (locations.lysergicacid) do
end end
for k, v in pairs (locations.diethylamide) do for k, v in pairs (locations.diethylamide) do
ps.boxTarget('diethylamide'..k, v.loc, {length = v.l, width = v.w, height = 1.0, rotation = v.rot}, { Bridge.Target.AddBoxZone('diethylamide'..k, v.loc, vector3(v.l, v.w, 2.0), v.loc.w or 180.0, {
{ {
label = ps.lang('lsd.targetDie'), label = Bridge.Language.Locale('lsd.targetDie'),
icon = 'fa-solid fa-temperature-high', icon = 'fa-solid fa-temperature-high',
action = function() action = function()
if not minigame() then TriggerServerEvent("md-drugs:server:faildiethylamide") return end if not minigame() then TriggerServerEvent("md-drugs:server:faildiethylamide") return end
if not ps.progressbar(ps.lang('lsd.stealDie'), 4000, 'uncuff') then return end if not progressbar(Bridge.Language.Locale('lsd.stealDie'), 4000, 'uncuff') then return end
TriggerServerEvent("md-drugs:server:getdiethylamide", k) TriggerServerEvent("md-drugs:server:getdiethylamide", k)
end, end,
canInteract = function() canInteract = function()
@@ -141,9 +131,9 @@ for k, v in pairs (locations.diethylamide) do
end end
for k, v in pairs (locations.gettabs) do for k, v in pairs (locations.gettabs) do
ps.boxTarget('gettabs'..k, v.loc, {length = v.l, width = v.w, height = 1.0, rotation = v.rot}, { Bridge.Target.AddBoxZone('gettabs'..k, v.loc, vector3(v.l, v.w, 2.0), v.loc.w or 180.0, {
{ {
label = ps.lang('lsd.targetBuyTab'), label = Bridge.Language.Locale('lsd.targetBuyTab'),
icon = 'fa-solid fa-hand-holding-dollar', icon = 'fa-solid fa-hand-holding-dollar',
action = function() action = function()
TriggerServerEvent("md-drugs:server:gettabpaper", k) TriggerServerEvent("md-drugs:server:gettabpaper", k)
@@ -155,21 +145,22 @@ for k, v in pairs (locations.gettabs) do
} }
}) })
end end
local seller = {} local seller = {}
for k, v in pairs (locations.buyLSDkit) do for k, v in pairs (locations.buyLSDkit) do
ps.requestModel(v.ped, 1000) requestModel(v.ped, 1000)
seller[k] = CreatePed(4, v.ped, v.loc.x, v.loc.y, v.loc.z, v.loc.w, false, false) seller[k] = CreatePed(4, v.ped, v.loc.x, v.loc.y, v.loc.z, v.loc.w, false, false)
Freeze(seller[k], true, v.loc.w) Freeze(seller[k], true, v.loc.w)
ps.entityTarget(seller[k], { Bridge.Target.AddLocalEntity(seller[k], {
{ {
label = ps.lang('lsd.targetBuyKit'), label = Bridge.Language.Locale('lsd.targetBuyKit'),
icon = 'fa-solid fa-hand-holding-dollar', icon = 'fa-solid fa-hand-holding-dollar',
action = function() action = function()
if ps.hasItem('lsdlabkit') then if Bridge.Inventory.HasItem('lsdlabkit') then
ps.notify(ps.lang('lsd.alreadyOwn'), 'error') Bridge.Notify.SendNotify(Bridge.Language.Locale('lsd.alreadyOwn'), 'error')
return return
end end
if not ps.progressbar(ps.lang('lsd.buyingKit'), 4000, 'uncuff') then return end if not progressbar(Bridge.Language.Locale('lsd.buyingKit'), 4000, 'uncuff') then return end
TriggerServerEvent('md-drugs:server:getlabkit', k) TriggerServerEvent('md-drugs:server:getlabkit', k)
end, end,
canInteract = function() canInteract = function()
@@ -180,15 +171,15 @@ for k, v in pairs (locations.buyLSDkit) do
}) })
end end
ps.registerCallback("md-drugs:client:setlsdlabkit", function() Bridge.Callback.Register("md-drugs:client:setlsdlabkit", function()
if tableout then if tableout then
ps.notify(ps.lang('lsd.tableout'), 'error') Bridge.Notify.SendNotify(Bridge.Language.Locale('lsd.tableout'), 'error')
return false return false
else else
tableout = true tableout = true
local loc, head = StartRay() local loc, head = StartRay()
if not loc then tableout = false return end if not loc then tableout = false return end
if not ps.progressbar(ps.lang('lsd.placing'), 4000, 'uncuff') then return end if not progressbar(Bridge.Language.Locale('lsd.placing'), 4000, 'uncuff') then return end
createLabKit(loc, head) createLabKit(loc, head)
return true, loc return true, loc
end end
+15 -12
View File
@@ -1,28 +1,30 @@
local locations = ps.callback('md-drugs:server:GetMescalineLocs')
local badTrip = 20 local badTrip = 100
local function AlienEffect() local function AlienEffect()
CreateThread(function()
StartScreenEffect("DrugsMichaelAliensFightIn", 3.0, 0) StartScreenEffect("DrugsMichaelAliensFightIn", 3.0, 0)
Wait(math.random(5000, 8000))
StartScreenEffect("DrugsMichaelAliensFight", 3.0, 0) StartScreenEffect("DrugsMichaelAliensFight", 3.0, 0)
Wait(math.random(5000, 8000)) Wait(math.random(25000, 35000))
StartScreenEffect("DrugsMichaelAliensFightOut", 3.0, 0) StartScreenEffect("DrugsMichaelAliensFightOut", 3.0, 0)
StopScreenEffect("DrugsMichaelAliensFightIn") StopScreenEffect("DrugsMichaelAliensFightIn")
StopScreenEffect("DrugsMichaelAliensFight") StopScreenEffect("DrugsMichaelAliensFight")
StopScreenEffect("DrugsMichaelAliensFightOut") StopScreenEffect("DrugsMichaelAliensFightOut")
end)
end end
local locations = GlobalState.MDDrugsLocations.Mescaline
for k, v in pairs (locations.DryOutMescaline) do for k, v in pairs (locations.DryOutMescaline) do
ps.boxTarget('dryoutMesc'..k, v.loc, {length = v.l, width = v.w, height = 1.0, rotation = v.rot}, { Bridge.Target.AddBoxZone('dryoutMesc'..k, v.loc, vector3(v.l, v.w, 2.0), v.loc.w or 180.0,{
{ {
label = ps.lang('mesc.targetDry'), label = Bridge.Language.Locale('mesc.targetDry'),
icon = 'fa-solid fa-temperature-high', icon = 'fa-solid fa-temperature-high',
action = function() action = function()
if not ps.hasItem('cactusbulb') then if not Bridge.Inventory.HasItem('cactusbulb') then
ps.notify(ps.lang('Catches.itemNeeded', ps.getLabel('cactusbulb')), 'error') Bridge.Notify.SendNotify(Bridge.Language.Locale('Catches.itemNeeded', Bridge.Inventory.GetItemInfo('cactusbulb').label), 'error')
return return
end end
if not ps.progressbar(ps.lang('mescaline.dry'), 4000, 'uncuff') then return end if not progressbar(Bridge.Language.Locale('mescaline.dry'), 4000, 'uncuff') then return end
TriggerServerEvent("md-drugs:server:drymescaline", k) TriggerServerEvent("md-drugs:server:drymescaline", k)
end, end,
canInteract = function() canInteract = function()
@@ -37,10 +39,11 @@ RegisterNetEvent("md-drugs:client:takemescaline", function()
local chance, chance2 = math.random(1,100), math.random(1,100) local chance, chance2 = math.random(1,100), math.random(1,100)
local weapon = '' local weapon = ''
if chance2 == 100 then weapon = 'weapon_rpg' else weapon = 'weapon_flaregun' end if chance2 == 100 then weapon = 'weapon_rpg' else weapon = 'weapon_flaregun' end
if not ps.progressbar(ps.lang('mescaline.eat'), 4000, 'uncuff') then return end if not progressbar(Bridge.Language.Locale('mescaline.eat'), 4000, 'uncuff') then return end
if chance <= badTrip then if chance <= badTrip then
AlienEffect() AlienEffect()
local clone = ClonePed(PlayerPedId(), false, false, true) Wait(math.random(3000,6000))
local clone = ClonePed(PlayerPedId(), true, true, true)
SetEntityAsMissionEntity(clone) SetEntityAsMissionEntity(clone)
SetPedFleeAttributes(clone, false) SetPedFleeAttributes(clone, false)
GiveWeaponToPed(clone, weapon, 1, false, true) GiveWeaponToPed(clone, weapon, 1, false, true)
+69 -72
View File
@@ -1,37 +1,36 @@
local amonia = false local amonia, tray, heated, active, trays, startedmeth, methVan = false, false, false, false, nil, false, nil
local tray = false local locations = GlobalState.MDDrugsLocations.Meth
local heated = false
local active = false
local trays = nil
local locations = ps.callback('md-drugs:server:GetMethLocs')
--- meth heist --- meth heist
local startedmeth = false
local function SpawnMethCarPedChase()
local function SpawnMethCarPedChase(loc)
local stoploc = vector3(-1157.63, -3056.71, 13.94) local stoploc = vector3(-1157.63, -3056.71, 13.94)
local start = locations.StartLoc[math.random(1,#locations.StartLoc)] local start = locations.StartLoc[math.random(1,#locations.StartLoc)]
if startedmeth then if startedmeth then
ps.notify(ps.lang('meth.alreadyChasing'),'error') Bridge.Notify.SendNotify(Bridge.Language.Locale('meth.alreadyChasing'),'error')
else else
startedmeth = true startedmeth = true
ps.callback('md-drugs:server:registerMeth') requestModel("journey", 30000)
requestModel("a_m_m_hillbilly_02", 30000)
ps.requestModel("journey", 30000) requestModel("cargobob3", 30000)
ps.requestModel("a_m_m_hillbilly_02", 30000) methVan = CreateVehicle("journey", start.x+3, start.y-2, start.z-1, 52.0, true, false)
ps.requestModel("cargobob3", 30000)
local methcar = CreateVehicle("journey", start.x+3, start.y-2, start.z-1, 52.0, true, false)
local methdriver = CreatePed(26, "a_m_m_hillbilly_02", start.x, start.y, start.z, 268.9422, false, false) local methdriver = CreatePed(26, "a_m_m_hillbilly_02", start.x, start.y, start.z, 268.9422, false, false)
local methpilot = CreatePed(26, "a_m_m_hillbilly_02", stoploc.x-3, stoploc.y-3, stoploc.z-1, 268.9422, false, false) local methpilot = CreatePed(26, "a_m_m_hillbilly_02", stoploc.x-3, stoploc.y-3, stoploc.z-1, 268.9422, false, false)
local can = Bridge.Callback.Trigger('md-drugs:server:registerMeth', loc, NetworkGetNetworkIdFromEntity(methVan))
if not can then
startedmeth = false
DeleteVehicle(methVan)
DeleteEntity(methdriver)
DeleteEntity(methpilot)
return
end
FreezeEntityPosition(methpilot, true) FreezeEntityPosition(methpilot, true)
SetEntityInvincible(methpilot, true) SetEntityInvincible(methpilot, true)
SetEntityAsMissionEntity(methcar) SetEntityAsMissionEntity(methVan)
AddBlipForEntity(methcar) AddBlipForEntity(methVan)
SetPedIntoVehicle(methdriver, methcar, -1) SetPedIntoVehicle(methdriver, methVan, -1)
SetPedFleeAttributes(methdriver,false) SetPedFleeAttributes(methdriver,false)
TaskVehicleDriveToCoordLongrange(methdriver, methcar, stoploc.x, stoploc.y, stoploc.z-1, 50.0, 524288, 25.0) TaskVehicleDriveToCoordLongrange(methdriver, methVan, stoploc.x, stoploc.y, stoploc.z-1, 50.0, 524288, 25.0)
SetPedKeepTask(methdriver, true) SetPedKeepTask(methdriver, true)
repeat repeat
@@ -39,25 +38,22 @@ local function SpawnMethCarPedChase()
until #(GetEntityCoords(methdriver) - stoploc) < 20.0 or GetEntityHealth(methdriver) == 0 until #(GetEntityCoords(methdriver) - stoploc) < 20.0 or GetEntityHealth(methdriver) == 0
if GetEntityHealth(methdriver) == 0 then if GetEntityHealth(methdriver) == 0 then
ps.entityTarget(methcar, { Bridge.Target.AddLocalEntity(methVan, {
{ {
name = 'methcar', name = 'methcar',
icon = 'fa-solid fa-car', icon = 'fa-solid fa-car',
label = ps.lang('meth.targetStealFromCar'), label = Bridge.Language.Locale('meth.targetStealFromCar'),
action = function() action = function()
if not minigame() then return end if not minigame() then return end
TriggerServerEvent('md-drugs:server:givemethingridients') TriggerServerEvent('md-drugs:server:givemethingridients', NetworkGetNetworkIdFromEntity(methVan))
startedmeth = false startedmeth = false
if math.random(1,100) <= 30 then DeleteEntity(methdriver)
DeleteVehicle(methcar) DeleteEntity(methpilot)
DeleteEntity(methdriver)
DeleteEntity(methpilot)
end
end, end,
} }
}) })
else else
DeleteVehicle(methcar) DeleteVehicle(methVan)
DeleteEntity(methdriver) DeleteEntity(methdriver)
DeleteEntity(methpilot) DeleteEntity(methpilot)
end end
@@ -68,14 +64,13 @@ local peds = {}
for k, v in pairs (locations.MethHeist) do for k, v in pairs (locations.MethHeist) do
peds[k] = CreatePed(4, GetHashKey(v.ped), v.loc.x, v.loc.y, v.loc.z, v.loc.w, false, true) peds[k] = CreatePed(4, GetHashKey(v.ped), v.loc.x, v.loc.y, v.loc.z, v.loc.w, false, true)
Freeze(peds[k], true, v.loc.w) Freeze(peds[k], true, v.loc.w)
ps.entityTarget(peds[k], { Bridge.Target.AddLocalEntity(peds[k], {
{ {
name = 'methheist'..k,
icon = 'fa-solid fa-user-secret', icon = 'fa-solid fa-user-secret',
label = ps.lang('meth.targetHeist'), label = Bridge.Language.Locale('meth.targetHeist'),
action = function() action = function()
if startedmeth then ps.notify(ps.lang('meth.alreadyChasing'),'error') return end if startedmeth then Bridge.Notify.SendNotify(Bridge.Language.Locale('meth.alreadyChasing'),'error') return end
SpawnMethCarPedChase() SpawnMethCarPedChase(k)
end, end,
canInteract = function() canInteract = function()
return handleGang(v.gang) return handleGang(v.gang)
@@ -94,21 +89,23 @@ local function loadParticle(dict)
end end
SetPtfxAssetNextCall(dict) SetPtfxAssetNextCall(dict)
end end
local function dialSuccess(coords) local function dialSuccess(coords)
ps.requestModel('hei_prop_heist_thermite', 2000) requestModel('hei_prop_heist_thermite', 2000)
loadParticle('scr_ornate_heist') loadParticle('scr_ornate_heist')
local thermite = CreateObject('hei_prop_heist_thermite', vector3(1006.09, -3201.29, -39.30), true, false, false) local thermite = CreateObject('hei_prop_heist_thermite', coords.x - 0.5, coords.y - 0.5, coords.z -0.5, true, false, false)
FreezeEntityPosition(thermite, true) FreezeEntityPosition(thermite, true)
SetEntityRotation(thermite, 190.0, 90.0, 140.0, 3, true ) SetEntityVisible(thermite, false)
Wait(1000) Wait(1000)
local therm = StartParticleFxLoopedOnEntity('scr_heist_ornate_thermal_burn', thermite, 0.0, 1.4, 0.0, 0.0, 0.0, 0.0, 1.5, false, false, false) local therm = StartParticleFxLoopedOnEntity('scr_heist_ornate_thermal_burn', thermite, 0.0, 1.4, 0.0, 0.0, 0.0, 0.0, 1.5, false, false, false)
Wait(math.random(10000, 20000)) Wait(math.random(10000, 20000))
StopParticleFxLooped(therm, true) StopParticleFxLooped(therm, true)
DeleteObject(thermite)
end end
local function MethCooking(coords, offset, rotation) local function MethCooking(coords, offset, rotation)
local animDict, animName = "anim@amb@business@meth@meth_monitoring_cooking@cooking@", "chemical_pour_short_cooker" local animDict, animName = "anim@amb@business@meth@meth_monitoring_cooking@cooking@", "chemical_pour_short_cooker"
ps.requestAnim(animDict, 500) Bridge.Anim.RequestDict(animDict)
SetEntityCoords(PlayerPedId(), coords) SetEntityCoords(PlayerPedId(), coords)
local targetPosition = GetEntityCoords(PlayerPedId()) local targetPosition = GetEntityCoords(PlayerPedId())
local animDuration = GetAnimDuration(animDict, animName) * 800 local animDuration = GetAnimDuration(animDict, animName) * 800
@@ -131,7 +128,7 @@ end
local function SmashMeth(coords, offset, rotation) local function SmashMeth(coords, offset, rotation)
local ver = "" local ver = ""
local animDict, animName = "anim@amb@business@meth@meth_smash_weight_check@", "break_weigh_"..ver.."char02" local animDict, animName = "anim@amb@business@meth@meth_smash_weight_check@", "break_weigh_"..ver.."char02"
ps.requestAnim(animDict, 500) Bridge.Anim.RequestDict(animDict, 500)
local ped = PlayerPedId() local ped = PlayerPedId()
local targetPosition = coords local targetPosition = coords
SetEntityCoords(ped, targetPosition) SetEntityCoords(ped, targetPosition)
@@ -166,7 +163,7 @@ end
local function BagMeth(coords, offset, rotation) local function BagMeth(coords, offset, rotation)
local ver = "" local ver = ""
local animDict, animName = "anim@amb@business@meth@meth_smash_weight_check@", "break_weigh_"..ver.."char01" local animDict, animName = "anim@amb@business@meth@meth_smash_weight_check@", "break_weigh_"..ver.."char01"
ps.requestAnim(animDict, 500) Bridge.Anim.RequestDict(animDict, 500)
local animDuration = GetAnimDuration(animDict, animName) * 1000 local animDuration = GetAnimDuration(animDict, animName) * 1000
local ped = PlayerPedId() local ped = PlayerPedId()
SetEntityCoords(ped, coords) SetEntityCoords(ped, coords)
@@ -235,13 +232,13 @@ end
local function startcook(num, coords, offset, rotation) local function startcook(num, coords, offset, rotation)
if not amonia then if not amonia then
local adding = ps.callback('md-drugs:server:startcook', num) local adding = Bridge.Callback.Trigger('md-drugs:server:startcook', num)
if not adding then return end if not adding then return end
active = true active = true
MethCooking(coords, offset, rotation) MethCooking(coords, offset, rotation)
amonia = true amonia = true
else else
ps.notify(ps.lang('meth.started'), "error") Bridge.Notify.SendNotify(Bridge.Language.Locale('meth.started'), "error")
end end
end end
@@ -252,8 +249,9 @@ local function dials(coords)
AddExplosion(coords.x, coords.y,coords.z, 49, 10, true, false, true) AddExplosion(coords.x, coords.y,coords.z, 49, 10, true, false, true)
amonia = false amonia = false
active = false active = false
return end return
ps.notify(ps.lang('meth.increaseHeat'), "success") end
Bridge.Notify.SendNotify(Bridge.Language.Locale('meth.increaseHeat'), "success")
dialSuccess(coords) dialSuccess(coords)
heated = true heated = true
end end
@@ -267,11 +265,11 @@ local function smash(coords, offset, rotation, buckets, k)
Freeze(bucket, true, buckets.w) Freeze(bucket, true, buckets.w)
SmashMeth(coords, offset, rotation) SmashMeth(coords, offset, rotation)
Wait(100) Wait(100)
ps.entityTarget(bucket, { Bridge.Target.AddLocalEntity(bucket, {
{ {
name = 'bucket', name = 'bucket',
icon = "fa-solid fa-sack-xmark", icon = "fa-solid fa-sack-xmark",
label = ps.lang('meth.targetBag'), label = Bridge.Language.Locale('meth.targetBag'),
action = function() action = function()
DeleteObject(bucket) DeleteObject(bucket)
active = false active = false
@@ -293,9 +291,9 @@ end
local function trayscarry() local function trayscarry()
if amonia and heated then if amonia and heated then
local pos = GetEntityCoords(PlayerPedId(), true) local pos = GetEntityCoords(PlayerPedId(), true)
ps.requestAnim('anim@heists@box_carry@') Bridge.Anim.RequestDict('anim@heists@box_carry@')
TaskPlayAnim(PlayerPedId(), 'anim@heists@box_carry@', 'idle', 5.0, -1, -1, 50, 0, false, false, false) TaskPlayAnim(PlayerPedId(), 'anim@heists@box_carry@', 'idle', 5.0, -1, -1, 50, 0, false, false, false)
ps.requestModel('bkr_prop_meth_tray_02a') requestModel('bkr_prop_meth_tray_02a')
trays = CreateObject("bkr_prop_meth_tray_02a", pos.x, pos.y, pos.z, true, true, true) trays = CreateObject("bkr_prop_meth_tray_02a", pos.x, pos.y, pos.z, true, true, true)
AttachEntityToEntity(trays, PlayerPedId(), GetPedBoneIndex(PlayerPedId(), 28422), 0.01, -0.2,-0.2, 20.0, 0.0, 0.0, true, true, false, true, 1, true) AttachEntityToEntity(trays, PlayerPedId(), GetPedBoneIndex(PlayerPedId(), 28422), 0.01, -0.2,-0.2, 20.0, 0.0, 0.0, true, true, false, true, 1, true)
tray = true tray = true
@@ -311,9 +309,9 @@ CreateThread(function()
end) end)
for k, v in pairs (locations.CookMeth) do for k, v in pairs (locations.CookMeth) do
ps.boxTarget('cookMeth'..k, v.loc, {length = v.l, width = v.w, rotation = v.rot, height = 1.0},{ Bridge.Target.AddBoxZone('cookMeth'..k, v.loc, vector3(v.l, v.w, 2.0), v.loc.w or 180.0, {
{ {
label = ps.lang('meth.targetCook'), label = Bridge.Language.Locale('meth.targetCook'),
icon = 'fa-solid fa-temperature-high', icon = 'fa-solid fa-temperature-high',
action = function() action = function()
startcook(k, v.loc, v.offset or vec3(0,0,0), v.rotation or vector3(0,0,180.0)) startcook(k, v.loc, v.offset or vec3(0,0,0), v.rotation or vector3(0,0,180.0))
@@ -327,7 +325,7 @@ for k, v in pairs (locations.CookMeth) do
}, },
{ {
icon = "fas fa-sign-in-alt", icon = "fas fa-sign-in-alt",
label = ps.lang('meth.targetGrabTray'), label = Bridge.Language.Locale('meth.targetGrabTray'),
action = function() trayscarry() end, action = function() trayscarry() end,
canInteract = function() canInteract = function()
if not handleGang(v.gang) then return false end if not handleGang(v.gang) then return false end
@@ -340,28 +338,28 @@ for k, v in pairs (locations.CookMeth) do
end end
for k, v in pairs (locations.MethDials) do for k, v in pairs (locations.MethDials) do
ps.boxTarget('adjustMethDials'..k, v.loc, {length = v.l, width = v.w, rotation = v.rot, height = 1.0},{ Bridge.Target.AddBoxZone('adjustMethDials'..k, v.loc, vector3(v.l, v.w, 1.0), v.loc.w or 180.0, {
{ {
name = 'adjustdials', name = 'adjustdials',
icon = "fa-solid fa-temperature-three-quarters", icon = "fa-solid fa-temperature-three-quarters",
label = ps.lang('meth.targetHeat'), label = Bridge.Language.Locale('meth.targetHeat'),
action = function() action = function()
dials(locations.CookMeth[k].loc) dials(locations.CookMeth[k].loc)
end, end,
canInteract = function() --canInteract = function()
if not handleGang(v.gang) then return false end -- if not handleGang(v.gang) then return false end
if amonia and heated == false then return true end -- if amonia and heated == false then return true end
end --end
} }
}) })
end end
for k, v in pairs (locations.MethSmash) do for k, v in pairs (locations.MethSmash) do
ps.boxTarget('smashMeth'..k, v.loc, {length = v.l, width = v.w, rotation = v.rot, height = 1.0},{ Bridge.Target.AddBoxZone('smashMeth'..k, v.loc, vector3(v.l, v.w, 1.0), v.loc.w or 180.0, {
{ {
name = 'smash', name = 'smash',
icon = "fa-solid fa-weight-scale", icon = "fa-solid fa-weight-scale",
label = ps.lang('meth.targetSmash'), label = Bridge.Language.Locale('meth.targetSmash'),
action = function() action = function()
smash(v.loc, v.offset, v.rotation, v.bucket,k) smash(v.loc, v.offset, v.rotation, v.bucket,k)
end, end,
@@ -374,10 +372,10 @@ for k, v in pairs (locations.MethSmash) do
end end
for k, v in pairs (locations.MethTele) do for k, v in pairs (locations.MethTele) do
ps.boxTarget('meth_tele'..k, v.inside, {length = v.l, width = v.w, heading = v.rot}, { Bridge.Target.AddBoxZone('meth_tele'..k, v.inside, vector3(v.l, v.w, 1.0), v.rot, {
{ {
icon = 'fa-solid fa-door-open', icon = 'fa-solid fa-door-open',
label = ps.lang('coke.teleOut'), label = Bridge.Language.Locale('coke.teleOut'),
action = function() action = function()
SetEntityCoords(PlayerPedId(), v.outside) SetEntityCoords(PlayerPedId(), v.outside)
end, end,
@@ -386,10 +384,10 @@ for k, v in pairs (locations.MethTele) do
end end
} }
}) })
ps.boxTarget('meth_teleout'..k, v.outside, {length = v.l, width = v.w, heading = v.rot}, { Bridge.Target.AddBoxZone('meth_teleout'..k, v.outside, vector3(v.l, v.w, 1.0), v.rot, {
{ {
icon = 'fa-solid fa-door-closed', icon = 'fa-solid fa-door-closed',
label = ps.lang('coke.teleIn'), label = Bridge.Language.Locale('coke.teleIn'),
action = function() action = function()
SetEntityCoords(PlayerPedId(), v.inside) SetEntityCoords(PlayerPedId(), v.inside)
end, end,
@@ -408,12 +406,12 @@ RegisterCommand('offset', function()
end) end)
for k, v in pairs (locations.MethEph) do for k, v in pairs (locations.MethEph) do
ps.boxTarget('stealMethEph'..k, v.loc, {length = v.l, width = v.w, rotation = v.rot, height = 1.0},{ Bridge.Target.AddBoxZone('stealMethEph'..k, v.loc, vector3(v.l, v.w, 1.0), v.loc.w or 180.0, {
{ {
label = ps.lang('meth.targetStealEPH'), label = Bridge.Language.Locale('meth.targetStealEPH'),
icon = 'fa-solid fa-bucket', icon = 'fa-solid fa-bucket',
action = function() action = function()
if not ps.progressbar(ps.lang('meth.stealingEPH'), 4000, 'uncuff') then return end if not progressbar(Bridge.Language.Locale('meth.stealingEPH'), 4000, 'uncuff') then return end
TriggerServerEvent("md-drugs:server:geteph", k) TriggerServerEvent("md-drugs:server:geteph", k)
end, end,
canInteract = function() canInteract = function()
@@ -423,12 +421,12 @@ for k, v in pairs (locations.MethEph) do
}) })
end end
for k, v in pairs (locations.MethAce) do for k, v in pairs (locations.MethAce) do
ps.boxTarget('stealMethAce'..k, v.loc, {length = v.l, width = v.w, rotation = v.rot, height = 1.0},{ Bridge.Target.AddBoxZone('stealMethAce'..k, v.loc, vector3(v.l, v.w, 1.0), v.loc.w or 180.0, {
{ {
label = ps.lang('meth.targetStealACE'), label = Bridge.Language.Locale('meth.targetStealACE'),
icon = 'fa-solid fa-bucket', icon = 'fa-solid fa-bucket',
action = function() action = function()
if not ps.progressbar(ps.lang('meth.stealingACE'), 4000, 'uncuff') then return end if not progressbar(Bridge.Language.Locale('meth.stealingACE'), 4000, 'uncuff') then return end
TriggerServerEvent("md-drugs:server:getace", k) TriggerServerEvent("md-drugs:server:getace", k)
end, end,
canInteract = function() canInteract = function()
@@ -438,4 +436,3 @@ for k, v in pairs (locations.MethAce) do
}) })
end end
+8 -8
View File
@@ -6,7 +6,7 @@ local pdAlert = 90
local function getRoute() local function getRoute()
local Route = ps.callback('md-drugs:server:getRoute') local Route = ps.callback('md-drugs:server:getRoute')
if not Route then if not Route then
ps.notify(ps.lang('oxy.ditchCar'), "error") Bridge.Notify.SendNotify(Bridge.Language.Locale('oxy.ditchCar'), "error")
onMission = false onMission = false
return false return false
end end
@@ -25,11 +25,11 @@ local function getRoute()
PoliceCall(pdAlert) PoliceCall(pdAlert)
ps.entityTarget(oxybuyer,{ ps.entityTarget(oxybuyer,{
{ {
label = ps.lang('oxy.targetHandoff'), label = Bridge.Language.Locale('oxy.targetHandoff'),
icon = "fa-solid fa-dollar-sign", icon = "fa-solid fa-dollar-sign",
action = function() action = function()
if carryPackage then if carryPackage then
if not ps.progressbar(ps.lang('oxy.handingoff'), 4000, 'uncuff') then return end if not ps.progressbar(Bridge.Language.Locale('oxy.handingoff'), 4000, 'uncuff') then return end
TriggerServerEvent("md-drugs:server:giveoxybox") TriggerServerEvent("md-drugs:server:giveoxybox")
DeleteEntity(oxybuyer) DeleteEntity(oxybuyer)
DetachEntity(carryPackage, true, true) DetachEntity(carryPackage, true, true)
@@ -37,7 +37,7 @@ local function getRoute()
carryPackage = nil carryPackage = nil
getRoute() getRoute()
else else
ps.notify(ps.lang('oxy.emptyHands'), "error") Bridge.Notify.SendNotify(Bridge.Language.Locale('oxy.emptyHands'), "error")
end end
end end
} }
@@ -48,7 +48,7 @@ for k, v in pairs(locations.OxyPayForTruck) do
ps.boxTarget('oxyTruckPur' ..k , v.loc, {length = v.l, width = v.w, heading = v.rot}, { ps.boxTarget('oxyTruckPur' ..k , v.loc, {length = v.l, width = v.w, heading = v.rot}, {
{ {
icon = 'fa-solid fa-truck-fast', icon = 'fa-solid fa-truck-fast',
label = ps.lang('oxy.targetPay'), label = Bridge.Language.Locale('oxy.targetPay'),
action = function() action = function()
ps.requestModel("burrito3", 30000) ps.requestModel("burrito3", 30000)
@@ -62,17 +62,17 @@ for k, v in pairs(locations.OxyPayForTruck) do
exports[Config.Fuel]:SetFuel(oxycar, 100.0) exports[Config.Fuel]:SetFuel(oxycar, 100.0)
end end
TriggerEvent("vehiclekeys:client:SetOwner", GetVehicleNumberPlateText(oxycar)) TriggerEvent("vehiclekeys:client:SetOwner", GetVehicleNumberPlateText(oxycar))
ps.notify(ps.lang('oxy.keys'), 'success') Bridge.Notify.SendNotify(Bridge.Language.Locale('oxy.keys'), 'success')
onMission = true onMission = true
getRoute() getRoute()
ps.entityTarget(oxycar, { ps.entityTarget(oxycar, {
{ {
icon = "fa-solid fa-box", icon = "fa-solid fa-box",
label = ps.lang('oxy.targetGetPackage'), label = Bridge.Language.Locale('oxy.targetGetPackage'),
action = function() action = function()
if carryPackage then if carryPackage then
ps.notify(ps.lang('oxy.alreadyCarrying'), "error") Bridge.Notify.SendNotify(Bridge.Language.Locale('oxy.alreadyCarrying'), "error")
else else
local pos = GetEntityCoords(PlayerPedId(), true) local pos = GetEntityCoords(PlayerPedId(), true)
ps.requestAnim('anim@heists@box_carry@') ps.requestAnim('anim@heists@box_carry@')
+13 -9
View File
@@ -1,18 +1,22 @@
local locations = ps.callback('md-drugs:server:GetPharmaLocs') local locations = ps.callback('md-drugs:server:GetPharmaLocs')
ps.registerCallback("md-drugs:client:prescriptionpad", function(data, op) Bridge.Callback.Register("md-drugs:client:prescriptionpad", function(data, op)
if ps.getJobType() ~= 'ems' then return end local job = ps.getPlayerData().job.name
local input = ps.input(ps.lang('pharma.input.header'), { if job ~= 'ambulance' then
{type = 'select', title = ps.lang('pharma.input.title1'), options = data}, Bridge.Notify.SendNotify(Bridge.Language.Locale('pharma.notPharma'), 'error')
{type = 'select', title = ps.lang('pharma.input.title2'), options = op} return
end
local input = ps.input(Bridge.Language.Locale('pharma.input.header'), {
{type = 'select', title = Bridge.Language.Locale('pharma.input.title1'), options = data},
{type = 'select', title = Bridge.Language.Locale('pharma.input.title2'), options = op}
}) })
if not input[1] then return end if not input[1] then return end
if not ps.progressbar(ps.lang('pharma.write'), 4000, 'notepad') then return end if not ps.progressbar(Bridge.Language.Locale('pharma.write'), 4000, 'notepad') then return end
return {who = input[1], what = input[2]} return {who = input[1], what = input[2]}
end) end)
ps.registerCallback("md-drugs:client:unbottle", function() ps.registerCallback("md-drugs:client:unbottle", function()
if not ps.progressbar(ps.lang('pharma.opening'), 4000, 'uncuff') then return end if not ps.progressbar(Bridge.Language.Locale('pharma.opening'), 4000, 'uncuff') then return end
return true return true
end) end)
@@ -21,9 +25,9 @@ for k, v in pairs (locations.FillPrescription) do
ps.boxTarget('pharma' ..k , v.loc, {length = v.l, width = v.w, heading = v.rot}, { ps.boxTarget('pharma' ..k , v.loc, {length = v.l, width = v.w, heading = v.rot}, {
{ {
icon = 'fa-solid fa-capsules', icon = 'fa-solid fa-capsules',
label = ps.lang('pharma.targetFill'), label = Bridge.Language.Locale('pharma.targetFill'),
action = function() action = function()
if not ps.progressbar(ps.lang('pharma.fill'), 4000, 'uncuff') then return end if not ps.progressbar(Bridge.Language.Locale('pharma.fill'), 4000, 'uncuff') then return end
TriggerServerEvent("md-drugs:server:fillprescription", k) TriggerServerEvent("md-drugs:server:fillprescription", k)
end, end,
} }
+10 -10
View File
@@ -1,41 +1,41 @@
local DrugPlants = { local DrugPlants = {
{model = 'prop_plant_01a', label = 'coke', langs = ps.lang('coke.targetPick'), tbl = GlobalState.CocaPlant, plantTbl = {}, {model = 'prop_plant_01a', label = 'coke', langs = Bridge.Language.Locale('coke.targetPick'), tbl = GlobalState.CocaPlant, plantTbl = {},
pick = function(loc) pick = function(loc)
if not ps.progressbar(ps.lang('coke.picking'), 4000, 'uncuff') then return end if not ps.progressbar(Bridge.Language.Locale('coke.picking'), 4000, 'uncuff') then return end
TriggerServerEvent("coke:pickupCane", loc) TriggerServerEvent("coke:pickupCane", loc)
return true return true
end, end,
allow = Config.Drugs.cocaine, allow = Config.Drugs.cocaine,
}, },
{model = 'prop_plant_01b', label = 'heroin',langs = ps.lang('heroin.targetPick'), tbl = GlobalState.PoppyPlants, plantTbl = {}, {model = 'prop_plant_01b', label = 'heroin',langs = Bridge.Language.Locale('heroin.targetPick'), tbl = GlobalState.PoppyPlants, plantTbl = {},
pick = function(loc) pick = function(loc)
if not ps.progressbar(ps.lang('heroin.picking'), 4000, 'uncuff') then return end if not ps.progressbar(Bridge.Language.Locale('heroin.picking'), 4000, 'uncuff') then return end
TriggerServerEvent("heroin:pickupCane", loc) TriggerServerEvent("heroin:pickupCane", loc)
return true return true
end, end,
allow = Config.Drugs.heroin, allow = Config.Drugs.heroin,
}, },
{model = 'prop_cactus_03', label = 'Mescaline', langs = ps.lang('mesc.targetPick'), tbl = GlobalState.Mescaline, plantTbl = {}, {model = 'prop_cactus_03', label = 'Mescaline', langs = Bridge.Language.Locale('mesc.targetPick'), tbl = GlobalState.Mescaline, plantTbl = {},
pick = function(loc) pick = function(loc)
if not ps.progressbar(ps.lang('mesc.picking'), 4000, 'uncuff') then return end if not ps.progressbar(Bridge.Language.Locale('mesc.picking'), 4000, 'uncuff') then return end
TriggerServerEvent("Mescaline:pickupCane", loc) TriggerServerEvent("Mescaline:pickupCane", loc)
return true return true
end, end,
allow = Config.Drugs.mescaline, allow = Config.Drugs.mescaline,
}, },
{model = 'prop_weed_01', label = 'weed', langs = ps.lang('weed.targetPick'), tbl = GlobalState.WeedPlant, plantTbl = {}, {model = 'prop_weed_01', label = 'weed', langs = Bridge.Language.Locale('weed.targetPick'), tbl = GlobalState.WeedPlant, plantTbl = {},
pick = function(loc) pick = function(loc)
if not ps.progressbar(ps.lang('weed.picking'), 4000, 'uncuff') then return end if not ps.progressbar(Bridge.Language.Locale('weed.picking'), 4000, 'uncuff') then return end
TriggerServerEvent("weed:pickupCane", loc) TriggerServerEvent("weed:pickupCane", loc)
return true return true
end, end,
allow = Config.Drugs.weed, allow = Config.Drugs.weed,
}, },
{model = 'mushroom', label = 'shrooms', langs = ps.lang('shrooms.targetPick'), tbl = GlobalState.shrooms, plantTbl = {}, {model = 'mushroom', label = 'shrooms', langs = Bridge.Language.Locale('shrooms.targetPick'), tbl = GlobalState.shrooms, plantTbl = {},
pick = function(loc) pick = function(loc)
if not ps.progressbar(ps.lang('shrooms.picking'), 4000, 'uncuff') then return end if not ps.progressbar(Bridge.Language.Locale('shrooms.picking'), 4000, 'uncuff') then return end
TriggerServerEvent("shrooms:pickupCane", loc) TriggerServerEvent("shrooms:pickupCane", loc)
return true return true
end, end,
+1 -1
View File
@@ -17,7 +17,7 @@ local function EcstasyEffect()
end end
ps.registerCallback("md-drugs:client:shrooms", function() ps.registerCallback("md-drugs:client:shrooms", function()
if not ps.progressbar(ps.lang('shrooms.eat'), 5000, 'eat') then return end if not ps.progressbar(Bridge.Language.Locale('shrooms.eat'), 5000, 'eat') then return end
CreateThread(function() CreateThread(function()
EcstasyEffect() EcstasyEffect()
end) end)
+12 -12
View File
@@ -4,10 +4,10 @@ for k, v in pairs (locations.WeedDry) do
ps.boxTarget('weed_dry'..k, v.loc, {length = v.l, width = v.w, heading = v.rot}, { ps.boxTarget('weed_dry'..k, v.loc, {length = v.l, width = v.w, heading = v.rot}, {
{ {
icon = 'fa-solid fa-cannabis', icon = 'fa-solid fa-cannabis',
label = ps.lang('weed.targetDry'), label = Bridge.Language.Locale('weed.targetDry'),
action = function() action = function()
if not ps.hasItem('wetcannabis', 1) then if not ps.hasItem('wetcannabis', 1) then
ps.notify(ps.lang('weed.noDry'), "error") Bridge.Notify.SendNotify(Bridge.Language.Locale('weed.noDry'), "error")
return return
end end
if drying then return end if drying then return end
@@ -15,13 +15,13 @@ for k, v in pairs (locations.WeedDry) do
local weedplant = CreateObject("bkr_prop_weed_drying_01a", loc.x, loc.y+.2, loc.z, true, false) local weedplant = CreateObject("bkr_prop_weed_drying_01a", loc.x, loc.y+.2, loc.z, true, false)
drying = true drying = true
FreezeEntityPosition(weedplant, true) FreezeEntityPosition(weedplant, true)
ps.notify(ps.lang('weed.wait'), "success") Bridge.Notify.SendNotify(Bridge.Language.Locale('weed.wait'), "success")
Wait(math.random(1000,5000)) Wait(math.random(1000,5000))
ps.notify(ps.lang('weed.take'), "success") Bridge.Notify.SendNotify(Bridge.Language.Locale('weed.take'), "success")
ps.entityTarget(weedplant, { ps.entityTarget(weedplant, {
{ {
icon = "fa-solid fa-cannabis", icon = "fa-solid fa-cannabis",
label = ps.lang('weed.targetDryed'), label = Bridge.Language.Locale('weed.targetDryed'),
action = function() action = function()
DeleteEntity(weedplant) DeleteEntity(weedplant)
drying = false drying = false
@@ -42,7 +42,7 @@ for k, v in pairs (locations.WeedTele) do
ps.boxTarget('weed_tele'..k, v.inside, {length = v.l, width = v.w, heading = v.rot}, { ps.boxTarget('weed_tele'..k, v.inside, {length = v.l, width = v.w, heading = v.rot}, {
{ {
icon = 'fa-solid fa-door-open', icon = 'fa-solid fa-door-open',
label = ps.lang('weed.teleportOut'), label = Bridge.Language.Locale('weed.teleportOut'),
action = function() action = function()
SetEntityCoords(PlayerPedId(), v.outside) SetEntityCoords(PlayerPedId(), v.outside)
end end
@@ -51,7 +51,7 @@ for k, v in pairs (locations.WeedTele) do
ps.boxTarget('weed_teleout'..k, v.outside, {length = v.l, width = v.w, heading = v.rot}, { ps.boxTarget('weed_teleout'..k, v.outside, {length = v.l, width = v.w, heading = v.rot}, {
{ {
icon = 'fa-solid fa-door-closed', icon = 'fa-solid fa-door-closed',
label = ps.lang('weed.teleportIn'), label = Bridge.Language.Locale('weed.teleportIn'),
action = function() action = function()
SetEntityCoords(PlayerPedId(), v.inside) SetEntityCoords(PlayerPedId(), v.inside)
end end
@@ -83,7 +83,7 @@ local function AlienEffect()
end end
RegisterNetEvent("md-drugs:client:dodabs", function() RegisterNetEvent("md-drugs:client:dodabs", function()
if not ps.progressbar(ps.lang('weed.dabs'), 4000, 'bong2') then AlienEffect() return end if not ps.progressbar(Bridge.Language.Locale('weed.dabs'), 4000, 'bong2') then AlienEffect() return end
end) end)
local function createBluntOptions(contextId, contextTitle, eventLabelPrefix, tableName) local function createBluntOptions(contextId, contextTitle, eventLabelPrefix, tableName)
@@ -110,11 +110,11 @@ local function createBluntOptions(contextId, contextTitle, eventLabelPrefix, tab
end end
RegisterNetEvent('md-drugs:client:makeBluntWrap', function(data) RegisterNetEvent('md-drugs:client:makeBluntWrap', function(data)
createBluntOptions('mddrugsbluntwraps', "Dipping Syrup", ps.lang('weed.bluntWrap'), 'bluntwrap') createBluntOptions('mddrugsbluntwraps', "Dipping Syrup", Bridge.Language.Locale('weed.bluntWrap'), 'bluntwrap')
end) end)
RegisterNetEvent('md-drugs:client:rollBlunt', function(data) RegisterNetEvent('md-drugs:client:rollBlunt', function(data)
createBluntOptions('mddrugsblunts', "Roll Blunts", ps.lang('weed.blunts'), 'blunts') createBluntOptions('mddrugsblunts', "Roll Blunts", Bridge.Language.Locale('weed.blunts'), 'blunts')
end) end)
for k, v in pairs (locations.WeedSalesman) do for k, v in pairs (locations.WeedSalesman) do
@@ -126,7 +126,7 @@ for k, v in pairs (locations.WeedSalesman) do
ps.entityTarget(ped, { ps.entityTarget(ped, {
{ {
icon = "fa-solid fa-cannabis", icon = "fa-solid fa-cannabis",
label = ps.lang('weed.targetSales'), label = Bridge.Language.Locale('weed.targetSales'),
action = function() action = function()
local itemList = ps.callback('md-drugs:server:getWeedItems') local itemList = ps.callback('md-drugs:server:getWeedItems')
local options = {} local options = {}
@@ -140,7 +140,7 @@ for k, v in pairs (locations.WeedSalesman) do
{type = 'number', title = 'How Many To Buy', min = 1, max = 1000} {type = 'number', title = 'How Many To Buy', min = 1, max = 1000}
}) })
if not input and input[1] then return end if not input and input[1] then return end
if not ps.progressbar(ps.lang('weed.buying', ps.getLabel(m)), 2000, 'uncuff') then return end if not ps.progressbar(Bridge.Language.Locale('weed.buying', ps.getLabel(m)), 2000, 'uncuff') then return end
TriggerServerEvent('md-drugs:server:buyWeedItem', k, m, input[1]) TriggerServerEvent('md-drugs:server:buyWeedItem', k, m, input[1])
end end
} }
+26 -26
View File
@@ -45,32 +45,32 @@ local function spawnShops()
FreezeEntityPosition(ped, true) FreezeEntityPosition(ped, true)
SetEntityInvincible(ped, true) SetEntityInvincible(ped, true)
SetBlockingOfNonTemporaryEvents(ped, true) SetBlockingOfNonTemporaryEvents(ped, true)
ps.entityTarget(ped, { --ps.entityTarget(ped, {
{ -- {
label = ps.lang('Whippit.targetShop'), -- label = Bridge.Language.Locale('Whippit.targetShop'),
icon = 'fa-solid fa-cart-shopping', -- icon = 'fa-solid fa-cart-shopping',
action = function() -- action = function()
local menu = {} -- local menu = {}
local items = ps.callback('md-drugs:server:getwhippitShop') -- local items = ps.callback('md-drugs:server:getwhippitShop')
for item, price in pairs (items) do -- for item, price in pairs (items) do
menu[#menu + 1] = { -- menu[#menu + 1] = {
title = ps.getLabel(item), -- title = ps.getLabel(item),
icon = ps.getImage(item), -- icon = ps.getImage(item),
description = '$' .. price, -- description = '$' .. price,
action = function() -- action = function()
local amount = ps.input(ps.getLabel(item), { -- local amount = ps.input(ps.getLabel(item), {
{type = 'number', label = 'Amount', name = 'amount', min = 1, max = 100, default = 1} -- {type = 'number', label = 'Amount', name = 'amount', min = 1, max = 100, default = 1}
}) -- })
if amount and amount[1] then -- if amount and amount[1] then
TriggerServerEvent('md-drugs:server:buyWhippitItem', k, item, amount[1]) -- TriggerServerEvent('md-drugs:server:buyWhippitItem', k, item, amount[1])
end -- end
end -- end
} -- }
end -- end
ps.menu(ps.lang('Whippit.shopHeader'), ps.lang('Whippit.shopHeader'), menu) -- ps.menu(Bridge.Language.Locale('Whippit.shopHeader'), Bridge.Language.Locale('Whippit.shopHeader'), menu)
end -- end
}, -- },
}) --})
end end
end end
+9 -9
View File
@@ -67,7 +67,7 @@ function SetUpPeds(drugCount)
elseif drugCount > settings.WholesaleAmbushTier1 then elseif drugCount > settings.WholesaleAmbushTier1 then
tierName = "Medium" tierName = "Medium"
end end
ps.notify(string.format(ps.lang('wholesale.ambush'), attackerCount, tierName), 'error') Bridge.Notify.SendNotify(string.format(Bridge.Language.Locale('wholesale.ambush'), attackerCount, tierName), 'error')
end end
RegisterNetEvent("md-drugs:client:GetLocation", function(drug) RegisterNetEvent("md-drugs:client:GetLocation", function(drug)
@@ -86,13 +86,13 @@ RegisterNetEvent("md-drugs:client:GetLocation", function(drug)
local maxPayout = math.floor(drug.price.max * (1 + potentialBonus)) local maxPayout = math.floor(drug.price.max * (1 + potentialBonus))
local totalMinPayout = drug.count * minPayout local totalMinPayout = drug.count * minPayout
local totalMaxPayout = drug.count * maxPayout local totalMaxPayout = drug.count * maxPayout
ps.notify(string.format(ps.lang('wholesale.count'), drug.count), 'info') Bridge.Notify.SendNotify(string.format(Bridge.Language.Locale('wholesale.count'), drug.count), 'info')
if bonusPercent > 0 then if bonusPercent > 0 then
ps.notify(string.format(ps.lang('wholesale.bonus'), bonusPercent), 'info') Bridge.Notify.SendNotify(string.format(Bridge.Language.Locale('wholesale.bonus'), bonusPercent), 'info')
end end
ps.notify(string.format(ps.lang('wholesale.estimate'), totalMinPayout, totalMaxPayout), 'info') Bridge.Notify.SendNotify(string.format(Bridge.Language.Locale('wholesale.estimate'), totalMinPayout, totalMaxPayout), 'info')
elseif drug.count <= 0 then elseif drug.count <= 0 then
ps.notify(ps.lang('wholesale.no_drugs'), 'error') Bridge.Notify.SendNotify(Bridge.Language.Locale('wholesale.no_drugs'), 'error')
end end
ps.requestModel("g_m_y_famdnf_01", settings.RequestModelTime) ps.requestModel("g_m_y_famdnf_01", settings.RequestModelTime)
local current = "g_m_y_famdnf_01" local current = "g_m_y_famdnf_01"
@@ -100,12 +100,12 @@ RegisterNetEvent("md-drugs:client:GetLocation", function(drug)
FreezeEntityPosition(drugdealer, true) FreezeEntityPosition(drugdealer, true)
SetEntityInvincible(drugdealer, true) SetEntityInvincible(drugdealer, true)
ps.entityTarget(drugdealer, {{ ps.entityTarget(drugdealer, {{
label = ps.lang('wholesale.targetBuyer'), label = Bridge.Language.Locale('wholesale.targetBuyer'),
icon = "fas fa-eye", icon = "fas fa-eye",
action = function() action = function()
local luck = math.random(1,100) local luck = math.random(1,100)
if luck <= settings.SuccessfulChance then if luck <= settings.SuccessfulChance then
if not ps.progressbar(ps.lang('wholesale.wholesaling'), 4000, 'uncuff') then return end if not ps.progressbar(Bridge.Language.Locale('wholesale.wholesaling'), 4000, 'uncuff') then return end
TriggerServerEvent("md-drugs:server:SuccessSale", drug) TriggerServerEvent("md-drugs:server:SuccessSale", drug)
else else
ps.progressbar("Deal Going Bad", 4000, 'uncuff') ps.progressbar("Deal Going Bad", 4000, 'uncuff')
@@ -133,7 +133,7 @@ RegisterNetEvent("md-drugs:client:GetLocation", function(drug)
if timer <= settings.WholesaleTimeout or #(GetEntityCoords(PlayerPedId()) - vector3(loc.x, loc.y, loc.z) ) < 4.0 then if timer <= settings.WholesaleTimeout or #(GetEntityCoords(PlayerPedId()) - vector3(loc.x, loc.y, loc.z) ) < 4.0 then
timer = 0 timer = 0
else else
ps.notify(ps.lang('wholesale.tooLong'), 'error') Bridge.Notify.SendNotify(Bridge.Language.Locale('wholesale.tooLong'), 'error')
DeleteEntity(drugdealer) DeleteEntity(drugdealer)
TriggerServerEvent('md-drugs:server:CleanupWholesale') TriggerServerEvent('md-drugs:server:CleanupWholesale')
if settings.WholesaleResetOnTimeout then if settings.WholesaleResetOnTimeout then
@@ -148,5 +148,5 @@ RegisterNetEvent('md-drugs:client:WholesaleComplete', function(data)
if data.bonus > 0 then if data.bonus > 0 then
bonusText = " (+" .. data.bonus .. "% quantity bonus)" bonusText = " (+" .. data.bonus .. "% quantity bonus)"
end end
ps.notify(string.format(ps.lang('wholesale.complete'), data.quantity, data.payout, bonusText), 'success') Bridge.Notify.SendNotify(string.format(Bridge.Language.Locale('wholesale.complete'), data.quantity, data.payout, bonusText), 'success')
end) end)
+24 -24
View File
@@ -9,19 +9,19 @@ end
ps.registerCallback('md-drugs:client:setpress', function(xtcData) ps.registerCallback('md-drugs:client:setpress', function(xtcData)
if xtcpress then if xtcpress then
ps.notify(ps.lang('xtc.alreadyOut'), 'error') Bridge.Notify.SendNotify(Bridge.Language.Locale('xtc.alreadyOut'), 'error')
return return
end end
local coords, head = StartRay2() local coords, head = StartRay2()
xtcpress = true xtcpress = true
if not ps.progressbar(ps.lang('xtc.settingDown'), 4000, 'uncuff') then return end if not ps.progressbar(Bridge.Language.Locale('xtc.settingDown'), 4000, 'uncuff') then return end
local press = CreateObject("bkr_prop_coke_press_01aa", coords.x, coords.y, coords.z, true, false, false) local press = CreateObject("bkr_prop_coke_press_01aa", coords.x, coords.y, coords.z, true, false, false)
PlaceObjectOnGroundProperly(press) PlaceObjectOnGroundProperly(press)
Freeze(press, true, head) Freeze(press, true, head)
local options = { local options = {
{ {
icon = "fas fa-eye", icon = "fas fa-eye",
label = ps.lang('xtc.targetMake'), label = Bridge.Language.Locale('xtc.targetMake'),
distance = 2.0, distance = 2.0,
action = function() action = function()
local options = {} local options = {}
@@ -32,8 +32,8 @@ ps.registerCallback('md-drugs:client:setpress', function(xtcData)
title = ps.getLabel(k), title = ps.getLabel(k),
description = descript, description = descript,
action = function() action = function()
if not minigame() then ps.notify(ps.lang('xtc.fail'), "error") return end if not minigame() then Bridge.Notify.SendNotify(Bridge.Language.Locale('xtc.fail'), "error") return end
if not ps.progressbar(ps.lang('xtc.making', ps.getLabel(k)), 4000, 'uncuff') then return end if not ps.progressbar(Bridge.Language.Locale('xtc.making', ps.getLabel(k)), 4000, 'uncuff') then return end
TriggerServerEvent("md-drugs:server:makextc", k) TriggerServerEvent("md-drugs:server:makextc", k)
end, end,
distance = 2.0 distance = 2.0
@@ -47,9 +47,9 @@ ps.registerCallback('md-drugs:client:setpress', function(xtcData)
}, },
{ {
icon = "fas fa-eye", icon = "fas fa-eye",
label = ps.lang('xtc.targetPickup'), label = Bridge.Language.Locale('xtc.targetPickup'),
action = function() action = function()
if not ps.progressbar(ps.lang('xtc.picking'), 5000, 'uncuff') then return end if not ps.progressbar(Bridge.Language.Locale('xtc.picking'), 5000, 'uncuff') then return end
DeleteObject(press) DeleteObject(press)
xtcpress = false xtcpress = false
TriggerServerEvent("md-drugs:server:getpressback") TriggerServerEvent("md-drugs:server:getpressback")
@@ -67,10 +67,10 @@ for k, v in pairs(locations.mdp2p) do
ps.boxTarget('mdp2p'..k, v.loc, {length = v.l, width = v.w, heading = v.rot}, { ps.boxTarget('mdp2p'..k, v.loc, {length = v.l, width = v.w, heading = v.rot}, {
{ {
icon = 'fa-solid fa-flask', icon = 'fa-solid fa-flask',
label = ps.lang('xtc.targetStealMDP2P'), label = Bridge.Language.Locale('xtc.targetStealMDP2P'),
action = function() action = function()
if not minigame() then ps.notify(ps.lang('xtc.fail'), "error") return end if not minigame() then Bridge.Notify.SendNotify(Bridge.Language.Locale('xtc.fail'), "error") return end
if not ps.progressbar(ps.lang('xtc.stealingMDP2P'), 4000, 'uncuff') then return end if not ps.progressbar(Bridge.Language.Locale('xtc.stealingMDP2P'), 4000, 'uncuff') then return end
TriggerServerEvent("md-drugs:server:stealmdp2p", k) TriggerServerEvent("md-drugs:server:stealmdp2p", k)
end, end,
canInteract = function() canInteract = function()
@@ -83,10 +83,10 @@ for k, v in pairs(locations.isosafrole) do
ps.boxTarget('isosafrole'..k, v.loc, {length = v.l, width = v.w, heading = v.rot}, { ps.boxTarget('isosafrole'..k, v.loc, {length = v.l, width = v.w, heading = v.rot}, {
{ {
icon = 'fa-solid fa-flask', icon = 'fa-solid fa-flask',
label = ps.lang('xtc.targetStealIsosafrole'), label = Bridge.Language.Locale('xtc.targetStealIsosafrole'),
action = function() action = function()
if not minigame() then ps.notify(ps.lang('xtc.fail'), "error") return end if not minigame() then Bridge.Notify.SendNotify(Bridge.Language.Locale('xtc.fail'), "error") return end
if not ps.progressbar(ps.lang('xtc.stealingIsosafrole'), 4000, 'uncuff') then return end if not ps.progressbar(Bridge.Language.Locale('xtc.stealingIsosafrole'), 4000, 'uncuff') then return end
TriggerServerEvent("md-drugs:server:stealisosafrole", k) TriggerServerEvent("md-drugs:server:stealisosafrole", k)
end, end,
canInteract = function() canInteract = function()
@@ -100,10 +100,10 @@ for k, v in pairs(locations.rawxtcloc) do
ps.boxTarget('xtcraw'..k, v.loc, {length = v.l, width = v.w, heading = v.rot}, { ps.boxTarget('xtcraw'..k, v.loc, {length = v.l, width = v.w, heading = v.rot}, {
{ {
icon = 'fa-solid fa-flask', icon = 'fa-solid fa-flask',
label = ps.lang('xtc.targetRaw'), label = Bridge.Language.Locale('xtc.targetRaw'),
action = function() action = function()
if not minigame() then ps.notify(ps.lang('xtc.fail'), "error") return end if not minigame() then Bridge.Notify.SendNotify(Bridge.Language.Locale('xtc.fail'), "error") return end
if not ps.progressbar(ps.lang('xtc.makingRaw'), 4000, 'uncuff') then return end if not ps.progressbar(Bridge.Language.Locale('xtc.makingRaw'), 4000, 'uncuff') then return end
TriggerServerEvent("md-drugs:server:makingrawxtc", k) TriggerServerEvent("md-drugs:server:makingrawxtc", k)
end, end,
canInteract = function() canInteract = function()
@@ -120,7 +120,7 @@ for k, v in pairs(locations.xtcpress) do
ps.entityTarget(ped, { ps.entityTarget(ped, {
{ {
icon = 'fa-solid fa-flask', icon = 'fa-solid fa-flask',
label = ps.lang('xtc.getPress'), label = Bridge.Language.Locale('xtc.getPress'),
action = function() action = function()
local options = {} local options = {}
local recipeList = ps.callback('md-drugs:server:getpressrecipes') local recipeList = ps.callback('md-drugs:server:getpressrecipes')
@@ -129,10 +129,10 @@ for k, v in pairs(locations.xtcpress) do
options[#options + 1] = { options[#options + 1] = {
icon = ps.getImage(m), icon = ps.getImage(m),
title = ps.getLabel(m), title = ps.getLabel(m),
description = ps.lang('xtc.buySingle', d.cash), description = Bridge.Language.Locale('xtc.buySingle', d.cash),
type = d.type, type = d.type,
action = function() action = function()
if not ps.progressbar(ps.lang('xtc.buyp'), 4000, 'uncuff') then return end if not ps.progressbar(Bridge.Language.Locale('xtc.buyp'), 4000, 'uncuff') then return end
TriggerServerEvent('md-drugs:server:buypress',k, m) TriggerServerEvent('md-drugs:server:buypress',k, m)
end, end,
} }
@@ -144,7 +144,7 @@ for k, v in pairs(locations.xtcpress) do
description = descript, description = descript,
type = d.type, type = d.type,
action = function() action = function()
if not ps.progressbar(ps.lang('xtc.buyp'), 4000, 'uncuff') then return end if not ps.progressbar(Bridge.Language.Locale('xtc.buyp'), 4000, 'uncuff') then return end
TriggerServerEvent("md-drugs:server:upgradepress", k, m) TriggerServerEvent("md-drugs:server:upgradepress", k, m)
end, end,
distance = 2.0 distance = 2.0
@@ -163,7 +163,7 @@ for k, v in pairs (locations.stamp) do
ps.boxTarget('xtcstamp'..k, v.loc, {length = v.l, width = v.w, heading = v.rot}, { ps.boxTarget('xtcstamp'..k, v.loc, {length = v.l, width = v.w, heading = v.rot}, {
{ {
icon = 'fa-solid fa-flask', icon = 'fa-solid fa-flask',
label = ps.lang('xtc.targetStamp'), label = Bridge.Language.Locale('xtc.targetStamp'),
action = function() action = function()
local item = { local item = {
{item = 'white_xtc', label = ps.getLabel('white_xtc'), color = 'white'}, {item = 'white_xtc', label = ps.getLabel('white_xtc'), color = 'white'},
@@ -176,10 +176,10 @@ for k, v in pairs (locations.stamp) do
options[#options + 1] = { options[#options + 1] = {
icon = ps.getImage(d.item), icon = ps.getImage(d.item),
title = d.label, title = d.label,
description = ps.lang('xtc.stamp_desc', d.color), description = Bridge.Language.Locale('xtc.stamp_desc', d.color),
action = function() action = function()
if not minigame() then ps.notify(ps.lang('xtc.fail'), "error") return end if not minigame() then Bridge.Notify.SendNotify(Bridge.Language.Locale('xtc.fail'), "error") return end
if not ps.progressbar(ps.lang('xtc.stamping', d.label), 4000, 'uncuff') then return end if not ps.progressbar(Bridge.Language.Locale('xtc.stamping', d.label), 4000, 'uncuff') then return end
TriggerServerEvent("md-drugs:server:stamp", k, d.color) TriggerServerEvent("md-drugs:server:stamp", k, d.color)
end, end,
distance = 2.0 distance = 2.0
+4 -2
View File
@@ -11,10 +11,11 @@ client_scripts {
} }
server_scripts { server_scripts {
'@oxmysql/lib/MySQL.lua',
'server/functions.lua', 'server/functions.lua',
'server/plantSpawns.lua', 'server/plantSpawns.lua',
'serverRun.lua', 'serverRun.lua',
'@oxmysql/lib/MySQL.lua',
} }
shared_scripts { shared_scripts {
@@ -27,5 +28,6 @@ lua54 'yes'
files { files {
'client/**.lua', 'client/**.lua',
'server/**.lua', 'server/**.lua',
'locales/**.lua' 'locales/**.lua',
'locales/**.json'
} }
+267
View File
@@ -0,0 +1,267 @@
{
"Catches": {
"notIn": "You Are Not In The Correct Location",
"needItems": "You Do Not Have The Required Items",
"notEnoughMoney": "Youre To Broke",
"buySuccess": "You Bought %s %s For $%s",
"itemMissings": "You Need %s",
"itemNeeded": "You Need %s",
"cooldown": "Slow Down Speed Racer",
"invalidItem": "This Item Is Not Sold Here",
"onCooldownWarn": "%s Attempted To Run Event %s \n while on cooldown",
"noCops": "Not Enough Police Online"
},
"coke": {
"targetPick": "Pick Coca Leaf",
"picking": "Picking Coca Leaf",
"targetMakePow": "Make Cocaine Powder",
"noleaf": "You Need A Coke Leaf",
"makePow": "Chopping Leaves into Powder",
"targetCutCoke": "Cut Cocaine",
"targetBagCoke": "Bag Cocaine",
"teleIn": "Enter the Lab",
"teleOut": "Exit the Lab",
"needBakingSoda": "You Need Baking Soda For This"
},
"Cornerselling": {
"inVeh": "Stranger Danger!",
"selling": "Selling %s for $%s",
"deny": "Fuck That Offer",
"wait": "Waiting For Customer",
"nodrugs": "You Do Not Have Any Drugs To Sell",
"searching": "Searching For Nearby Customers",
"targetTakeBack": "Take Back Drugs",
"targetSell": "Sell %s Of %s For $%s",
"targetDeny": "Deny Offer",
"stopped": "Your Lazy Ass Cant Even Sell Drugs!",
"start": "Go Make Your Mom Proud",
"gotRobbed": "You Got Robbed Nerd!",
"gotBack": "You Got Your Stuff Back!",
"notEnough": "You Dont Have Enough Of This Item",
"comDes": "Sell Things On The Corner"
},
"crack": {
"targetMake": "Cook Some Crack",
"cook": "Cooking Crack",
"targetBag": "Bag Crack",
"bag": "Bagging Crack"
},
"Deliveries": {
"targetGetDel": "Get Delivery Mission",
"targetOpenShop": "Open Dealer Shop",
"shopHeader": "Dealer Shop",
"targetHandOff": "Hand Off Delivery",
"delivering": "Handing The Package To Drug Dealer",
"alreadyDelivering": "You Are Already Delivering A Package",
"slowAf": "You Took To Long!",
"newDealerHelp": {
"help": "Place A Dealer",
"name": "Dealer Name",
"timeMin": "Minimum Time",
"timeMax": "Maximum Time"
},
"DealerExists": "Dealer Already Exists",
"deleteDealer": {
"help": "Delete A Dealer",
"name": "Dealer Name"
},
"deleteDealerSuccess": "Deleted Dealer",
"deleteDealerFail": "Failed To Delete Dealer"
},
"heroin": {
"targetPick": "Pick Heroin",
"picking": "Picking Heroin",
"targetCook": "Cook Heroin",
"pbCook": "Cooking Up Heroin",
"targetPickup": "Pick Up Lab",
"pbPickup": "Picking Up Lab",
"targetClean": "Clean Lab",
"pbClean": "Cleaning Lab",
"targetDry": "Dry Out Plant",
"pbDry": "Drying Out Plant",
"targetCutHeroin": "Cut Heroin",
"pbCutHeroin": "Cutting Heroin",
"targetBuyKit": "Buy Heroin Lab Kit",
"pbBuyKit": "Buying Heroin Lab Kit",
"tableout": "You Already Have A Table Out",
"placing": "Placing Down Table",
"targetFill": "Fill Syringe",
"pbFill": "Filling Syringe",
"hasKitAlready": "You Already Have A Heroin Lab Kit",
"notEnoughMoney": "You Need $%s In Cash For This",
"placedKit": "You Placed Down Your Heroin Lab Kit",
"failed": "You Failed To Make Heroin And Lost Your Ingredients"
},
"lean": {
"stealFromTruck": "Steal From Truck",
"startMission": "Start Lean Mission",
"notOnRun": "You Are Not On A Lean Run",
"alreadyChasing": "You Are Already Chasing A Truck"
},
"lsd": {
"targetHeat": "Heating LSD",
"heating": "Heating Up LSD",
"targetRefine": "Refine The Acid",
"refining": "Refining The Acid",
"targetDipping": "Dip Tabs",
"dipping": "Dipping Tabs",
"targetPickup": "Pick Up Lab Kit",
"packup": "Packing Up Lab Kit",
"targetClean": "Clean Lab Kit",
"needCleaning": "You Need A Cleaning Kit To Clean The Lab",
"cleaning": "Cleaning Lab Kit",
"targetLys": "Steal Lysergic Acid",
"stealLys": "Stealing Lysergic Acid",
"targetDie": "Steal Diethylamide",
"stealDie": "Stealing Diethylamide",
"targetBuyTab": "Buy Tab Paper",
"targetBuyKit": "Buy LSD Lab Kit",
"alreadyOwn": "You Already Own This Item",
"buyingKit": "Buying LSD Lab Kit",
"tableout": "You Already Have A Table Out",
"placing": "Placing Lab Kit Down!",
"failed": "You Suck At Making Drugs"
},
"mesc": {
"targetPick": "Pick Cactus",
"picking": "Picking Cactus",
"targetDry": "Dry Cactus",
"dry": "Drying Cactus"
},
"meth": {
"alreadyChasing": "You Already Are Chasing A Truck",
"targetStealFromCar": "Steal From Meth Car",
"targetHeist": "Start Meth Mission",
"started": "You Already Have Meth Cooking",
"increaseHeat": "You Increased The Heat",
"targetBag": "Bag Meth",
"targetCook": "Cook Meth",
"targetGrabTray": "Grab Meth Tray",
"targetHeat": "Adjust The Dials",
"targetSmash": "Smash The Tray",
"targetStealEPH": "Steal Ephedrine",
"stealingEPH": "Stealing Ephedrine",
"targetStealACE": "Steal Acetone",
"stealingACE": "Stealing Acetone",
"notOnRun": "You Are Not On A Meth Run",
"onCooldown": "You Are On A Cooldown",
"teleIn": "Enter the Lab",
"teleOut": "Exit the Lab"
},
"oxy": {
"ditchCar": "The Van Is Hot, Leave It Somewhere",
"targetHandoff": "Hand Off The Package",
"handingoff": "Handing Off The Package",
"emptyHands": "You Are Not Carrying Anything",
"targetPay": "Rent Oxy Van",
"keys": "The Keys Are In The Van",
"targetGetPackage": "Grab Package",
"alreadyCarrying": "You Are Already Carrying A Package",
"paid": "You Paid $%s To Rent The Van",
"notOn": "You Are Not On A Route"
},
"pharma": {
"input": {
"header": "Who To Give A Prescription To?",
"title1": "Player Name",
"title2": "Prescription"
},
"write": "Writing Prescription",
"opening": "Opening Prescription Bottle",
"targetFill": "Fill Prescription",
"fill": "Getting Prescription Filled",
"canceled": "You Canceled The Prescription",
"unbottle": "You Opened The Bottle"
},
"shrooms": {
"targetPick": "Pick Shrooms",
"picking": "Picking Shrooms",
"eat": "Eating Shrooms",
"cancel": "Decided To Not Do Shrooms",
"took": "You Took Some Shrooms!"
},
"weed": {
"targetPick": "Pick Weed",
"picking": "Picking Weed",
"targetDry": "Dry Weed",
"noDry": "You Need Wet Weed For This",
"wait": "Waiting For Weed To Dry...",
"take": "Ready To Take Weed",
"targetDryed": "Pickup Weed",
"teleportIn": "Enter The Grow House",
"teleportOut": "Leave The Grow House",
"dabs": "Doing Some Dabs",
"bluntWrap": "Dipping Syrup To Make %s",
"rollBlunt": "Rolling A %s",
"targetSales": "Buy From Dealer",
"buying": "Buying %s From Dealer",
"itemDoesntExist": "This Item Does Not Exist Here",
"needItem": "You Need A %s For This",
"crackBlunt": "Cracking Open A Blunt"
},
"wholesale": {
"alreadyWholesale": "Already Wholesaling",
"targetBuyer": "Talk To The Buyer",
"wholesaling": "Wholesaling Drugs",
"uhoh": "The Buyer Is Getting Sketchy",
"tooLong": "The Buyer Waited Too Long",
"notEnoughCops": "Not Enough Cops On Duty",
"count": "Quantity detected: %s",
"bonus": "Quantity bonus: +%s%%",
"estimate": "Estimated payout: $%s - $%s",
"no_drugs": "You do not have any of this drug to sell",
"ambush": "Ambush! %s attackers with %s weapons are approaching!",
"complete": "Sold %s items for $%s%s",
"min_quantity": "You must sell at least %s items to wholesale",
"deal_failed_cleanup": "Deal failed - you can try again"
},
"xtc": {
"alreadyOut": "You Have A Press Out Already",
"settingDown": "Setting Down The Press",
"noPressOut": "You Do Not Have A Press Out",
"targetMake": "Press Pills",
"making": "Pressing A %s",
"targetPickup": "Pick Up Press",
"picking": "Picking Up Press",
"targetStealMDP2P": "Steal MDP2P",
"stealingMDP2P": "Stealing MDP2P",
"fail": "Damn Dude You Suck",
"targetStealIsosafrole": "Steal Isosafrole",
"stealingIsosafrole": "Stealing Isosafrole",
"targetRaw": "Make Raw XTC",
"makingRaw": "Making Raw XTC",
"getPress": "Get Press",
"buySingle": "Buy Single Press For $%s",
"buyp": "Buying Press",
"targetStamp": "Stamp XTC",
"stamp_desc": "Stamp %s Pills",
"stamping": "Stamping %s Pills",
"noPills": "You Dont Have Any Unstamped Pills"
},
"merchant": {
"targetOpen": "Open Merchant Menu"
},
"Whippit": {
"targetShop": "Open Whippit Shop",
"needBalloon": "You Need A Balloon For This",
"needCanister": "You Need A Canister For This",
"shopHeader": "Whippit Shop"
}
}
+3 -3
View File
@@ -47,16 +47,16 @@ end)
RegisterServerEvent("md-drugs:server:purchaseGoods", function(item) RegisterServerEvent("md-drugs:server:purchaseGoods", function(item)
local src = source local src = source
if not ps.checkDistance(src, loc, 10) then if not ps.checkDistance(src, loc, 10) then
ps.notify(src, ps.lang('Catches.notIn'), "error") Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Catches.notIn'), "error")
return return
end end
if not stores.travel[item] then if not stores.travel[item] then
ps.notify(src, ps.lang('Catches.invalidItem'), "error") Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Catches.invalidItem'), "error")
return return
end end
if ps.removeMoney(src, 'cash', stores.travel[item]) then if ps.removeMoney(src, 'cash', stores.travel[item]) then
ps.addItem(src, item, 1) ps.addItem(src, item, 1)
else else
ps.notify(src, ps.lang('Catches.notEnoughMoney'), "error") Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Catches.notEnoughMoney'), "error")
end end
end) end)
+74 -65
View File
@@ -1,5 +1,7 @@
Recipes = Recipes or {}
Locations = Locations or {}
local cocaineRecipes = { Recipes.Cocaine = {
cokepowder = { cokepowder = {
tier1 = {take = {coca_leaf = 1}, give = {coke = 1}}, tier1 = {take = {coca_leaf = 1}, give = {coke = 1}},
tier2 = {take = {coca_leaf = 1}, give = {cokestagetwo = 1}}, tier2 = {take = {coca_leaf = 1}, give = {cokestagetwo = 1}},
@@ -16,123 +18,130 @@ local cocaineRecipes = {
tier3 = {take = {loosecokestagethree = 1, empty_weed_bag = 1}, give = {cokebaggystagethree = 1}}, tier3 = {take = {loosecokestagethree = 1, empty_weed_bag = 1}, give = {cokebaggystagethree = 1}},
} }
} }
GlobalState.MDDrugsRecipes = Recipes
local cocaineLocations = { Locations.Cocaine = {
MakePowder = { MakePowder = {
{loc = vector3(1086.20, -3195.30, -39.20), l = 1.0, w = 1.0, rot = 45.0, gang = ""}, {loc = vector3(1086.20, -3195.30, -39.20), l = 1.0, w = 1.0, rot = 45.0, gang = ""},
}, },
CuttingCoke = { CuttingCoke = {
{loc = vector3(1095.61, -3195.62, -39.13), l = 1.0, w = 1.0, rot = 45.0, offset = vec3(-1.782227, 0.445068, -0.502701), rotation = vector3(0,0,0), gang = ""}, {loc = vector3(1095.61, -3195.62, -39.13), l = 1.0, w = 1.0, rot = 45.0, offset = vec3(-1.782227, 0.445068, -0.502701), rotation = vector3(0,0,0), gang = ""},
--{loc = vector3(1092.74, -3196.68, -38.99), l = 1.0, w = 1.0, rot = 45.0, offset = vec3(1.983398, 0.407959, -0.642696), rotation = vector3(0,0,180.0), gang = ""},
}, },
BaggingCoke = { BaggingCoke = {
{loc = vector3(1093.16, -3195.78, -39.19), l = 1.0, w = 1.0, rot = 45.0,offset = vec3(4.515137, 2.542969, -0.814194), rotation = vector3(0,0,180.0), gang = ""}, {loc = vector3(1093.16, -3195.78, -39.19), l = 1.0, w = 1.0, rot = 45.0,offset = vec3(4.515137, 2.542969, -0.814194), rotation = vector3(0,0,180.0), gang = ""},
--{loc = vector3(1090.17, -3196.59, -38.99), l = 1.0, w = 1.0, rot = 45.0, offset = vec3(-5.207642, -1.666504, -1.014198), rotation = vector3(0,0, 0.0), gang = ""},
}, },
cokeTele = { cokeTele = {
{inside = vector3(1088.81, -3187.57, -38.99), outside = vector3(198.16, -1276.92, 29.33), l = 1.0, w = 1.0, rot = 45.0, gang = ""}, {inside = vector3(1088.81, -3187.57, -38.99), outside = vector3(198.16, -1276.92, 29.33), l = 1.0, w = 1.0, rot = 45.0, gang = ""},
} }
} }
GlobalState.MDDrugsLocations = Locations
ps.registerCallback('md-drugs:server:GetCokeLocations', function() local function getTier(source)
return cocaineLocations if not Config.TierSystem then
end) return 'tier1'
end
local rep = tonumber(getRep(source, 'coke'))
if not rep then
return
end
if rep < Config.Tier1 then
return 'tier1'
end
if rep >= Config.Tier1 and rep <= Config.Tier2 then
return 'tier2'
end
if rep >= Config.Tier2 then
return 'tier3'
end
return nil
end
RegisterServerEvent('md-drugs:server:makepowder', function(num) RegisterServerEvent('md-drugs:server:makepowder', function(num)
local src = source local src = source
if timeOut(src, 'md-drugs:server:makepowder') then return end if timeOut(src, 'md-drugs:server:makepowder') then return end
if not ps.checkDistance(src, cocaineLocations.MakePowder[num].loc, 3.5) then
ps.warn(ps.lang('Catches.notIn', ps.getPlayerName(src)), 'md-drugs:server:makepowder') if not checkDistance(src, Locations.Cocaine.MakePowder[num].loc, 3.5) then
Bridge.Prints.Warm(Bridge.Language.Locale('Catches.notIn', ps.getPlayerName(src)), 'md-drugs:server:makepowder')
return return
end end
local tier = 'tier1'
if Config.TierSystem then local tier = getTier(src)
local coke = tonumber(getRep(src, 'coke')) if not tier then
if coke > Config.Tier1 and coke <= Config.Tier2 then return
tier = 'tier2'
elseif coke > Config.Tier2 then
tier = 'tier3'
end
end end
if not ps.craftItem(src, cocaineRecipes['cokepowder'][tier]) then
verifyHas(src, cocaineRecipes['cokepowder'][tier].take) if not craft(src, Recipes.Cocaine.cokepowder[tier]) then
return return
end end
end) end)
RegisterServerEvent('md-drugs:server:cutcokeone', function(num) RegisterServerEvent('md-drugs:server:cutcokeone', function(num)
local src = source local src = source
local tier = 'tier1'
if timeOut(src, 'md-drugs:server:cutcokeone') then return end if timeOut(src, 'md-drugs:server:cutcokeone') then return end
if not ps.checkDistance(src, cocaineLocations.CuttingCoke[num].loc, 2.5) then
ps.notify(src, ps.lang('Catches.notIn'), 'error') if not checkDistance(src, Locations.Cocaine.CuttingCoke[num].loc, 2.5) then
Bridge.Prints.Warn(src, Bridge.Language.Locale('Catches.notIn'), 'error')
return return
end end
if Config.TierSystem then local tier = 'tier1'
local cokeTiers = { local itemCheck = {
{item = 'coke', tier = 'tier1', log = ' Cut Coke'}, {check = Bridge.Inventory.HasItem(src,'loosecoke'), tier = 'tier1'},
{item = 'cokestagetwo', tier = 'tier2', log = ' Cut Coke tier 2'}, {check = Bridge.Inventory.HasItem(src, 'loosecokestagetwo'), tier = 'tier2'},
{item = 'cokestagethree', tier = 'tier3', log = ' Cut Coke tier 3'} {check = Bridge.Inventory.HasItem(src, 'loosecokestagethree'), tier = 'tier3'},
} }
for _, v in ipairs(cokeTiers) do for i = 1, #itemCheck do
if ps.hasItem(src, v.item) then if itemCheck[i].check then
tier = v.tier tier = itemCheck[i].tier
break break
end
end end
end end
if not ps.craftItem(src, cocaineRecipes['cutcoke'][tier]) then if not craft(src, Recipes.Cocaine.cutcoke[tier]) then
verifyHas(src, cocaineRecipes['cutcoke'][tier].take)
return return
end end
end) end)
RegisterServerEvent('md-drugs:server:bagcoke', function(num) RegisterServerEvent('md-drugs:server:bagcoke', function(num)
local src = source local src = source
local tier = 'tier1'
if timeOut(src, 'md-drugs:server:bagcoke') then return end if timeOut(src, 'md-drugs:server:bagcoke') then return end
if not ps.checkDistance(src, cocaineLocations.BaggingCoke[num].loc, 2.5) then
ps.notify(src, ps.lang('Catches.notIn'), 'error') if not checkDistance(src, Locations.Cocaine.BaggingCoke[num].loc, 2.5) then
Bridge.Prints.Warn(src, Bridge.Language.Locale('Catches.notIn'), 'error')
return return
end end
if Config.TierSystem then local tier = 'tier1'
local cokeTiers = { local itemCheck = {
{item = 'loosecoke', tier = 'tier1', log = ' Bagged Coke'}, {check = Bridge.Inventory.HasItem(src,'coke'), tier = 'tier1'},
{item = 'loosecokestagetwo', tier = 'tier2', log = ' Bagged Coke tier 2'}, {check = Bridge.Inventory.HasItem(src, 'cokestagetwo'), tier = 'tier2'},
{item = 'loosecokestagethree', tier = 'tier3', log = ' Bagged Coke tier 3'} {check = Bridge.Inventory.HasItem(src, 'cokestagethree'), tier = 'tier3'},
} }
for _, v in ipairs(cokeTiers) do for i = 1, #itemCheck do
if ps.hasItem(src, v.item) then if itemCheck[i].check then
tier = v.tier tier = itemCheck[i].tier
break break
end
end
if not ps.craftItem(src, cocaineRecipes['bagcoke'][tier]) then
verifyHas(src, cocaineRecipes['bagcoke'][tier].take)
return
end
AddRep(src, 'coke')
else
if not ps.craftItem(src, cocaineRecipes['bagcoke'][tier]) then
verifyHas(src, cocaineRecipes['bagcoke'][tier].take)
return
end end
end end
if not craft(src, Recipes.Cocaine.bagcoke[tier]) then
return
end
AddRep(src, 'coke', 1)
end) end)
local cokecut = {loosecokestagetwo = 2, loosecokestagethree = 3} local cokecut = {loosecokestagetwo = 2, loosecokestagethree = 3}
for k, v in pairs (cokecut) do for k, v in pairs (cokecut) do
ps.createUseable(k, function(source, item) Bridge.Framework.RegisterUsableItem(k, function(source, item)
local src = source local src = source
if not ps.hasItem(src, 'bakingsoda') then if not Bridge.Inventory.HasItem(src, 'bakingsoda') then
ps.notify(src, ps.lang('coke.needBakingSoda'), 'error') Bridge.Notify.SendNotify(src, Bridge.Language.Locale('coke.needBakingSoda'), 'error')
return return
end end
if ps.hasItem(src,item.name) then if Bridge.Inventory.HasItem(src,item.name) then
local check = ps.callback('md-drugs:client:uncuff', src, 'Cutting It Further') local check = ps.callback('md-drugs:client:uncuff', src, 'Cutting It Further')
if not check then return end if not check then return end
if ps.removeItem(src, k, 1) and ps.removeItem(src, 'bakingsoda', 1) then if Bridge.Inventory.RemoveItem(src, k, 1) and Bridge.Inventory.RemoveItem(src, 'bakingsoda', 1) then
ps.addItem(src, 'loosecoke', v) Bridge.Inventory.AddItem(src, 'loosecoke', v)
end end
end end
end) end)
+77 -40
View File
@@ -122,6 +122,7 @@ local Drugs = {
} }
local drugsNames = {} local drugsNames = {}
local soldPeds = {}
for k, v in pairs(Drugs) do for k, v in pairs(Drugs) do
table.insert(drugsNames, k) table.insert(drugsNames, k)
end end
@@ -135,53 +136,73 @@ local cornsellConfig = {
policeRequired = 0, -- if you want cops to be required to sell set this to a number above 0 policeRequired = 0, -- if you want cops to be required to sell set this to a number above 0
robChance = 1, -- Chance To Be Robbed 1 = 1% robChance = 1, -- Chance To Be Robbed 1 = 1%
} }
local function beingRobbed(source, item, amount, ped) local function beingRobbed(source, item, amount, ped)
local src = source local src = source
ps.removeItem(src, item, amount) Bridge.Inventory.RemoveItem(src, item, amount)
ps.notify(src, ps.lang('Cornerselling.gotRobbed'), 'error') Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Cornerselling.gotRobbed'), 'error')
RobbedDrugs[ps.getIdentifier(source)] = {item = item, amount = amount, ped = ped} RobbedDrugs[src] = {item = item, amount = amount, ped = ped}
return true return true
end end
local function getDrugBack(source, item, amount) local function getDrugBack(source, item, amount)
local src = source local src = source
if RobbedDrugs[ps.getIdentifier(source)] then if RobbedDrugs[src] then
if RobbedDrugs[ps.getIdentifier(source)].item == item and RobbedDrugs[ps.getIdentifier(source)].amount == amount then if RobbedDrugs[src].item == item and RobbedDrugs[src].amount == amount then
ps.addItem(src, item, amount) Bridge.Inventory.AddItem(src, item, amount)
ps.notify(src, ps.lang('Cornerselling.gotBack'), 'success') Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Cornerselling.gotBack'), 'success')
RobbedDrugs[ps.getIdentifier(source)] = nil RobbedDrugs[src] = nil
return true return true
end end
end end
end end
ps.registerCallback('md-drugs:server:cornerselling:getAvailableDrugs', function(source, ped) local function getLoc(src, ped)
local Player = ps.getPlayer(source) local coords, peds = GetEntityCoords(GetPlayerPed(src)), GetEntityCoords(ped)
local dist = #(coords - peds)
if dist < 5.0 then
return true
end
return false
end
Bridge.Callback.Register('md-drugs:server:cornerselling:getAvailableDrugs', function(source, ped)
local src = source
local rep = getRep(source, 'cornerselling') local rep = getRep(source, 'cornerselling')
local priceAdjust = json.decode(rep).price local priceAdjust = rep.price
if not Player then return nil end local ped = NetworkGetEntityFromNetworkId(ped)
if not getLoc(src, ped) then
return false
end
if soldPeds[src] == nil then
soldPeds[src] = {}
end
if soldPeds[src][ped] then
return false
end
for k, v in pairs(Drugs) do for k, v in pairs(Drugs) do
local item = ps.getItemCount(source, k) or 0 local count = Bridge.Inventory.GetItemCount(src, k)
if item >= 1 then if count >= 1 then
local maths = math.random(1,100) local maths = math.random(1,100)
if maths <= cornsellConfig.robChance then if maths <= cornsellConfig.robChance then
beingRobbed(source, k, item, ped) beingRobbed(source, k, count, ped)
soldPeds[src][ped] = {item = k, amount = count}
return 'robbed' return 'robbed'
else else
if item > 15 then item = 15 end if count > 15 then count = 15 end
local amount = math.random(1, item) local amount = math.random(1, count)
local price = (math.random(Drugs[k]['min'], Drugs[k]['max']) * amount) * priceAdjust local price = (math.random(Drugs[k]['min'], Drugs[k]['max']) * amount) * priceAdjust
DrugDeals[ps.getIdentifier(source)] = {item = k, amount = amount, price = math.floor(price), ped = ped} DrugDeals[src] = {item = k, amount = amount, price = math.floor(price), ped = ped}
return DrugDeals[ps.getIdentifier(source)] soldPeds[src][ped] = DrugDeals[src]
return DrugDeals[src]
end end
end end
end end
return false return false
end) end)
ps.registerCallback('md-drugs:server:hasDrugs', function(source) Bridge.Callback.Register('md-drugs:server:hasDrugs', function(source)
for k, v in pairs(Drugs) do for k, v in pairs(Drugs) do
if ps.hasItem(source, k, 1) then if Bridge.Inventory.HasItem(source, k) then
return true return true
end end
end end
@@ -196,51 +217,67 @@ local function csCheck(src, item, amount, price)
end end
end end
if not isIn then return false end if not isIn then return false end
if DrugDeals[ps.getIdentifier(src)] then if DrugDeals[src] then
if DrugDeals[ps.getIdentifier(src)].item == item and DrugDeals[ps.getIdentifier(src)].amount == amount and DrugDeals[ps.getIdentifier(src)].price == price then if DrugDeals[src].item == item and DrugDeals[src].amount == amount and DrugDeals[src].price == price then
return true return true
end end
end end
return false return false
end end
RegisterNetEvent('md-drugs:server:sellCornerDrugs', function(item, amount, price) RegisterNetEvent('md-drugs:server:sellCornerDrugs', function(item, amount, price, peds)
local src = source local src = source
if not csCheck(src, item, amount, price) then return end if not csCheck(src, item, amount, price) then
if not ps.removeItem(src, item, amount) then return
ps.notify(src, ps.lang('Cornerselling.notEnough'), 'error') end
DrugDeals[ps.getIdentifier(src)] = nil local ped = NetworkGetEntityFromNetworkId(peds)
if not getLoc(src, ped) then
print('not close enough to ped')
return
end
if not soldPeds[src] or not soldPeds[src][ped] then
print('ped not in soldPeds')
return
end
if not Bridge.Inventory.RemoveItem(src, item, amount) then
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Cornerselling.notEnough'), 'error')
DrugDeals[src] = nil
return return
end end
AddRep(src, 'cornerselling', Drugs[item].rep * amount) AddRep(src, 'cornerselling', Drugs[item].rep * amount)
DrugDeals[ps.getIdentifier(src)] = nil DrugDeals[src] = nil
if cornsellConfig.MarkedBills then if cornsellConfig.MarkedBills then
ps.addItem(src, 'markedbills', price, {worth = price}) Bridge.Inventory.AddItem(src, 'markedbills', price, nil, {worth = price})
return return
end end
if cornsellConfig.CustomItem ~= '' then if cornsellConfig.CustomItem ~= '' then
ps.addItem(src, cornsellConfig.CustomItem, price) Bridge.Inventory.AddItem(src, cornsellConfig.CustomItem, price)
return return
end end
ps.addMoney(src, 'cash', price) Bridge.Framework.AddAccountBalance(src, 'cash', price)
end) end)
RegisterNetEvent('md-drugs:server:getBackRobbed', function() RegisterNetEvent('md-drugs:server:getBackRobbed', function(peds)
local tabl = RobbedDrugs[ps.getIdentifier(source)] local src = source
local tabl = RobbedDrugs[src]
if tabl == nil then return end if tabl == nil then return end
getDrugBack(source, tabl.item, tabl.amount) local ped = NetworkGetEntityFromNetworkId(peds)
RobbedDrugs[ps.getIdentifier(source)] = nil if ped ~= tabl.ped then return end
if not getLoc(src, ped) then return end
getDrugBack(src, tabl.item, tabl.amount)
RobbedDrugs[src] = nil
end) end)
ps.registerCommand('cornersell', { ps.registerCommand('cornersell', {
help = ps.lang('Cornerselling.comDes'), help = Bridge.Language.Locale('Cornerselling.comDes'),
params = { params = {
}, },
}, function(source, args, raw) }, function(source, args, raw)
local src = source local src = source
local jobCount = ps.getJobTypeCount('leo') local jobCount = ps.getJobTypeCount('leo')
if jobCount < cornsellConfig.policeRequired then if jobCount < cornsellConfig.policeRequired then
ps.notify(src, ps.lang('Catches.noCops'), 'error') Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Catches.noCops'), 'error')
return return
end end
TriggerClientEvent('md-drugs:client:cornerselling', src) TriggerClientEvent('md-drugs:client:cornerselling', src)
@@ -248,7 +285,7 @@ end)
RegisterServerEvent('md-drugs:server:cornerselling:stop', function() RegisterServerEvent('md-drugs:server:cornerselling:stop', function()
local src = source local src = source
if DrugDeals[ps.getIdentifier(src)] then if DrugDeals[src] then
DrugDeals[ps.getIdentifier(src)] = nil DrugDeals[src] = nil
end end
end) end)
+45 -41
View File
@@ -1,17 +1,20 @@
local crackRecipe = { Recipes, Locations = Recipes or {}, Locations or {}
Recipes.Crack = {
cookcrack = { cookcrack = {
tier1 = {take = {loosecoke = 1, bakingsoda = 1}, give = {crackrock = 1}}, tier1 = {take = {loosecoke = 1, bakingsoda = 1}, give = {crackrock = 1}},
tier2 = {take = {loosecokestagetwo = 1, bakingsoda = 1}, give = {crackrockstagetwo = 1}}, tier2 = {take = {loosecokestagetwo = 1, bakingsoda = 1}, give = {crackrockstagetwo = 1}},
tier3 = {take = {loosecokestagethree = 1,bakingsoda = 1}, give = {crackrockstagethree = 1}}, tier3 = {take = {loosecokestagethree = 1,bakingsoda = 1}, give = {crackrockstagethree = 1}},
}, },
bagcrack = { bagcrack = {
tier1 = {take = {crackrock = 1, empty_weed_bag = 1}, give = {baggedcracked = 1}}, tier1 = {take = {crackrock = 1, empty_weed_bag = 1}, give = {baggedcracked = 1}},
tier2 = {take = {crackrockstagetwo = 1, empty_weed_bag = 1}, give = {baggedcrackedstagetwo = 1}}, tier2 = {take = {crackrockstagetwo = 1, empty_weed_bag = 1}, give = {baggedcrackedstagetwo = 1}},
tier3 = {take = {crackrockstagethree = 1, empty_weed_bag = 1}, give = {baggedcrackedstagethree = 1}}, tier3 = {take = {crackrockstagethree = 1, empty_weed_bag = 1}, give = {baggedcrackedstagethree = 1}},
} }
} }
GlobalState.MDDrugsRecipes = Recipes
local CrackLocations = { Locations.Crack = {
makecrack = { -- make crack with baking soda with cut coke 1-3 makecrack = { -- make crack with baking soda with cut coke 1-3
{loc = vector3(2433.47, 4970.02, 42.18), l = 1.0, w = 1.0, rot = 45.0, gang = ""}, {loc = vector3(2433.47, 4970.02, 42.18), l = 1.0, w = 1.0, rot = 45.0, gang = ""},
}, },
@@ -19,21 +22,18 @@ local CrackLocations = {
{loc = vector3(2436.55, 4964.96, 42.18), l = 1.0, w = 1.0, rot = 45.0, gang = ""}, {loc = vector3(2436.55, 4964.96, 42.18), l = 1.0, w = 1.0, rot = 45.0, gang = ""},
}, },
} }
GlobalState.MDDrugsLocations = Locations
ps.registerCallback('md-drugs:server:GetCrackLocations', function()
return CrackLocations
end)
RegisterServerEvent('md-drugs:server:makecrackone', function(num) RegisterServerEvent('md-drugs:server:makecrackone', function(num)
local src = source local src = source
local tier = 'tier1'
if timeOut(src, 'md-drugs:server:makecrackone') then return end if timeOut(src, 'md-drugs:server:makecrackone') then return end
if not ps.checkDistance(src, CrackLocations.makecrack[num].loc, 2.0) then
ps.notify(src, ps.lang('Catches.notIn'), 'error') if not checkDistance(src, Locations.Crack.makecrack[num].loc, 2.0) then
Bridge.Prints.Warn(src, Bridge.Language.Locale('Catches.notIn'), 'error')
return return
end end
local tier = 'tier1'
if Config.TierSystem then if Config.TierSystem then
local crackTiers = { local crackTiers = {
{item = 'loosecoke', tier = 'tier1'}, {item = 'loosecoke', tier = 'tier1'},
@@ -41,14 +41,13 @@ RegisterServerEvent('md-drugs:server:makecrackone', function(num)
{item = 'loosecokestagethree', tier = 'tier3'} {item = 'loosecokestagethree', tier = 'tier3'}
} }
for _, v in ipairs(crackTiers) do for _, v in ipairs(crackTiers) do
if ps.hasItem(src, v.item) then if Bridge.Inventory.HasItem(src, v.item) then
tier = v.tier tier = v.tier
break break
end end
end end
end end
if not ps.craftItem(src, crackRecipe['cookcrack'][tier]) then if not craft(src, Recipes.Crack.cookcrack[tier]) then
verifyHas(src, crackRecipe['cookcrack'][tier].take)
return return
end end
end) end)
@@ -56,41 +55,46 @@ end)
RegisterServerEvent('md-drugs:server:bagcrack', function(num) RegisterServerEvent('md-drugs:server:bagcrack', function(num)
local src = source local src = source
local tier = 'tier1'
if timeOut(src, 'md-drugs:server:bagcrack') then return end if timeOut(src, 'md-drugs:server:bagcrack') then return end
if not ps.checkDistance(src, CrackLocations.bagcrack[num].loc, 2.0) then
ps.notify(src, ps.lang('Catches.notIn'), 'error') if not checkDistance(src, Locations.Crack.bagcrack[num].loc, 2.0) then
Bridge.Prints.Warn(src, Bridge.Language.Locale('Catches.notIn'), 'error')
return return
end end
local tier = 'tier1'
if Config.TierSystem then if Config.TierSystem then
local crackTiers = { local crackTiers = {
{item = 'crackrock', tier = 'tier1'}, {item = 'crackrock', tier = 'tier1'},
{item = 'crackrockstagetwo', tier = 'tier2'}, {item = 'crackrockstagetwo', tier = 'tier2'},
{item = 'crackrockstagethree', tier = 'tier3'} {item = 'crackrockstagethree', tier = 'tier3'}
} }
for _, v in ipairs(crackTiers) do for _, v in ipairs(crackTiers) do
if ps.hasItem(src, v.item) then if Bridge.Inventory.HasItem(src, v.item) then
tier = v.tier tier = v.tier
break break
end end
end end
end end
if not ps.craftItem(src, crackRecipe['bagcrack'][tier]) then if not craft(src, Recipes.Crack.bagcrack[tier]) then
verifyHas(src, crackRecipe['bagcrack'][tier].take)
return return
end end
end) end)
local cokecut = {crackrockstagetwo = 2, crackrockstagethree = 3} local cokecut = {crackrockstagetwo = 2, crackrockstagethree = 3}
for k, v in pairs (cokecut) do for k, v in pairs (cokecut) do
ps.createUseable(k, function(source, item) Bridge.Framework.RegisterUsableItem(k, function(source, item)
local src = source local src = source
if ps.hasItem(src, item.name) then if not Bridge.Inventory.HasItem(src, 'bakingsoda') then
if not ps.hasItem(src, 'bakingsoda', 1) then return end Bridge.Notify.SendNotify(src, Bridge.Language.Locale('coke.needBakingSoda'), 'error')
local check = ps.callback('md-drugs:client:uncuff', src, 'Cutting Crack Rock Further') return
end
if Bridge.Inventory.HasItem(src,item.name) then
local check = ps.callback('md-drugs:client:uncuff', src, 'Cutting It Further')
if not check then return end if not check then return end
if ps.removeItem(src, k, 1) and ps.removeItem(src, 'bakingsoda', 1) then if Bridge.Inventory.RemoveItem(src, k, 1) and Bridge.Inventory.RemoveItem(src, 'bakingsoda', 1) then
ps.addItem(src, 'crackrock', v) Bridge.Inventory.AddItem(src, 'crackrock', v)
end end
end end
end) end)
@@ -98,18 +102,18 @@ end
RegisterNetEvent("md-drugs:server:failcrackone", function(num) RegisterNetEvent("md-drugs:server:failcrackone", function(num)
local src = source local src = source
if not ps.checkDistance(src, CrackLocations.makecrack[num].loc, 2.0) then if not checkDistance(src, Locations.Crack.makecrack[num].loc, 2.0) then
ps.notify(src, ps.lang('Catches.notIn'), 'error') Bridge.Prints.Warn(src, Bridge.Language.Locale('Catches.notIn'), 'error')
return return
end end
local items = { local items = {
loosecoke = 1, 'loosecoke',
loosecokestagetwo = 1, 'loosecokestagetwo',
loosecokestagethree = 1 'loosecokestagethree',
} }
for k,v in pairs(items) do for k,v in pairs(items) do
if ps.hasItem(src, k, v) then if Bridge.Inventory.HasItem(src, v) then
ps.removeItem(src, k, v) Bridge.Inventory.RemoveItem(src, v, 1)
return return
end end
end end
+67 -63
View File
@@ -1,4 +1,4 @@
Locations = Locations or {}
local dloc = { local dloc = {
{coords = vector4(282.48, -1814.32, 27.23, 145.11)}, {coords = vector4(282.48, -1814.32, 27.23, 145.11)},
@@ -88,36 +88,29 @@ local Products = {
{name = "weed_amnesia_seed", price = 15, amount = 150, minrep = 0}, {name = "weed_amnesia_seed", price = 15, amount = 150, minrep = 0},
} }
ps.registerCallback('md-drugs:server:dealerList', function() local Dealers = {}
Bridge.Callback.Register('md-drugs:server:dealerList', function(source, location)
local coords = json.decode(Dealers[location].coords)
coords = vector3(coords.x, coords.y, coords.z)
if not checkDistance(source, coords, 4.0) then
return
end
return Products return Products
end) end)
ps.registerCallback('md-drugs:server:getDealers', function(source)
local check = MySQL.query.await('SELECT * FROM dealers', {})
local loc = json.encode({x = 899.98, y = -2603.24, z = 6.11, h = 176.12 })
if not check[1] then
MySQL.insert('INSERT INTO dealers SET name = ?, coords = ?, time = ?, createdby = ?', {'MD', loc, 'any', 'code Newb'})
Wait(2000)
local check2 = MySQL.query.await('SELECT * FROM dealers', {})
return check2
else
return check
end
end)
local DeliveryItems = { local DeliveryItems = {
{ item = "weed_brick", minrep = 0, payout = {min = 10, max = 50}}, { item = "weed_brick", minrep = 0, payout = {min = 10, max = 50}},
{ item = "coke_brick", minrep = 0, payout = {min = 10, max = 50}}, { item = "coke_brick", minrep = 0, payout = {min = 10, max = 50}},
} }
ps.registerCallback('md-drugs:server:GetDeliveryItem', function(source, data) Bridge.Callback.Register('md-drugs:server:GetDeliveryItem', function(source, data)
local src = source local src = source
local Player = ps.getPlayer(src)
local itemnum = math.random(1, #DeliveryItems) local itemnum = math.random(1, #DeliveryItems)
local item = DeliveryItems[itemnum].item local item = DeliveryItems[itemnum].item
local amount = math.random(1,4) local amount = math.random(1,4)
local check = MySQL.query.await('SELECT * FROM deliveriesdealer WHERE cid = ?', {ps.getIdentifier(src)}) local check = MySQL.query.await('SELECT * FROM deliveriesdealer WHERE cid = ?', {Bridge.Framework.GetPlayerIdentifier(src)})
local locnum = math.random(1, #dloc) local locnum = math.random(1, #dloc)
local coord = json.encode({ local coord = json.encode({
x = dloc[locnum].coords.x, x = dloc[locnum].coords.x,
@@ -127,8 +120,8 @@ ps.registerCallback('md-drugs:server:GetDeliveryItem', function(source, data)
}) })
if not check[1] then if not check[1] then
MySQL.insert('INSERT INTO deliveriesdealer SET cid = ?, itemdata = ?, timestart = ?, maxtime = ?, location = ?', MySQL.insert('INSERT INTO deliveriesdealer SET cid = ?, itemdata = ?, timestart = ?, maxtime = ?, location = ?',
{ps.getIdentifier(src), json.encode({item = item, amount = amount}), os.time(), os.time() + (15 * 60), coord }) {Bridge.Framework.GetPlayerIdentifier(src), json.encode({item = item, amount = amount}), os.time(), os.time() + (15 * 60), coord })
ps.addItem(src, item, amount) Bridge.Inventory.AddItem(src, item, amount)
local tab = { local tab = {
bool = true, bool = true,
item = item, item = item,
@@ -141,11 +134,11 @@ ps.registerCallback('md-drugs:server:GetDeliveryItem', function(source, data)
local timeout = math.floor(os.difftime(time, check[1].maxtime) / 60) local timeout = math.floor(os.difftime(time, check[1].maxtime) / 60)
if timeout > 15 then if timeout > 15 then
MySQL.query.await('DELETE FROM deliveriesdealer WHERE cid = ?', {ps.getIdentifier(src)}) MySQL.query.await('DELETE FROM deliveriesdealer WHERE cid = ?', {Bridge.Framework.GetPlayerIdentifier(src)})
ps.notify(src, ps.lang('Deliveries.slowAf'), 'error' ) Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Deliveries.slowAf'), 'error' )
return {bool = false} return {bool = false}
end end
ps.notify(src,ps.lang('Deliveries.alreadyDelivering'), 'error' ) Bridge.Notify.SendNotify(src,Bridge.Language.Locale('Deliveries.alreadyDelivering'), 'error' )
local tab = { local tab = {
bool = false, bool = false,
item = item, item = item,
@@ -158,37 +151,43 @@ end)
RegisterNetEvent('md-drugs:server:giveDeliveryItems', function(item, amount) RegisterNetEvent('md-drugs:server:giveDeliveryItems', function(item, amount)
local src = source local src = source
local Player = ps.getPlayer(src) local id = Bridge.Framework.GetPlayerIdentifier(src)
local check = MySQL.query.await('SELECT * FROM deliveriesdealer WHERE cid = ?', {ps.getIdentifier(src)}) local check = MySQL.query.await('SELECT * FROM deliveriesdealer WHERE cid = ?', {id})
if not check[1] then return end if not check[1] then return end
local time = os.time() local time = os.time()
local timeout = math.floor(os.difftime(time, check[1].maxtime) / 60) local timeout = math.floor(os.difftime(time, check[1].maxtime) / 60)
local itemData = json.decode(check[1].itemdata) local itemData = json.decode(check[1].itemdata)
if timeout >= 15 then if timeout >= 15 then
MySQL.query.await('DELETE FROM deliveriesdealer WHERE cid = ?', {ps.getIdentifier(src)}) MySQL.query.await('DELETE FROM deliveriesdealer WHERE cid = ?', {id})
ps.notify(src, ps.lang('Deliveries.slowAf'), 'error' ) Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Deliveries.slowAf'), 'error' )
return return
end end
if item ~= itemData.item then return end if item ~= itemData.item then return end
if amount ~= itemData.amount then return end if amount ~= itemData.amount then return end
if ps.removeItem(src, item, amount) then local coords = json.decode(check[1].location)
coords = vector3(coords.x, coords.y, coords.z)
if not checkDistance(src, coords, 5.0) then
return
end
if Bridge.Inventory.RemoveItem(src, item, amount) then
for k, v in pairs (DeliveryItems) do for k, v in pairs (DeliveryItems) do
if v.item == item then if v.item == item then
local income = math.random(v.payout.min, v.payout.max) local income = math.random(v.payout.min, v.payout.max)
ps.addMoney(src, 'cash', income) Bridge.Framework.AddAccountBalance(src, 'cash', income)
AddRep(src, 'dealerrep') AddRep(src, 'dealerrep')
end end
end end
MySQL.query.await('DELETE FROM deliveriesdealer WHERE cid = ?', {ps.getIdentifier(src)}) MySQL.query.await('DELETE FROM deliveriesdealer WHERE cid = ?', {id})
end end
end) end)
-- TODO: COmmands
ps.registerCommand("newdealer", { ps.registerCommand("newdealer", {
help = ps.lang('Deliveries.newDealerHelp.help'), help = Bridge.Language.Locale('Deliveries.newDealerHelp.help'),
description = { description = {
{ name = "name", help = ps.lang('Deliveries.newDealerHelp.name'), type = "string" }, { name = "name", help = Bridge.Language.Locale('Deliveries.newDealerHelp.name'), type = "string" },
{ name = "min", help = ps.lang('Deliveries.newDealerHelp.timeMin'), type = "number" }, { name = "min", help = Bridge.Language.Locale('Deliveries.newDealerHelp.timeMin'), type = "number" },
{ name = "max", help = ps.lang('Deliveries.newDealerHelp.timeMax'), type = "number" } { name = "max", help = Bridge.Language.Locale('Deliveries.newDealerHelp.timeMax'), type = "number" }
}, },
admin = true, admin = true,
}, function(source, args) }, function(source, args)
@@ -202,29 +201,22 @@ ps.registerCommand("newdealer", {
local result = MySQL.scalar.await('SELECT name FROM dealers WHERE name = ?', { dealerName }) local result = MySQL.scalar.await('SELECT name FROM dealers WHERE name = ?', { dealerName })
if result then if result then
return ps.notify(source,ps.lang('Deliveries.DealerExists'), "error") return Bridge.Notify.SendNotify(source,Bridge.Language.Locale('Deliveries.DealerExists'), "error")
end end
MySQL.insert('INSERT INTO dealers (name, coords, time, createdby) VALUES (?, ?, ?, ?)', { MySQL.insert('INSERT INTO dealers (name, coords, time, createdby) VALUES (?, ?, ?, ?)', {
dealerName, pos, 'nil', ps.getIdentifier(source) dealerName, pos, 'nil', Bridge.Framework.GetPlayerIdentifier(source)
}, function() })
QBConfig.Dealers[dealerName] = { Wait(1000)
name = dealerName, Locations.Dealers = MySQL.query.await('SELECT * FROM dealers')
coords = { GlobalState.MDDrugsLocations = Locations
x = coords.x, TriggerClientEvent('md-drugs:client:RefreshDealers', -1)
y = coords.y,
z = coords.z,
h = GetEntityHeading(ped)
},
}
TriggerClientEvent('md-drugs:client:RefreshDealers', -1, QBConfig.Dealers)
end)
end) end)
ps.registerCommand("deletedealer", { ps.registerCommand("deletedealer", {
help = ps.lang('Deliveries.deleteDealerHelp.help'), help = Bridge.Language.Locale('Deliveries.deleteDealerHelp.help'),
description = { description = {
{ name = "name", help = ps.lang('Deliveries.deleteDealerHelp.name'), type = "string" } { name = "name", help = Bridge.Language.Locale('Deliveries.deleteDealerHelp.name'), type = "string" }
}, },
admin = true admin = true
}, function(source, args) }, function(source, args)
@@ -233,24 +225,36 @@ ps.registerCommand("deletedealer", {
if result and result[1] then if result and result[1] then
MySQL.query('DELETE FROM dealers WHERE name = ?', { dealerName }) MySQL.query('DELETE FROM dealers WHERE name = ?', { dealerName })
QBConfig.Dealers[dealerName] = nil Wait(1000)
TriggerClientEvent('md-drugs:client:RefreshDealers', -1, QBConfig.Dealers) Locations.Dealers = MySQL.query.await('SELECT * FROM dealers')
ps.notify(source, ps.lang('Deliveries.deleteDealerSuccess'), "success") GlobalState.MDDrugsLocations = Locations
TriggerClientEvent('md-drugs:client:RefreshDealers', -1)
Bridge.Notify.SendNotify(source, Bridge.Language.Locale('Deliveries.deleteDealerSuccess'), "success")
else else
ps.notify(source, ps.lang('Deliveries.deleteDealerFail'), "error") Bridge.Notify.SendNotify(source, Bridge.Language.Locale('Deliveries.deleteDealerFail'), "error")
end end
end) end)
RegisterNetEvent('md-drugs:server:buyItemDealer', function(num) RegisterNetEvent('md-drugs:server:buyItemDealer', function(num, loc)
local src = source local src = source
local itemData = Products[num] local itemData = Products[num]
if not itemData then return end if not itemData then return end
local Player = ps.getPlayer(src) local coords = json.decode(Dealers[loc].coords)
if not Player then return end coords = vector3(coords.x, coords.y, coords.z)
if not ps.removeMoney(src, 'cash', itemData.price) or not ps.removeMoney(src,'bank', itemData.price) then if not checkDistance(src, coords, 5.0) then
ps.notify(src, ps.lang('Catches.notEnoughMoney'), 'error')
return return
end end
ps.addItem(src, itemData.name, 1) if not Bridge.Framework.RemoveAccountBalance(src, 'cash', itemData.price) or not Bridge.Framework.RemoveAccountBalance(src,'bank', itemData.price) then
ps.notify(src, string.format(ps.lang('Deliveries.buyItemSuccess'), 1, ps.getLabel(itemData.name), itemData.price), 'success') Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Catches.notEnoughMoney'), 'error')
return
end
Bridge.Inventory.AddItem(src, itemData.name, 1)
Bridge.Notify.SendNotify(src, string.format(Bridge.Language.Locale('Deliveries.buyItemSuccess'), 1, ps.getLabel(itemData.name), itemData.price), 'success')
end) end)
Dealers = MySQL.query.await('SELECT * FROM dealers')
if Dealers and not Dealers[1] then
MySQL.insert('INSERT INTO dealers SET name = ?, coords = ?, time = ?, createdby = ?', {'MD', json.encode({x = 899.98, y = -2603.24, z = 6.11, h = 176.12 }), 'any', 'code Newb'})
end
Locations.Dealers = Dealers
GlobalState.MDDrugsLocations = Locations
+90 -65
View File
@@ -1,111 +1,136 @@
local timeOutPlayers = {} local timeOutPlayers = {}
local playerRep = {}
function checkDistance(src, coords, dist)
local pcoords = GetEntityCoords(GetPlayerPed(src))
coords = vector3(coords.x, coords.y, coords.z)
if #(pcoords - coords) > dist then
return false
end
return true
end
local function timeOutThread(src) local function timeOutThread(src)
local id = Bridge.Framework.GetPlayerIdentifier(src)
CreateThread(function() CreateThread(function()
timeOutPlayers[ps.getIdentifier(src)] = true timeOutPlayers[id] = true
Wait(3000) Wait(3000)
timeOutPlayers[ps.getIdentifier(src)] = nil timeOutPlayers[id] = nil
end) end)
end end
function timeOut(src, event) function timeOut(src, event)
if timeOutPlayers[ps.getIdentifier(src)] then if timeOutPlayers[src] then
ps.warn(ps.lang('Catches.onCooldownWarn', ps.getPlayerName(src), event)) local first, last = Bridge.Framework.GetPlayerName(src)
Bridge.Prints.Warn(Bridge.Language.Locale('Catches.onCooldownWarn', first .. ' ' .. last, event))
return true return true
end end
timeOutThread(src) timeOutThread(src)
return false return false
end end
function verifyHas(source, items) function craft(source, recipe)
local need = 0 local need, have, oops = 0,0,{}
local have = 0 for item, amount in pairs (recipe.take) do
local missingList = {}
for k, v in pairs(items) do
need = need + 1 need = need + 1
if ps.hasItem(source, k, v) then local count = Bridge.Inventory.GetItemCount(source, item)
if count >= amount then
have = have + 1 have = have + 1
else else
local label = ps.getItemLabel(k) or k table.insert(oops, 'You Need ' .. amount .. ' X ' .. Bridge.Inventory.GetItemInfo(item).label)
table.insert(missingList, v .. " " .. label)
end end
end end
if have ~= need then
if need == have then for index, text in pairs (oops) do
return true Bridge.Notify.SendNotify(source, text, 'error')
end
return false
end end
for item, amount in pairs (recipe.take) do
local message = ps.lang('Catches.itemMissings') .. table.concat(missingList, "\n") if not Bridge.Inventory.RemoveItem(source, item, amount) then
ps.notify(source, message, 'error') return false
return false end
end
for item, amount in pairs (recipe.give) do
Bridge.Inventory.AddItem(source, item, amount)
end
return true
end end
local function handleFresh(source) local function handleFresh(source)
local table = json.encode({ local id = Bridge.Framework.GetPlayerIdentifier(source)
coke = 0,lsd = 0,heroin = 0,dealerrep = 0, local player = {
cornerselling = { price = QBConfig.SellLevel[1].price,rep = 0,label = QBConfig.SellLevel[1].label,level = 1} coke = 0,
}) lsd = 0,
MySQL.insert('INSERT INTO drugrep SET cid = ?, drugrep = ?, name = ?', {ps.getIdentifier(source), table, ps.getPlayerName(source)}) heroin = 0,
return json.decode(table) dealerrep = 0,
cornerselling = {
price = QBConfig.SellLevel[1].price,
rep = 0,
label = QBConfig.SellLevel[1].label,
level = 1
}
}
playerRep[id] = player
local first, last = Bridge.Framework.GetPlayerName(source)
MySQL.insert('INSERT INTO drugrep SET cid = ?, drugrep = ?, name = ?', {id, player, first .. ' ' .. last})
end
local function loadRep(source)
local id = Bridge.Framework.GetPlayerIdentifier(source)
local hasRep = MySQL.query.await('SELECT * FROM drugrep WHERE cid = ?', {id})
if hasRep and not hasRep[1] then
handleFresh(source)
end
if hasRep and hasRep[1] then
playerRep[id] = json.decode(hasRep[1].drugrep)
end
end end
function getRep(source, type) function getRep(source, type)
local sql = MySQL.query.await('SELECT JSON_UNQUOTE(JSON_EXTRACT(drugrep, ?)) AS rep FROM drugrep WHERE cid = ?', {'$.' .. type, ps.getIdentifier(source)}) local id = Bridge.Framework.GetPlayerIdentifier(source)
if not sql[1] then if not playerRep[id] then
local new = handleFresh(source) loadRep(source)
return new[type]
else
return sql[1].rep
end end
return playerRep[id][type]
end end
function GetAllRep(source) function GetAllRep(source)
local sql = MySQL.query.await('SELECT * FROM drugrep WHERE cid = ?', {ps.getIdentifier(source)}) local id = Bridge.Framework.GetPlayerIdentifier(source)
if not sql[1] then if not playerRep[id] then
local new = handleFresh(source) loadRep(source)
return new
else
local rep = json.decode(sql[1].drugrep)
if rep.coke == nil then return rep[1] end
return rep
end end
return playerRep[id]
end end
function AddRep(source, type, amount) function AddRep(source, type, amount)
if not Config.TierSystem then return false end if not Config.TierSystem then return false end
if not amount then amount = 1 end if not amount then amount = 1 end
local sql = MySQL.query.await('SELECT * FROM drugrep WHERE cid = ?', {ps.getIdentifier(source)}) local id = Bridge.Framework.GetPlayerIdentifier(source)
local reps = json.decode(sql[1].drugrep) if not playerRep[id] then
local update loadRep(source)
local rep = ''
if reps.coke == nil then rep = reps[1] else rep = reps end
if type == 'cornerselling' then
for k, v in pairs (QBConfig.SellLevel) do
if rep.cornerselling.level == k then
if rep.cornerselling.rep + amount >= v.maxrep then
update = json.encode({coke = rep.coke, heroin = rep.heroin, lsd = rep.lsd, dealerrep = rep.dealerrep, cornerselling = {label = v.label, price = v.price, rep = rep.cornerselling.rep + amount, level = k + 1}})
else
update = json.encode({coke = rep.coke, heroin = rep.heroin, lsd = rep.lsd, dealerrep = rep.dealerrep, cornerselling = {label = v.label, price = v.price, rep = rep.cornerselling.rep + amount, level = k}})
end
end
end
if update == '' then return false end
MySQL.update('UPDATE drugrep SET drugrep = ? WHERE cid = ?', {update, ps.getIdentifier(source)})
return true
else
rep[type] = rep[type] + amount
MySQL.update('UPDATE drugrep SET drugrep = ? WHERE cid = ?', {json.encode(rep), ps.getIdentifier(source)})
return true
end end
if type == 'cornerselling' then
local rep = playerRep[id].cornerselling
local cornerData = QBConfig.SellLevel[rep.level]
if rep.rep + amount >= cornerData.maxrep then
rep.level = rep.level + 1
rep.label = QBConfig.SellLevel[rep.level].label
rep.price = QBConfig.SellLevel[rep.level].price
end
rep.rep = rep.rep + amount
else
playerRep[id][type] = playerRep[id][type] + amount
end
MySQL.query.await('UPDATE drugrep SET drugrep = ? WHERE cid = ?', {json.encode(playerRep[id]), id})
end end
-- TODO: Callbacks
ps.registerCallback('md-drugs:server:GetCoppers', function(source, cb, args) ps.registerCallback('md-drugs:server:GetCoppers', function(source, cb, args)
return ps.getJobTypeCount('leo') return Bridge.Framework.GetPlayersByJob('police')
end) end)
ps.registerCallback('md-drugs:server:GetRep', function(source, cb, args) ps.registerCallback('md-drugs:server:GetRep', function(source, cb, args)
local rep = GetAllRep(source) local rep = GetAllRep(source)
return rep return rep
end) end)
ps.versionCheck('md-drugs', 'https://raw.githubusercontent.com/Mustachedom/md-drugs/refs/heads/main/version.txt', 'https://github.com/Mustachedom/md-drugs/') --TODO: fix versioncheck
Bridge.Version.VersionChecker('Mustachedom/md-drugs/', false)
+123 -125
View File
@@ -1,5 +1,7 @@
Recipes, Locations = Recipes or {}, Locations or {}
local heroinLabKits = {} local heroinLabKits = {}
local heroinRecipes = { Recipes.Heroin = {
dryheroin = { dryheroin = {
tier1 = {take = {poppyresin = 1}, give = {heroin = 1}}, tier1 = {take = {poppyresin = 1}, give = {heroin = 1}},
tier2 = {take = {poppyresin = 1}, give = {heroinstagetwo = 1}}, tier2 = {take = {poppyresin = 1}, give = {heroinstagetwo = 1}},
@@ -17,12 +19,13 @@ local heroinRecipes = {
}, },
fillneedle = { fillneedle = {
tier1 = {take = {heroinvial = 1, needle = 1}, give = {heroin_ready = 1}}, tier1 = {take = {heroinvial = 1, needle = 1}, give = {heroin_ready = 1}},
tier2 = {take = {heroinvialstagetwo = 1, needle = 1}, give = {heroin_readystagetwo = 1}}, tier2 = {take = {heroinvialstagetwo = 1, needle = 1}, give = {heroin_readystagetwo = 1}},
tier3 = {take = {heroinvialstagethree = 1, needle = 1}, give = {heroin_readystagethree = 1}}, tier3 = {take = {heroinvialstagethree = 1, needle = 1}, give = {heroin_readystagethree = 1}},
} }
} }
GlobalState.MDDrugsRecipes = Recipes
local heroinLocations = { Locations.Heroin = {
dryplant = { -- turn resin into powder dryplant = { -- turn resin into powder
{loc = vector3(-1353.77, -335.58, 43.92), l = 1.0, w = 1.0, rot = 45.0, gang = ""}, {loc = vector3(-1353.77, -335.58, 43.92), l = 1.0, w = 1.0, rot = 45.0, gang = ""},
}, },
@@ -36,48 +39,46 @@ local heroinLocations = {
{ped = 'a_m_m_farmer_01',loc = vector4(-1366.32, -334.40, 44.44,180.0), l = 1.0, w = 1.0, rot = 45.0, gang = ""}, {ped = 'a_m_m_farmer_01',loc = vector4(-1366.32, -334.40, 44.44,180.0), l = 1.0, w = 1.0, rot = 45.0, gang = ""},
} }
} }
GlobalState.MDDrugsLocations = Locations
local prices = { local prices = {
heroinlabkitprice = 10000 heroinlabkitprice = 10000
} }
ps.registerCallback('md-drugs:server:GetHeroinLocations', function(source)
return heroinLocations
end)
Bridge.Callback.Register('md-drugs:server:removeCleaningKitHeroin', function(source)
ps.registerCallback('removeCleaningkit', function(source) if heroinLabKits[source] then
for k, v in pairs(heroinLabKits) do return Bridge.Inventory.RemoveItem(source, 'cleaningkit', 1)
if v.ownerid == ps.getIdentifier(source) then
ps.removeItem(source, 'cleaningkit', 1)
return true
end
end end
return false return false
end) end)
local function getTier(source)
if not Config.TierSystem then
return 'tier1'
end
local heroin = tonumber(getRep(source, 'heroin'))
if heroin <= Config.Tier1 then
return 'tier1'
elseif heroin >= Config.Tier1 and heroin <= Config.Tier2 then
return'tier2'
else
return 'tier3'
end
end
RegisterServerEvent('md-drugs:server:dryplant', function(num) RegisterServerEvent('md-drugs:server:dryplant', function(num)
local src = source local src = source
if timeOut(src, 'md-drugs:server:dryplant') then return end if timeOut(src, 'md-drugs:server:dryplant') then return end
if not ps.checkDistance(src, heroinLocations.dryplant[num].loc, 3.0) then
ps.notify(src, ps.lang('Catches.notIn'), 'error') if not checkDistance(src, Locations.Heroin.dryplant[num].loc, 3.0) then
Bridge.Prints.Warn(src, Bridge.Language.Locale('Catches.notIn'), 'error')
return return
end end
local tier = 'tier1' local tier = getTier(src)
if Config.TierSystem then if not craft(src, Recipes.Heroin.dryheroin[tier]) then
local heroin = tonumber(getRep(src, 'heroin'))
if heroin <= Config.Tier1 then
tier = 'tier1'
elseif heroin >= Config.Tier1 and heroin <= Config.Tier2 then
tier = 'tier2'
else
tier = 'tier3'
end
end
if not ps.craftItem(src, heroinRecipes['dryheroin'][tier]) then
verifyHas(src, heroinRecipes['dryheroin'][tier].take)
return return
end end
end) end)
@@ -87,85 +88,92 @@ RegisterServerEvent('md-drugs:server:cutheroin', function(num)
if timeOut(src, 'md-drugs:server:cutheroin') then return end if timeOut(src, 'md-drugs:server:cutheroin') then return end
if not ps.checkDistance(src, heroinLocations.cutheroinone[num].loc, 3.0) then if not checkDistance(src, Locations.Heroin.cutheroinone[num].loc, 3.0) then
ps.notify(src, ps.lang('Catches.notIn'), 'error') Bridge.Prints.Warn(src, Bridge.Language.Locale('Catches.notIn'), 'error')
return return
end end
local tier = 'tier1'
if Config.TierSystem then if Config.TierSystem then
local itemList = { local itemList = {
heroin = 'tier1', heroin = 'tier1',
heroinstagetwo = 'tier2', heroinstagetwo = 'tier2',
heroinstagethree = 'tier3' heroinstagethree = 'tier3'
} }
for k, v in pairs(itemList) do for item, tiers in pairs (itemList) do
local cuth = ps.hasItem(src, k) if Bridge.Inventory.HasItem(src, item) then
if cuth then tier = tiers
if not ps.craftItem(src, heroinRecipes['cutheroin'][v]) then
verifyHas(src, heroinRecipes['cutheroin'][v].take)
return
end
AddRep(src, 'heroin')
return
end end
end end
else end
if not ps.craftItem(src, heroinRecipes['cutheroin']['tier1']) then
verifyHas(src, heroinRecipes['cutheroin']['tier1'].take) if not craft(src, Recipes.Heroin.cutheroin[tier]) then
return return
end
end end
end) end)
RegisterServerEvent('md-drugs:server:getheroinlabkit', function(num) RegisterServerEvent('md-drugs:server:getheroinlabkit', function(num)
local src = source local src = source
if timeOut(src, 'md-drugs:server:getheroinlabkit') then return end if timeOut(src, 'md-drugs:server:getheroinlabkit') then return end
if not ps.checkDistance(src, heroinLocations.buyKit[num].loc, 3.0) then
ps.notify(src, ps.lang('Catches.notIn'), 'error') if not checkDistance(src, Locations.Heroin.buyKit[num].loc, 3.0) then
Bridge.Prints.Warn(src, Bridge.Language.Locale('Catches.notIn'), 'error')
return return
end end
local has = ps.hasItem(src, 'heroinlabkit')
if has then ps.notify(src, ps.lang('heroin.hasKitAlready'), 'error') return end local has = Bridge.Inventory.HasItem(src, 'heroinlabkit')
if ps.removeMoney(src, 'cash', prices.heroinlabkitprice) then if has then
ps.addItem(src, 'heroinlabkit', 1) Bridge.Notify.SendNotify(src, Bridge.Language.Locale('heroin.hasKitAlready'), 'error')
return
end
if Bridge.Framework.RemoveAccountBalance(src, 'cash', prices.heroinlabkitprice) then
Bridge.Inventory.AddItem(src, 'heroinlabkit', 1)
else else
ps.notify(src, ps.lang('heroin.notEnoughMoney', prices.heroinlabkitprice), 'error') Bridge.Notify.SendNotify(src, Bridge.Language.Locale('heroin.notEnoughMoney', prices.heroinlabkitprice), 'error')
end end
end) end)
local function hasHKit(src)
for k, v in pairs(heroinLabKits) do
if v.ownerid == ps.getIdentifier(src) then
return true
end
end
return false
end
RegisterServerEvent('md-drugs:server:getheroinlabkitback', function() RegisterServerEvent('md-drugs:server:getheroinlabkitback', function()
local src = source local src = source
if not hasHKit(src) then return end
for k, v in pairs (heroinLabKits) do if not heroinLabKits[src] then
if v.ownerid == ps.getIdentifier(src) then return
table.remove(heroinLabKits, k)
ps.addItem(src, 'heroinlabkit', 1)
end
end end
local loc = vector3(heroinLabKits[src].coords.x, heroinLabKits[src].coords.y, heroinLabKits[src].coords.z)
if not checkDistance(src, loc, 5.0) then
return
end
heroinLabKits[src] = nil
Bridge.Inventory.AddItem(src, 'heroinlabkit', 1)
end) end)
ps.createUseable('heroinlabkit', function(source, item) Bridge.Framework.RegisterUsableItem('heroinlabkit', function(source, item)
local src = source local src = source
if not ps.hasItem(src, 'heroinlabkit', 1) then return end
local placed, loc = ps.callback('md-drugs:client:setheroinlabkit', src) if not Bridge.Inventory.HasItem(src, 'heroinlabkit', 1) then
return
end
if heroinLabKits[src] then
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('heroin.hasKitAlreadyPlaced'), "error")
return
end
local placed, loc = Bridge.Callback.Trigger('md-drugs:client:setheroinlabkit', src)
if placed then if placed then
if ps.removeItem(src, 'heroinlabkit', 1) then if Bridge.Inventory.RemoveItem(src, 'heroinlabkit', 1) then
table.insert(heroinLabKits, { heroinLabKits[src] = {
src = src, src = src,
ownerid = ps.getIdentifier(src), ownerid = Bridge.Framework.GetPlayerIdentifier(src),
coords = loc, coords = loc,
name = ps.getPlayerName(src) }
}) Bridge.Notify.SendNotify(src, Bridge.Language.Locale('heroin.placedKit'), "success")
ps.notify(src, ps.lang('heroin.placedKit'), "success")
end end
end end
end) end)
@@ -175,9 +183,13 @@ RegisterServerEvent('md-drugs:server:heatliquidheroin', function()
if timeOut(src, 'md-drugs:server:heatliquidheroin') then return end if timeOut(src, 'md-drugs:server:heatliquidheroin') then return end
if not hasHKit(src) then return end if not heroinLabKits[src] then
if not ps.hasItem(src, 'emptyvial', 1) then return end Bridge.Prints.Warn(src, Bridge.Language.Locale('Catches.notIn'), 'error')
return
end
if not Bridge.Inventory.HasItem(src, 'emptyvial', 1) then return end
local tier = 'tier1'
if Config.TierSystem then if Config.TierSystem then
local itemList = { local itemList = {
heroincut = 'tier1', heroincut = 'tier1',
@@ -185,37 +197,34 @@ RegisterServerEvent('md-drugs:server:heatliquidheroin', function()
heroincutstagethree = 'tier3' heroincutstagethree = 'tier3'
} }
for k, v in pairs(itemList) do for k, v in pairs(itemList) do
local cuth = ps.hasItem(src, k) if Bridge.Inventory.HasItem(src, k) then
if cuth then tier = v
if not ps.craftItem(src, heroinRecipes['fillvial'][v]) then break
verifyHas(src, heroinRecipes['fillvial'][v].take)
return
end
AddRep(src, 'heroin')
return
end end
end end
else end
if not ps.craftItem(src, heroinRecipes['fillvial']['tier1']) then if not craft(src, Recipes.Heroin.fillvial[tier]) then
verifyHas(src, heroinRecipes['fillvial']['tier1'].take) return
return
end
end end
end) end)
RegisterServerEvent('md-drugs:server:failheatingheroin', function() RegisterServerEvent('md-drugs:server:failheatingheroin', function()
local src = source local src = source
if not hasHKit(src) then return end
if not heroinLabKits[src] then
Bridge.Prints.Warn(src, Bridge.Language.Locale('Catches.notIn'), 'error')
return
end
local itemList = { local itemList = {
heroincut = 1, heroincut = 1,
heroincutstagetwo = 1, heroincutstagetwo = 1,
heroincutstagethree = 1 heroincutstagethree = 1
} }
for k, v in pairs(itemList) do for k, v in pairs(itemList) do
local cuth = ps.hasItem(src, k) if Bridge.Inventory.RemoveItem(src, k, v) then
if cuth then Bridge.Notify.SendNotify(src, Bridge.Language.Locale('heroin.failed'), "error")
ps.removeItem(src, k, v)
ps.notify(src, ps.lang('heroin.failed'), "error")
return return
end end
end end
@@ -224,33 +233,27 @@ end)
RegisterServerEvent('md-drugs:server:fillneedle', function(num) RegisterServerEvent('md-drugs:server:fillneedle', function(num)
local src = source local src = source
if timeOut(src, 'md-drugs:server:fillneedle') then return end if timeOut(src, 'md-drugs:server:fillneedle') then return end
if not ps.checkDistance(src, heroinLocations.fillneedle[num].loc, 3.0) then
ps.notify(src, ps.lang('Catches.notIn'), 'error') if not checkDistance(src, Locations.Heroin.fillneedle[num].loc, 3.0) then
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Catches.notIn'), 'error')
return return
end end
if not ps.hasItem(src, 'needle', 1) then return end local tier = 'tier1'
if Config.TierSystem then if Config.TierSystem then
local itemList = { local itemList = {
{item = 'heroinvial', tier = 'tier1', log = ' Filled Heroin Needle'}, heroinvial = 'tier1',
{item = 'heroinvialstagetwo', tier = 'tier2', log = ' Filled Heroin Needle tier 2'}, heroinvialstagetwo = 'tier2',
{item = 'heroinvialstagethree', tier = 'tier3', log = ' Filled Heroin Needle tier 3'} heroinvialstagethree = 'tier3'
} }
for k, v in pairs(itemList) do for item, tiers in pairs (itemList) do
local vh = ps.hasItem(src, v.item) if Bridge.Inventory.HasItem(src, item) then
if vh then tier = tiers
if not ps.craftItem(src, heroinRecipes['fillneedle'][v.tier]) then break
verifyHas(src, heroinRecipes['fillneedle'][v.tier].take)
return
end
AddRep(src, 'heroin')
return
end end
end end
else end
if not ps.craftItem(src, heroinRecipes['fillneedle']['tier1']) then if not craft(src, Recipes.Heroin.fillneedle[tier]) then
verifyHas(src, heroinRecipes['fillneedle']['tier1'].take) return
return
end
end end
end) end)
@@ -263,25 +266,20 @@ RegisterServerEvent('md-drugs:server:failheroin', function()
heroinvialstagethree = 1 heroinvialstagethree = 1
} }
for k, v in pairs (itemList) do for k, v in pairs (itemList) do
local cuth = ps.hasItem(src, k) if Bridge.Inventory.RemoveItem(src, k, v) then
if cuth then Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Heroin.failneedle'), "error")
ps.removeItem(src, k, v)
ps.notify(src, ps.lang('Heroin.failneedle'), "error")
return return
end end
end end
else else
ps.removeItem(src, 'heroinvial', 1) Bridge.Inventory.RemoveItem(src, 'heroinvial', 1)
end end
end) end)
AddEventHandler('playerDropped', function() AddEventHandler('playerDropped', function()
local src = source local src = source
for k, v in pairs(heroinLabKits) do if heroinLabKits[src] then
if v.src == src then heroinLabKits[src] = nil
table.remove(heroinLabKits, k) Bridge.Inventory.AddItem(src, 'heroinlabkit', 1)
ps.addItem(src, 'heroinlabkit', 1)
end
end end
end) end)
+1 -1
View File
@@ -37,7 +37,7 @@ end
RegisterServerEvent('md-drugs:server:givelean', function() RegisterServerEvent('md-drugs:server:givelean', function()
local src = source local src = source
local amount = math.random(1,5) local amount = math.random(1,5)
if not onRun[ps.getIdentifier(src)] then return ps.notify(src, ps.lang('lean.notOnRun'), "error") end if not onRun[ps.getIdentifier(src)] then return Bridge.Notify.SendNotify(src, Bridge.Language.Locale('lean.notOnRun'), "error") end
onRun[ps.getIdentifier(src)] = onRun[ps.getIdentifier(src)] + 1 onRun[ps.getIdentifier(src)] = onRun[ps.getIdentifier(src)] + 1
if math.random(1,100) <= 50 then if math.random(1,100) <= 50 then
ps.addItem(src, "mdlean", amount) ps.addItem(src, "mdlean", amount)
+136 -107
View File
@@ -1,215 +1,246 @@
Recipes, Locations = Recipes or {}, Locations or {}
local prices = { local prices = {
tabcost = 100, -- price per piece of tab paper event does 10 at a time tabcost = 100, -- price per piece of tab paper event does 10 at a time
lsdlabkitcost = 10000 -- price of the lsd lab kit lsdlabkitcost = 10000 -- price of the lsd lab kit
} }
local lsdRecipes = { Recipes.LSD = {
vial = { vial = {
heat = {take = {lysergic_acid = 1, diethylamide = 1,}, give = {lsd_one_vial = 1}} heat = {take = {lysergic_acid = 1, diethylamide = 1,}, give = {lsd_one_vial = 1}}
}, },
} }
GlobalState.MDDrugsRecipes = Recipes
local lsdLocations = { Locations.LSD = {
lysergicacid = { -- get lysergic acid lysergicacid = { -- get lysergic acid
{loc = vector3(-1381.21, -327.75, 39.85), l = 1.0, w = 1.0, rot = 45.0, gang = ""}, {loc = vector3(-1381.21, -327.75, 39.85), l = 1.0, w = 1.0, rot = 45.0, gang = ""},
{loc = vector3(2405.53, 5008.39, 46.02), l = 1.0, w = 1.0, rot = 45.0, gang = ""}, {loc = vector3(2405.53, 5008.39, 46.02), l = 1.0, w = 1.0, rot = 45.0, gang = ""},
}, },
diethylamide = { -- get diethylamide diethylamide = { -- get diethylamide
{loc = vector3(-1371.71, -316.02, 39.53), l = 1.0, w = 1.0, rot = 45.0, gang = ""}, {loc = vector3(-1372.89, -319.47, 39.05), l = 1.0, w = 1.0, rot = 45.0, gang = ""},
{loc = vector3(2408.38, 5011.18, 46.08), l = 1.0, w = 1.0, rot = 45.0, gang = ""}, {loc = vector3(2408.38, 5011.18, 46.08), l = 1.0, w = 1.0, rot = 45.0, gang = ""},
}, },
gettabs = { -- buy tab paper gettabs = { -- buy tab paper
{loc = vector3(-1370.77, -314.51, 39.58), l = 1.0, w = 1.0, rot = 45.0, gang = ""}, {loc = vector3(-1378.26, -336.56, 39.31), l = 1.0, w = 1.0, rot = 45.0, gang = ""},
{loc = vector3(2409.59, 5012.45, 46.09), l = 1.0, w = 1.0, rot = 45.0, gang = ""}, {loc = vector3(2409.59, 5012.45, 46.09), l = 1.0, w = 1.0, rot = 45.0, gang = ""},
}, },
buyLSDkit = { buyLSDkit = {
{ped = 'g_f_y_families_01', loc = vector4(2598.47, 5033.06, 105.86, 283.51), l = 1.0, w = 1.0, rot = 283.51, gang = ""}, {ped = 'g_f_y_families_01', loc = vector4(-1376.66, -325.52, 39.63, 142.1), l = 1.0, w = 1.0, rot = 283.51, gang = ""},
}, },
} }
GlobalState.MDDrugsLocations = Locations
ps.registerCallback('md-drugs:server:GetLSDLocations', function(source)
return lsdLocations
end)
local lsdTables = {} local lsdTables = {}
RegisterServerEvent('md-drugs:server:getlysergic', function(num) RegisterServerEvent('md-drugs:server:getlysergic', function(num)
local src = source local src = source
if timeOut(src, 'md-drugs:server:getlysergic') then return end if timeOut(src, 'md-drugs:server:getlysergic') then return end
if not ps.checkDistance(src, lsdLocations.lysergicacid[num].loc, 2.0) then
ps.notify(src, ps.lang('Catches.notIn'), "error") if not checkDistance(src, Locations.LSD.lysergicacid[num].loc, 2.0) then
Bridge.Prints.Warn(src, Bridge.Language.Locale('Catches.notIn'), "error")
return return
end end
ps.addItem(src, 'lysergic_acid', 2) Bridge.Inventory.AddItem(src, 'lysergic_acid', 2)
end) end)
RegisterServerEvent('md-drugs:server:getdiethylamide', function(num) RegisterServerEvent('md-drugs:server:getdiethylamide', function(num)
local src = source local src = source
if timeOut(src, 'md-drugs:server:getdiethylamide') then return end if timeOut(src, 'md-drugs:server:getdiethylamide') then return end
if not ps.checkDistance(src, lsdLocations.diethylamide[num].loc, 2.0) then if not checkDistance(src, Locations.LSD.diethylamide[num].loc, 2.0) then
ps.notify(src, ps.lang('Catches.notIn'), "error") Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Catches.notIn'), "error")
return return
end end
ps.addItem(src, 'diethylamide', 2) Bridge.Inventory.AddItem(src, 'diethylamide', 2)
end) end)
ps.createUseable('lsdlabkit', function(source, item) Bridge.Framework.RegisterUsableItem('lsdlabkit', function(source, item)
local src = source local src = source
local placed, loc = ps.callback('md-drugs:client:setlsdlabkit', src) local placed, loc = Bridge.Callback.Trigger('md-drugs:client:setlsdlabkit', src)
if placed then if placed then
if ps.removeItem(src, 'lsdlabkit', 1) then if Bridge.Inventory.RemoveItem(src, 'lsdlabkit', 1) then
table.insert(lsdTables, { lsdTables[src] = {
owner = ps.getPlayerName(src),
ownerid = ps.getIdentifier(src),
src = src, src = src,
loc = loc loc = loc
}) }
end end
end end
end) end)
local function hasLabKit(source)
local src = source
for k, v in pairs (lsdTables) do
if v.ownerid == ps.getIdentifier(src) then
return true
end
end
end
ps.registerCallback('md-drugs:server:removecleaningkit', function(source) Bridge.Callback.Register('md-drugs:server:removecleaningkit', function(source)
local src = source local src = source
return ps.removeItem(src, "cleaningkit", 1) if not lsdTables[src] then return false end
if not checkDistance(src, lsdTables[src].loc, 3.0) then
Bridge.Prints.Warn(src, Bridge.Language.Locale('Catches.notIn'), "error")
return false
end
return Bridge.Inventory.RemoveItem(src, "cleaningkit", 1)
end) end)
RegisterServerEvent('md-drugs:server:getlabkitback', function() RegisterServerEvent('md-drugs:server:getlabkitback', function()
local src = source local src = source
for k, v in pairs (lsdTables) do if timeOut(src, 'md-drugs:server:getlabkitback') then return end
if v.ownerid == ps.getIdentifier(src) then if lsdTables[src] then
table.remove(lsdTables, k) lsdTables[src] = nil
ps.addItem(src, 'lsdlabkit', 1) Bridge.Inventory.AddItem(src, 'lsdlabkit', 1)
end
end end
end) end)
RegisterServerEvent('md-drugs:server:heatliquid', function() RegisterServerEvent('md-drugs:server:heatliquid', function()
local src = source local src = source
if not hasLabKit(src) then return end if not lsdTables[src] then return end
if timeOut(src, 'md-drugs:server:heatliquid') then return end if timeOut(src, 'md-drugs:server:heatliquid') then return end
if not ps.craftItem(src, lsdRecipes['vial']['heat']) then if not checkDistance(src, lsdTables[src].loc, 3.0) then
verifyHas(src, lsdRecipes['vial']['heat'].take) Bridge.Prints.Warn(src, Bridge.Language.Locale('Catches.notIn'), "error")
return
end
if not craft(src, Recipes.LSD['vial']['heat']) then
return return
end end
end) end)
RegisterServerEvent('md-drugs:server:failheating', function() RegisterServerEvent('md-drugs:server:failheating', function()
local src = source local src = source
if not hasLabKit(src) then return end if not lsdTables[src] then return end
ps.removeItem(src, 'lysergic_acid', 1)
ps.removeItem(src, 'diethylamide', 1) if not checkDistance(src, lsdTables[src].loc, 3.0) then
ps.notify(src, ps.lang('lsd.failed'), "error") Bridge.Prints.Warn(src, Bridge.Language.Locale('Catches.notIn'), "error")
return
end
Bridge.Inventory.RemoveItem(src, 'lysergic_acid', 1)
Bridge.Inventory.RemoveItem(src, 'diethylamide', 1)
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('lsd.failed'), "error")
end) end)
RegisterServerEvent('md-drugs:server:refinequalityacid', function() RegisterServerEvent('md-drugs:server:refinequalityacid', function()
local src = source local src = source
if not hasLabKit(src) then return end
if timeOut(src, 'md-drugs:server:refinequalityacid') then return end if not lsdTables[src] then
if not ps.hasItem(src, 'lsd_one_vial', 1) then return end return
end
if not checkDistance(src, lsdTables[src].loc, 3.0) then
Bridge.Prints.Warn(src, Bridge.Language.Locale('Catches.notIn'), "error")
return
end
if timeOut(src, 'md-drugs:server:refinequalityacid') then
return
end
local removed = Bridge.Inventory.RemoveItem(src, 'lsd_one_vial', 1)
if not removed then
return
end
if Config.TierSystem then if Config.TierSystem then
local lsd = tonumber(getRep(src, 'lsd')) local lsd = tonumber(getRep(src, 'lsd'))
if ps.removeItem(src, 'lsd_one_vial', 1) then if lsd <= 30 then
if lsd <= 30 then Bridge.Inventory.AddItem(src,'lsd_vial_two', 1)
ps.addItem(src,'lsd_vial_two', 1) elseif lsd >= 31 and lsd <= 60 then
elseif lsd >= 31 and lsd <= 60 then Bridge.Inventory.AddItem(src,'lsd_vial_three', 1)
ps.addItem(src,'lsd_vial_three', 1) elseif lsd >= 61 and lsd <= 90 then
elseif lsd >= 61 and lsd <= 90 then Bridge.Inventory.AddItem(src,'lsd_vial_four', 1)
ps.addItem(src,'lsd_vial_four', 1) elseif lsd >= 91 and lsd <= 120 then
elseif lsd >= 91 and lsd <= 120 then Bridge.Inventory.AddItem(src,'lsd_vial_five', 1)
ps.addItem(src,'lsd_vial_five', 1) else
else Bridge.Inventory.AddItem(src,'lsd_vial_six', 1)
ps.addItem(src,'lsd_vial_six', 1)
end
AddRep(src,'lsd')
end end
AddRep(src,'lsd')
else else
local randomchance = math.random(1,100) local randomchance = math.random(1,100)
if ps.removeItem(src,'lsd_one_vial', 1) then if randomchance <= 60 then
if randomchance <= 60 then Bridge.Inventory.AddItem(src,'lsd_vial_two', 1)
ps.addItem(src,'lsd_vial_two', 1) elseif randomchance >= 61 and randomchance <= 75 then
elseif randomchance >= 61 and randomchance <= 75 then Bridge.Inventory.AddItem(src,'lsd_vial_three', 1)
ps.addItem(src,'lsd_vial_three', 1) elseif randomchance >= 76 and randomchance <= 85 then
elseif randomchance >= 76 and randomchance <= 85 then Bridge.Inventory.AddItem(src,'lsd_vial_four', 1)
ps.addItem(src,'lsd_vial_four', 1) elseif randomchance >= 86 and randomchance <= 93 then
elseif randomchance >= 86 and randomchance <= 93 then Bridge.Inventory.AddItem(src,'lsd_vial_five', 1)
ps.addItem(src,'lsd_vial_five', 1) else
else Bridge.Inventory.AddItem(src,'lsd_vial_six', 1)
ps.addItem(src,'lsd_vial_six', 1)
end
end end
end end
end) end)
RegisterServerEvent('md-drugs:server:failrefinequality', function() RegisterServerEvent('md-drugs:server:failrefinequality', function()
local src = source local src = source
if not hasLabKit(src) then return end
ps.removeItem(src,'lsd_one_vial', 1) if not lsdTables[src] then return end
if not checkDistance(src, lsdTables[src].loc, 3.0) then
Bridge.Prints.Warn(src, Bridge.Language.Locale('Catches.notIn'), "error")
return
end
Bridge.Inventory.RemoveItem(src,'lsd_one_vial', 1)
end) end)
RegisterServerEvent('md-drugs:server:gettabpaper', function(num) RegisterServerEvent('md-drugs:server:gettabpaper', function(num)
local src = source local src = source
if timeOut(src, 'md-drugs:server:gettabpaper') then return end if timeOut(src, 'md-drugs:server:gettabpaper') then return end
if not ps.checkDistance(src, lsdLocations.gettabs[num].loc, 3.0) then
ps.notify(src, ps.lang('Catches.notIn'), "error") if not checkDistance(src, Locations.LSD.gettabs[num].loc, 3.0) then
Bridge.Prints.Warn(src, Bridge.Language.Locale('Catches.notIn'), "error")
return return
end end
if ps.removeMoney(src, 'cash', prices.tabcost * 10) then
ps.addItem(src,'tab_paper', 10) if Bridge.Framework.RemoveAccountBalance(src, 'cash', prices.tabcost * 10) then
Bridge.Inventory.AddItem(src,'tab_paper', 10)
else else
ps.notify(src, ps.lang('Catches.notEnoughMoney'), "error") Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Catches.notEnoughMoney'), "error")
end end
end) end)
RegisterServerEvent('md-drugs:server:getlabkit', function(num) RegisterServerEvent('md-drugs:server:getlabkit', function(num)
local src = source local src = source
if timeOut(src, 'md-drugs:server:getlabkit') then return end if timeOut(src, 'md-drugs:server:getlabkit') then return end
if ps.hasItem(src,'lsdlabkit', 1) then
if Bridge.Inventory.HasItem(src,'lsdlabkit', 1) then
return return
end end
if not ps.checkDistance(src, lsdLocations.buyLSDkit[num].loc, 3.0) then
ps.notify(src, ps.lang('Catches.notIn'), "error") if not checkDistance(src, Locations.LSD.buyLSDkit[num].loc, 3.0) then
Bridge.Prints.Warn(src, Bridge.Language.Locale('Catches.notIn'), "error")
return return
end end
if ps.removeMoney(src, 'cash', prices.lsdlabkitcost) then if Bridge.Framework.RemoveAccountBalance(src, 'cash', prices.lsdlabkitcost) then
ps.addItem(src,'lsdlabkit', 1) Bridge.Inventory.AddItem(src,'lsdlabkit', 1)
else else
ps.notify(src, ps.lang('Catches.notEnoughMoney'), "error") Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Catches.notEnoughMoney'), "error")
end end
end) end)
RegisterServerEvent('md-drugs:server:maketabpaper', function() RegisterServerEvent('md-drugs:server:maketabpaper', function()
local src = source local src = source
if timeOut(src, 'md-drugs:server:maketabpaper') then return end if timeOut(src, 'md-drugs:server:maketabpaper') then return end
if not hasLabKit(src) then return end if not lsdTables[src] then return end
if not ps.hasItem(src,'tab_paper', 1) then return end if not checkDistance(src, lsdTables[src].loc, 3.0) then
Bridge.Prints.Warn(src, Bridge.Language.Locale('Catches.notIn'), "error")
return
end
local vialdata = { local vialdata = {
{vial = 'lsd_one_vial', sheet = 'smileyfacesheet', log = 'Made A Smiley Face Sheet'}, {vial = 'lsd_one_vial', give = {smileyfacesheet = 1}, take = {lsd_one_vial = 1, tab_paper = 1}},
{vial = 'lsd_vial_two', sheet = 'wildcherrysheet', log = 'Made A Wild Cherry Sheet'}, {vial = 'lsd_vial_two', give = {wildcherrysheet = 1}, take = {lsd_vial_two = 1, tab_paper = 1}},
{vial = 'lsd_vial_three', sheet = 'yinyangsheet', log = 'Made A Yin Yang Sheet'}, {vial = 'lsd_vial_three', give = {yinyangsheet = 1}, take = {lsd_vial_three = 1, tab_paper = 1}},
{vial = 'lsd_vial_four', sheet = 'pineapplesheet', log = 'Made A Pine Apple Sheet'}, {vial = 'lsd_vial_four', give = {pineapplesheet = 1}, take = {lsd_vial_four = 1, tab_paper = 1}},
{vial = 'lsd_vial_five', sheet = 'bartsheet', log = 'Made A Cluckin Bell Sheet'}, {vial = 'lsd_vial_five', give = {bartsheet = 1}, take = {lsd_vial_five = 1, tab_paper = 1}},
{vial = 'lsd_vial_six', sheet = 'gratefuldeadsheet', log = 'Made A Maze Sheet'} {vial = 'lsd_vial_six', give = {gratefuldeadsheet = 1}, take = {lsd_vial_six = 1, tab_paper = 1}}
} }
local vial = 1
for k, v in ipairs (vialdata) do for k, v in ipairs (vialdata) do
local check = ps.hasItem(src, v.vial) and ps.hasItem(src, 'tab_paper') local check = Bridge.Inventory.HasItem(src, v.vial)
if check then if check then
if ps.removeItem(src, v.vial, 1) and ps.removeItem(src, 'tab_paper', 1) then vial = k
ps.addItem(src, v.sheet, 1) break
end
end end
end end
if not craft(src, vialdata[vial]) then
return
end
end) end)
local sheets = { local sheets = {
@@ -222,21 +253,19 @@ local sheets = {
} }
for k, v in pairs (sheets) do for k, v in pairs (sheets) do
ps.createUseable(v.item, function(source) Bridge.Framework.RegisterUsableItem(v.item, function(source)
local src = source local src = source
local math = math.random(1,10) local math = math.random(1,10)
if ps.removeItem(src, v.item, 1) then if Bridge.Inventory.RemoveItem(src, v.item, 1) then
ps.addItem(src, v.recieve, math) Bridge.Inventory.AddItem(src, v.recieve, math)
end end
end) end)
end end
AddEventHandler('playerDropped', function() AddEventHandler('playerDropped', function()
local src = source local src = source
for k, v in pairs (lsdTables) do if lsdTables[src] then
if v.ownerid == ps.getPlayerCitizenId(src) then lsdTables[src] = nil
table.remove(lsdTables, k) Bridge.Inventory.AddItem(src, 'lsdlabkit', 1)
ps.addItem(src, 'lsdlabkit', 1)
end
end end
end) end)
+13 -11
View File
@@ -1,36 +1,38 @@
local mescalineLocation = { Recipes, locations = Recipes or {}, locations or {}
Locations.Mescaline = {
DryOutMescaline = { -- where to dry out your mescaline DryOutMescaline = { -- where to dry out your mescaline
{loc = vector3(1850.12, 2595.23, 45.67), l = 1.0, w = 1.0, rot = 0.0, gang = ""}, {loc = vector3(1850.12, 2595.23, 45.67), l = 1.0, w = 1.0, rot = 0.0, gang = ""},
}, },
} }
local mescalineRecipes = { GlobalState.MDDrugsLocations = Locations
Recipes.Mescaline = {
mescaline = { mescaline = {
dry = { dry = {
dried = {take = {cactusbulb = 1}, give = {driedmescaline = 1} } dried = {take = {cactusbulb = 1}, give = {driedmescaline = 1} }
} }
}, },
} }
GlobalState.MDDrugsRecipes = Recipes
ps.registerCallback('md-drugs:server:GetMescalineLocs', function(source)
return mescalineLocation
end)
RegisterNetEvent("md-drugs:server:drymescaline", function(num) RegisterNetEvent("md-drugs:server:drymescaline", function(num)
local src = source local src = source
if timeOut(src, 'md-drugs:server:drymescaline') then return end if timeOut(src, 'md-drugs:server:drymescaline') then return end
if not ps.checkDistance(src, mescalineLocation.DryOutMescaline[num].loc, 3.0) then
ps.notify(src, ps.lang('Catches.notIn'), "error") if not checkDistance(src, Locations.Mescaline.DryOutMescaline[num].loc, 3.0) then
Bridge.Prints.Warn(src, Bridge.Language.Locale('Catches.notIn'), "error")
return return
end end
if not ps.craftItem(src, mescalineRecipes.mescaline.dry.dried) then
verifyHas(src, mescalineRecipes.mescaline.dry.dried.take) if not craft(src, Recipes.Mescaline.mescaline.dry.dried) then
return return
end end
end) end)
ps.createUseable("driedmescaline", function(source, item) Bridge.Framework.RegisterUsableItem("driedmescaline", function(source, item)
local src = source local src = source
if ps.removeItem(src, "driedmescaline", 1) then if Bridge.Inventory.RemoveItem(src, "driedmescaline", 1) then
TriggerClientEvent("md-drugs:client:takemescaline", src) TriggerClientEvent("md-drugs:client:takemescaline", src)
end end
end) end)
+66 -59
View File
@@ -1,8 +1,7 @@
Recipes, Locations = Recipes or {}, Locations or {}
local onRun = {} local onRun = {}
local cool = {} local vehicles = {}
Locations.Meth = {
local methLocs = {
CookMeth = { CookMeth = {
{loc = vector3(1006.09, -3200.59, -38.52), l = 1.0, w = 1.0, rot = 45.0, offset = vec3(4.79, 2.13, -0.41), rotation = vector3(0,0,0.0), gang = ""}, {loc = vector3(1006.09, -3200.59, -38.52), l = 1.0, w = 1.0, rot = 45.0, offset = vec3(4.79, 2.13, -0.41), rotation = vector3(0,0,0.0), gang = ""},
}, },
@@ -33,113 +32,121 @@ local methLocs = {
{inside = vector3(996.91, -3200.83, -36.39), outside = vector3(-2222.04, 303.99, 174.6), l = 1.0, w = 1.0, rot = 45.0, gang = ""}, {inside = vector3(996.91, -3200.83, -36.39), outside = vector3(-2222.04, 303.99, 174.6), l = 1.0, w = 1.0, rot = 45.0, gang = ""},
} }
} }
GlobalState.MDDrugsLocations = Locations
local methRecipes = { Recipes.Meth = {
cook = { cook = {
heat = {take = {ephedrine = 1, acetone = 1}, give = {}} --Missing item heat = {take = {ephedrine = 1, acetone = 1}, give = {}}
}, },
bag = { bag = {
bags = {take = {empty_weed_bag = 5}, give = {methbags = 5} } bags = {take = {empty_weed_bag = 5}, give = {methbags = 5} }
} }
} }
GlobalState.MDDrugsRecipes = Recipes
ps.registerCallback('md-drugs:server:GetMethLocs', function(source) local function setTimeout(src)
return methLocs if onRun[src] then
end)
local function setTimeout(identifier)
if onRun[identifier] then
CreateThread(function() CreateThread(function()
Wait(10 * 60 * 1000) Wait(10 * 60 * 1000)
onRun[identifier] = nil onRun[src] = nil
end) end)
end end
end end
local function coolDown(identifier) RegisterServerEvent('md-drugs:server:givemethingridients', function(veh)
if cool[identifier] then
return false
else
cool[identifier] = true
CreateThread(function()
Wait(3500)
cool[identifier] = nil
end)
return true
end
end
RegisterServerEvent('md-drugs:server:givemethingridients', function()
local src = source local src = source
local amount = math.random(1,5) local amount = math.random(1,5)
if not onRun[ps.getIdentifier(src)] then return ps.notify(src, ps.lang('meth.notOnRun'), "error") end
onRun[ps.getIdentifier(src)] = onRun[ps.getIdentifier(src)] + 1 local vehicle = NetworkGetEntityFromNetworkId(veh)
if math.random(1,100) <= 50 then if vehicles[src] ~= vehicle then
ps.addItem(src, "ephedrine", amount) return Bridge.Notify.SendNotify(src, Bridge.Language.Locale('meth.noVehicle'), "error")
else
ps.addItem(src, "acetone", amount)
end end
if onRun[ps.getIdentifier(src)] >= 4 then
onRun[ps.getIdentifier(src)] = nil if not DoesEntityExist(vehicle) and GetEntityModel(vehicle) == GetHashKey('journey') then
return Bridge.Notify.SendNotify(src, Bridge.Language.Locale('meth.noVehicle'), "error")
end end
if timeOut(src, 'md-drugs:server:givemethingridients') then return end
if not onRun[src] then
return Bridge.Notify.SendNotify(src, Bridge.Language.Locale('meth.notOnRun'), "error")
end
onRun[src] = onRun[src] + 1
local chance = math.random(1,2) == 1 and 'ephedrine' or 'acetone'
if onRun[src] == 5 then
DeleteEntity(vehicle)
onRun[src] = nil
vehicles[src] = nil
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('meth.finishedRun'), "success")
end
Bridge.Inventory.AddItem(src, chance, amount)
end) end)
RegisterServerEvent('md-drugs:server:getmeth', function(num) RegisterServerEvent('md-drugs:server:getmeth', function(num)
local src = source local src = source
if timeOut(src, 'md-drugs:server:getmeth') then return end if timeOut(src, 'md-drugs:server:getmeth') then return end
if not ps.checkDistance(src, methLocs.BagMeth[num].loc, 2.5) then
ps.notify(src, ps.lang('Catches.notIn'), "error") if not checkDistance(src, Locations.Meth.BagMeth[num].loc, 2.5) then
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Catches.notIn'), "error")
return return
end end
if not ps.craftItem(src, methRecipes.bag.bags) then
verifyHas(src, methRecipes.bag.bags.take) if not craft(src, Recipes.Meth.bag.bags) then
return return
end end
end) end)
RegisterServerEvent('md-drugs:server:geteph', function(num) RegisterServerEvent('md-drugs:server:geteph', function(num)
local src = source local src = source
if not ps.checkDistance(src, methLocs.MethEph[num].loc, 2.5) then if timeOut(src, 'md-drugs:server:geteph') then return end
ps.notify(src, ps.lang('Catches.notIn'), "error") if not checkDistance(src, Locations.Meth.MethEph[num].loc, 2.5) then
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Catches.notIn'), "error")
return return
end end
if timeOut(src, 'md-drugs:server:geteph') then return end Bridge.Inventory.AddItem(src, 'ephedrine', 1)
ps.addItem(src, 'ephedrine', 1)
end) end)
RegisterServerEvent('md-drugs:server:getace', function(num) RegisterServerEvent('md-drugs:server:getace', function(num)
local src = source local src = source
if not ps.checkDistance(src, methLocs.MethAce[num].loc, 2.5) then if timeOut(src, 'md-drugs:server:getace') then return end
ps.notify(src, ps.lang('Catches.notIn'), "error") if not checkDistance(src, Locations.Meth.MethAce[num].loc, 2.5) then
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Catches.notIn'), "error")
return return
end end
if timeOut(src, 'md-drugs:server:getace') then return end Bridge.Inventory.AddItem(src, 'acetone', 1)
ps.addItem(src, 'acetone', 1)
end) end)
ps.registerCallback('md-drugs:server:startcook', function(source, num) Bridge.Callback.Register('md-drugs:server:startcook', function(source, num)
local src = source local src = source
if not ps.checkDistance(src, methLocs.CookMeth[num].loc, 2.5) then if not checkDistance(src, Locations.Meth.CookMeth[num].loc, 2.5) then
ps.notify(src, ps.lang('Catches.notIn'), "error") Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Catches.notIn'), "error")
return false return false
end end
local recipe = ps.craftItem(src, methRecipes.cook.heat) if not craft(src, Recipes.Meth.cook.heat) then
if not recipe then
verifyHas(src, methRecipes.cook.heat.take)
return false return false
end end
return true return true
end) end)
ps.registerCallback('md-drugs:server:registerMeth', function(source) Bridge.Callback.Register('md-drugs:server:registerMeth', function(source, loc, vehNetId)
local identifier = ps.getIdentifier(source) local src = source
if not identifier then return false end if onRun[source] then
if onRun[identifier] then
return false return false
else else
onRun[identifier] = 0 if checkDistance(src, Locations.Meth.MethHeist[loc].loc, 10.0) then
setTimeout(identifier) local vehicle = NetworkGetEntityFromNetworkId(vehNetId)
if DoesEntityExist(vehicle) and GetEntityModel(vehicle) == GetHashKey('journey') then
vehicles[src] = vehicle
else
return false
end
else
return false
end
onRun[source] = 0
setTimeout(source)
return true return true
end end
end) end)
+4 -4
View File
@@ -33,10 +33,10 @@ ps.registerCallback('md-drugs:server:payfortruck', function(source)
local src = source local src = source
if ps.removeMoney(src, 'cash', prices.payfortruck) or ps.removeMoney(src, 'bank', prices.payfortruck) then if ps.removeMoney(src, 'cash', prices.payfortruck) or ps.removeMoney(src, 'bank', prices.payfortruck) then
onRoute[src] = true onRoute[src] = true
ps.notify(src, ps.lang('oxy.paid', prices.payfortruck), "success") Bridge.Notify.SendNotify(src, Bridge.Language.Locale('oxy.paid', prices.payfortruck), "success")
return true return true
else else
ps.notify(src, ps.lang('Catches.notEnoughMoney'), "error") Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Catches.notEnoughMoney'), "error")
return false return false
end end
end) end)
@@ -46,12 +46,12 @@ RegisterServerEvent('md-drugs:server:giveoxybox', function()
local src = source local src = source
if timeOut(src, 'md-drugs:server:giveoxybox') then return end if timeOut(src, 'md-drugs:server:giveoxybox') then return end
if not onRoute[src] then if not onRoute[src] then
ps.notify(src, ps.lang('oxy.notOn'), "error") Bridge.Notify.SendNotify(src, Bridge.Language.Locale('oxy.notOn'), "error")
return return
end end
if not ps.checkDistance(src, oxyLocs.oxylocations[onRoute[src]], 3.5) then if not ps.checkDistance(src, oxyLocs.oxylocations[onRoute[src]], 3.5) then
ps.notify(src, ps.lang('Catches.notIn'), "error") Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Catches.notIn'), "error")
return return
end end
+3 -3
View File
@@ -25,7 +25,7 @@ ps.createUseable('prescription_pad', function(source, item)
{label = ps.getItemLabel('xanax_prescription'), value = 'xanax_prescription'} {label = ps.getItemLabel('xanax_prescription'), value = 'xanax_prescription'}
} }
local data = ps.callback('md-drugs:client:prescriptionpad', src, near, options) local data = ps.callback('md-drugs:client:prescriptionpad', src, near, options)
if not data then return ps.notify(src, ps.lang('pharma.canceled'), "error") end if not data then return Bridge.Notify.SendNotify(src, Bridge.Language.Locale('pharma.canceled'), "error") end
ps.addItem(ps.getSource(data.who), data.what, 1) ps.addItem(ps.getSource(data.who), data.what, 1)
end end
end) end)
@@ -46,7 +46,7 @@ for m, d in pairs (pharmabottle) do
if d == k then if d == k then
if ps.removeItem(src, d, 1) then if ps.removeItem(src, d, 1) then
ps.addItem(src, v, math.random(10,30)) ps.addItem(src, v, math.random(10,30))
ps.notify(src,ps.lang('pharma.unbottle'), "success") Bridge.Notify.SendNotify(src,Bridge.Language.Locale('pharma.unbottle'), "success")
end end
end end
end end
@@ -58,7 +58,7 @@ RegisterServerEvent('md-drugs:server:fillprescription', function(num)
local src = source local src = source
if timeOut(src, 'md-drugs:server:fillprescription') then return end if timeOut(src, 'md-drugs:server:fillprescription') then return end
if not ps.checkDistance(src, pharmaLocations.FillPrescription[num].loc, 3.5) then if not ps.checkDistance(src, pharmaLocations.FillPrescription[num].loc, 3.5) then
return ps.notify(src, ps.lang('Catches.notIn'), "error") return Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Catches.notIn'), "error")
end end
local pres = { local pres = {
vicodin_prescription = 'vicodinbottle', vicodin_prescription = 'vicodinbottle',
+1 -1
View File
@@ -228,7 +228,7 @@ for k, v in pairs (plantData) do
v.itemGive(src) v.itemGive(src)
end end
else else
ps.notify(src, ps.lang('Catches.notIn'), 'error') Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Catches.notIn'), 'error')
return return
end end
end) end)
+2 -2
View File
@@ -2,10 +2,10 @@
ps.createUseable('shrooms', function(source, item) ps.createUseable('shrooms', function(source, item)
local src = source local src = source
if not ps.callback("md-drugs:client:shrooms", src) then if not ps.callback("md-drugs:client:shrooms", src) then
ps.notify(src, ps.lang('shrooms.cancel'), "error") Bridge.Notify.SendNotify(src, Bridge.Language.Locale('shrooms.cancel'), "error")
return return
end end
ps.removeItem(src, 'shrooms', 1) ps.removeItem(src, 'shrooms', 1)
ps.notify(src, ps.lang('shrooms.took'), 'success') Bridge.Notify.SendNotify(src, Bridge.Language.Locale('shrooms.took'), 'success')
end) end)
+7 -7
View File
@@ -59,17 +59,17 @@ end)
RegisterNetEvent('md-drugs:server:buyWeedItem', function(loc, name, amount) RegisterNetEvent('md-drugs:server:buyWeedItem', function(loc, name, amount)
local src = source local src = source
if not ps.checkDistance(src, weedLocs.WeedSalesman[loc].loc, 3.5) then if not ps.checkDistance(src, weedLocs.WeedSalesman[loc].loc, 3.5) then
ps.notify(src, ps.lang('Checks.notIn'), "error") Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Checks.notIn'), "error")
return return
end end
if not weedStore[name] then if not weedStore[name] then
ps.notify(src, ps.lang('weed.itemDoesntExist'), "error") Bridge.Notify.SendNotify(src, Bridge.Language.Locale('weed.itemDoesntExist'), "error")
return return
end end
if ps.removeMoney(src, 'cash', weedStore[name] * amount) or ps.removeMoney(src, 'bank', weedStore[name] * amount) then if ps.removeMoney(src, 'cash', weedStore[name] * amount) or ps.removeMoney(src, 'bank', weedStore[name] * amount) then
ps.addItem(src, name, amount) ps.addItem(src, name, amount)
else else
ps.notify(src, ps.lang('Catches.notEnoughMoney'), "error") Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Catches.notEnoughMoney'), "error")
end end
end) end)
@@ -79,7 +79,7 @@ RegisterServerEvent('md-drugs:server:dryoutweed', function()
if ps.removeItem(src,"wetcannabis", 1) then if ps.removeItem(src,"wetcannabis", 1) then
ps.addItem(src,"drycannabis", 1) ps.addItem(src,"drycannabis", 1)
else else
ps.notify(src, ps.lang('weed.noDry'), "error") Bridge.Notify.SendNotify(src, Bridge.Language.Locale('weed.noDry'), "error")
end end
end) end)
@@ -112,13 +112,13 @@ ps.createUseable("dabrig", function(source, item)
TriggerClientEvent("md-drugs:client:dodabs", src) TriggerClientEvent("md-drugs:client:dodabs", src)
end end
else else
ps.notify(src, ps.lang('weed.needItem', ps.getItemLabel("butanetorch")), 'error') Bridge.Notify.SendNotify(src, Bridge.Language.Locale('weed.needItem', ps.getItemLabel("butanetorch")), 'error')
end end
end) end)
ps.createUseable("weedgrinder", function(source, item) ps.createUseable("weedgrinder", function(source, item)
local src = source local src = source
if not ps.hasItem(src, "drycannabis") then ps.notify(src, ps.lang('weed.needItem', ps.getItemLabel("drycannabis")), 'error') return end if not ps.hasItem(src, "drycannabis") then Bridge.Notify.SendNotify(src, Bridge.Language.Locale('weed.needItem', ps.getItemLabel("drycannabis")), 'error') return end
local check = ps.callback('md-drugs:client:uncuff', src, 'Grinding Weed') local check = ps.callback('md-drugs:client:uncuff', src, 'Grinding Weed')
if not check then return end if not check then return end
if ps.removeItem(src, "drycannabis",1 ) then if ps.removeItem(src, "drycannabis",1 ) then
@@ -128,7 +128,7 @@ end)
ps.createUseable("mdwoods", function(source, item) ps.createUseable("mdwoods", function(source, item)
local src = source local src = source
local check = ps.callback('md-drugs:client:uncuff', src, ps.lang('weed.crackBlunt')) local check = ps.callback('md-drugs:client:uncuff', src, Bridge.Language.Locale('weed.crackBlunt'))
if not check then return end if not check then return end
if ps.removeItem(src, "mdwoods",1 ) then if ps.removeItem(src, "mdwoods",1 ) then
ps.addItem(src, "bluntwrap", 5) ps.addItem(src, "bluntwrap", 5)
+3 -3
View File
@@ -38,7 +38,7 @@ RegisterServerEvent('md-drugs:server:buyWhippitItem', function(loc, item,amount)
if not itemShop[item] then return end if not itemShop[item] then return end
local price = itemShop[item] * amount local price = itemShop[item] * amount
if not ps.removeMoney(src, 'cash', price, 'whippit-shop') then if not ps.removeMoney(src, 'cash', price, 'whippit-shop') then
return ps.notify(src, ps.lang('Whippit.notEnoughMoney', price), 'error') return Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Whippit.notEnoughMoney', price), 'error')
end end
ps.addItem(src, item, amount) ps.addItem(src, item, amount)
end) end)
@@ -56,11 +56,11 @@ ps.createUseable('cracker', function(source)
end end
end end
if not balloonItem then if not balloonItem then
return ps.notify(src, ps.lang('Whippit.needBalloon'), 'error') return Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Whippit.needBalloon'), 'error')
end end
if not ps.removeItem(src, 'whipped_cream_cannister', 1) then if not ps.removeItem(src, 'whipped_cream_cannister', 1) then
return ps.notify(src, ps.lang('Whippit.needCanister'), 'error') return Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Whippit.needCanister'), 'error')
end end
if not ps.removeItem(src, balloonItem, 1) then if not ps.removeItem(src, balloonItem, 1) then
return ps.warn(src, 'Failed to remove balloon', 'error') return ps.warn(src, 'Failed to remove balloon', 'error')
+6 -6
View File
@@ -108,7 +108,7 @@ for k, v in pairs (burners) do
TriggerClientEvent("md-drugs:client:GetLocation", active[ps.getIdentifier(source)].src, active[ps.getIdentifier(source)]) TriggerClientEvent("md-drugs:client:GetLocation", active[ps.getIdentifier(source)].src, active[ps.getIdentifier(source)])
return return
end end
if ps.getJobTypeCount('leo') < settings.PoliceCount then return ps.notify(source, ps.lang('wholesale.notEnoughCops'), 'error') end if ps.getJobTypeCount('leo') < settings.PoliceCount then return Bridge.Notify.SendNotify(source, Bridge.Language.Locale('wholesale.notEnoughCops'), 'error') end
if ps.removeItem(source, k, 1) then if ps.removeItem(source, k, 1) then
local drugs, count = {}, 0 local drugs, count = {}, 0
for m, d in pairs (v) do for m, d in pairs (v) do
@@ -120,7 +120,7 @@ for k, v in pairs (burners) do
end end
if count < settings.WholesaleMinQuantity then if count < settings.WholesaleMinQuantity then
ps.addItem(source, k, 1) ps.addItem(source, k, 1)
ps.notify(source, ps.lang('wholesale.not_enough_drugs') or 'Not enough drugs for wholesale deal', 'error') Bridge.Notify.SendNotify(source, Bridge.Language.Locale('wholesale.not_enough_drugs') or 'Not enough drugs for wholesale deal', 'error')
return return
end end
active[ps.getIdentifier(source)] = { active[ps.getIdentifier(source)] = {
@@ -152,7 +152,7 @@ RegisterNetEvent('md-drugs:server:SuccessSale', function()
end end
local deal = active[id] local deal = active[id]
if deal.count < settings.WholesaleMinQuantity then if deal.count < settings.WholesaleMinQuantity then
ps.notify(src, 'Not enough drugs for wholesale deal', 'error') Bridge.Notify.SendNotify(src, 'Not enough drugs for wholesale deal', 'error')
active[id] = nil active[id] = nil
return return
end end
@@ -167,7 +167,7 @@ RegisterNetEvent('md-drugs:server:SuccessSale', function()
end end
end end
if need ~= have then if need ~= have then
ps.notify(src, 'You are missing some drugs for the deal', 'error') Bridge.Notify.SendNotify(src, 'You are missing some drugs for the deal', 'error')
active[id] = nil active[id] = nil
return return
end end
@@ -179,12 +179,12 @@ RegisterNetEvent('md-drugs:server:SuccessSale', function()
end end
end end
if not removed then if not removed then
ps.notify(src,'Failed to remove drugs for the deal', 'error') Bridge.Notify.SendNotify(src,'Failed to remove drugs for the deal', 'error')
active[id] = nil active[id] = nil
return return
end end
ps.addMoney(src, 'cash', finalPrice, 'Wholesale sale successful' .. ' $' .. finalPrice) ps.addMoney(src, 'cash', finalPrice, 'Wholesale sale successful' .. ' $' .. finalPrice)
ps.notify(src, 'Wholesale sale successful' .. ' $' .. finalPrice, 'success') Bridge.Notify.SendNotify(src, 'Wholesale sale successful' .. ' $' .. finalPrice, 'success')
active[id] = nil active[id] = nil
end) end)
+8 -8
View File
@@ -63,7 +63,7 @@ local activePresses = {}
RegisterServerEvent('md-drugs:server:stealisosafrole', function(num) RegisterServerEvent('md-drugs:server:stealisosafrole', function(num)
local src = source local src = source
if not ps.checkDistance(src, xtcLocations.isosafrole[num].loc, 3.0) then if not ps.checkDistance(src, xtcLocations.isosafrole[num].loc, 3.0) then
ps.notify(src, ps.lang('Checks.notIn'), "error") Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Checks.notIn'), "error")
return return
end end
if timeOut(src, 'md-drugs:server:stealisosafrole') then return end if timeOut(src, 'md-drugs:server:stealisosafrole') then return end
@@ -73,7 +73,7 @@ end)
RegisterServerEvent('md-drugs:server:stealmdp2p', function(num) RegisterServerEvent('md-drugs:server:stealmdp2p', function(num)
local src = source local src = source
if not ps.checkDistance(src, xtcLocations.mdp2p[num].loc, 3.0) then if not ps.checkDistance(src, xtcLocations.mdp2p[num].loc, 3.0) then
ps.notify(src, ps.lang('Checks.notIn'), "error") Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Checks.notIn'), "error")
return return
end end
if timeOut(src, 'md-drugs:server:stealmdp2p') then return end if timeOut(src, 'md-drugs:server:stealmdp2p') then return end
@@ -118,7 +118,7 @@ end)
RegisterServerEvent('md-drugs:server:makextc', function(data) RegisterServerEvent('md-drugs:server:makextc', function(data)
local src = source local src = source
if not activePresses[src] then if not activePresses[src] then
ps.notify(src, ps.lang('xtc.noPressOut'), 'error') Bridge.Notify.SendNotify(src, Bridge.Language.Locale('xtc.noPressOut'), 'error')
return return
end end
if timeOut(src, 'md-drugs:server:makextc') then return end if timeOut(src, 'md-drugs:server:makextc') then return end
@@ -132,14 +132,14 @@ end)
RegisterServerEvent('md-drugs:server:buypress', function(loc, item) RegisterServerEvent('md-drugs:server:buypress', function(loc, item)
local src = source local src = source
if not ps.checkDistance(src, xtcLocations.xtcpress[loc].loc, 2.0) then if not ps.checkDistance(src, xtcLocations.xtcpress[loc].loc, 2.0) then
ps.notify(src, ps.lang('Catches.notIn'), "error") Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Catches.notIn'), "error")
return return
end end
if timeOut(src, 'md-drugs:server:buypress') then return end if timeOut(src, 'md-drugs:server:buypress') then return end
if ps.removeMoney(src,"cash", RecipeList.presses['singlepress'].cash) then if ps.removeMoney(src,"cash", RecipeList.presses['singlepress'].cash) then
ps.addItem(src, "singlepress", 1) ps.addItem(src, "singlepress", 1)
else else
ps.notify(src, ps.lang('Catches.notEnoughMoney'), "error") Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Catches.notEnoughMoney'), "error")
end end
end) end)
@@ -147,7 +147,7 @@ RegisterServerEvent('md-drugs:server:upgradepress', function(data, item)
local src = source local src = source
if timeOut(src, 'md-drugs:server:upgradepress') then return end if timeOut(src, 'md-drugs:server:upgradepress') then return end
if not ps.checkDistance(src, xtcLocations.xtcpress[data].loc, 2.0) then if not ps.checkDistance(src, xtcLocations.xtcpress[data].loc, 2.0) then
ps.notify(src, ps.lang('Catches.notIn'), "error") Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Catches.notIn'), "error")
return return
end end
if not ps.craftItem(src, RecipeList.presses[item]) then if not ps.craftItem(src, RecipeList.presses[item]) then
@@ -164,7 +164,7 @@ end)
RegisterServerEvent('md-drugs:server:makingrawxtc', function(num) RegisterServerEvent('md-drugs:server:makingrawxtc', function(num)
local src = source local src = source
if not ps.checkDistance(src, xtcLocations.rawxtcloc[num].loc, 3.0) then if not ps.checkDistance(src, xtcLocations.rawxtcloc[num].loc, 3.0) then
ps.notify(src, ps.lang('Checks.notIn'), "error") Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Checks.notIn'), "error")
return return
end end
if timeOut(src, 'md-drugs:server:makingrawxtc') then return end if timeOut(src, 'md-drugs:server:makingrawxtc') then return end
@@ -207,7 +207,7 @@ RegisterServerEvent('md-drugs:server:stamp', function(num, color)
elseif ps.removeItem(src, colors[color].."4", 1) then elseif ps.removeItem(src, colors[color].."4", 1) then
ps.addItem(src, item..'4', 1) ps.addItem(src, item..'4', 1)
else else
ps.notify(src, ps.lang('xtc.noPills'), 'error') Bridge.Notify.SendNotify(src, Bridge.Language.Locale('xtc.noPills'), 'error')
end end
end) end)
+2 -2
View File
@@ -10,13 +10,13 @@ if GetResourceState('ps_lib') == 'missing' then
print('^1You can find ps_lib here: https://github.com/Project-Sloth/ps_lib') print('^1You can find ps_lib here: https://github.com/Project-Sloth/ps_lib')
return return
end end
Bridge = exports.community_bridge:Bridge()
ps = exports.ps_lib:init() --Ignore. ps = exports.ps_lib:init() --Ignore.
ps.loadLangs("en") -- set your language ps.loadLangs("en") -- set your language
Config.Fuel = "LegacyFuel" -- type the name of script you use i.e. ps-fuel, cdn-fuel, LegacyFuel, ox_fuel Config.Fuel = "LegacyFuel" -- type the name of script you use i.e. ps-fuel, cdn-fuel, LegacyFuel, ox_fuel
Config.TierSystem = true -- allows for three tiers of certain drugs ( coke, heroin, crack, lsd) Config.TierSystem = true -- allows for three tiers of certain drugs ( coke, heroin, crack, lsd)
Config.Emotes = 'rp' -- rp, dp, scully, custom
----------------------------------- TierSystem levels ** ONLY IN USE IF CONFIG.TIERSYTEM IS TRUE ----------------------------------- TierSystem levels ** ONLY IN USE IF CONFIG.TIERSYTEM IS TRUE
Config.Tier1 = 100 -- amount to hit for level 2 Config.Tier1 = 100 -- amount to hit for level 2
Config.Tier2 = 300 -- amount to hit for level 3 Config.Tier2 = 300 -- amount to hit for level 3