This commit is contained in:
Mustache Dom committed 2026-01-19 00:38:01 -07:00
1 parent 66934fd68a
commit df9584711a
16 files changed
+531 -285

No files matched your search

+2 -2
View File
@@ -1,7 +1,7 @@
ps.registerCallback('md-drugs:client:consumedrugs', function(time, effect, anim, progresstext, status, item)
if not ps.progressbar(progresstext .. ps.getLabel(item).. "!", time, anim ) then return end
Bridge.Callback.Register('md-drugs:client:consumedrugs', function(time, effect, anim, progresstext, status, item)
if not progressbar(progresstext .. Bridge.Inventory.GetItemInfo(item).label.. "!", time, anim ) then return end
for k, v in pairs (status) do
if k == 'health' then
local cur = GetEntityHealth(PlayerPedId())
+16 -2
View File
@@ -185,6 +185,10 @@ local function Cornersell()
end
RegisterNetEvent('md-drugs:client:cornerselling', function()
if inZone then
Bridge.Notify.SendNotify(Bridge.Language.Locale('Cornerselling.inNoSellZone'), 'error')
return
end
if sell then
sell = false
Bridge.HelpText.HideHelpText()
@@ -198,7 +202,17 @@ end)
CreateThread(function()
for k, v in pairs (QBConfig.NoSellZones) do
local box = ps.zones.box({ coords = v.loc, size = vec3(v.width, v.length, v.height), rotation = 180.0, debug = false,
onEnter = function() inZone = true end, onExit = function() inZone = false end})
Bridge.Point.Register(
'MDDRUGNOSELLZONE'..k,
v.loc,
(v.width or 10.0 + v.length or 10.0) / 2,
nil,
function()
inZone = true
end,
function(point, data)
inZone = false
end
)
end
end)
+1 -1
View File
@@ -1,6 +1,6 @@
--TODO: Make dealers better
local isActive = false
local dealer = {}
--TODO: Finish Dealers
local function SpawnDealer()
if #dealer >= 1 then
for k,v in pairs (dealer) do
+55 -13
View File
@@ -97,7 +97,7 @@ function minigame()
end
function GetRep()
local rep = ps.callback('md-drugs:server:GetRep')
local rep = Bridge.Callback.Trigger('md-drugs:server:GetRep')
return rep
end
@@ -124,7 +124,7 @@ end
function GetCops(number)
if number == 0 then return true end
local amount = ps.callback('md-drugs:server:GetCoppers')
local amount = Bridge.Callback.Trigger('md-drugs:server:GetCoppers')
if amount >= number then return true else Bridge.Notify.SendNotify('You Need '.. number - amount .. ' More Cops To Do This', 'error') end
end
@@ -136,6 +136,43 @@ function Freeze(entity, toggle, head)
SetBlockingOfNonTemporaryEvents(entity, toggle)
end
local function RotationToDirection(rotation)
local adjustedRotation = {
x = (math.pi / 180) * rotation.x,
y = (math.pi / 180) * rotation.y,
z = (math.pi / 180) * rotation.z
}
local direction = {
x = -math.sin(adjustedRotation.z) * math.abs(math.cos(adjustedRotation.x)),
y = math.cos(adjustedRotation.z) * math.abs(math.cos(adjustedRotation.x)),
z = math.sin(adjustedRotation.x)
}
return direction
end
local function RayCastGamePlayCamera(distance)
local currentRenderingCam = false
if not IsGameplayCamRendering() then
currentRenderingCam = GetRenderingCam()
end
local cameraRotation = not currentRenderingCam and GetGameplayCamRot() or GetCamRot(currentRenderingCam, 2)
local cameraCoord = not currentRenderingCam and GetGameplayCamCoord() or GetCamCoord(currentRenderingCam)
local direction = RotationToDirection(cameraRotation)
local destination = {
x = cameraCoord.x + direction.x * distance,
y = cameraCoord.y + direction.y * distance,
z = cameraCoord.z + direction.z * distance
}
local _, hit, endCoords, surfaceNormal, entityHit = GetShapeTestResult(StartShapeTestRay(cameraCoord.x, cameraCoord.y, cameraCoord.z, destination.x, destination.y, destination.z, -1, PlayerPedId(), 0))
return _, hit, endCoords, surfaceNormal, entityHit
end
local function ray()
local _, hit, endCoords, surfaceNormal, entityHit = RayCastGamePlayCamera(1000.0)
return hit, endCoords, surfaceNormal, entityHit
end
local created = false
local heading = 180.0
function StartRay()
@@ -144,10 +181,10 @@ function StartRay()
requestModel('v_ret_ml_tablea', 30000)
local table = CreateObject('v_ret_ml_tablea', pedcoord.x, pedcoord.y, pedcoord.z+1, heading, false, false)
repeat
local hit, endCoords, surfaceNormal, entityHit = ps.raycast()
local hit, endCoords, surfaceNormal, entityHit = ray()
if not created then
created = true
ps.drawText([[[E] To Place
Bridge.HelpText.ShowHelpText([[[E] To Place
[DEL] To Cancel
[<-] To Move Left
[->] To Move Right]])
@@ -164,7 +201,7 @@ function StartRay()
heading = heading + 2
end
if IsControlPressed(0, 38) then
ps.hideText()
Bridge.HelpText.HideHelpText()
run = false
DeleteObject(table)
created = false
@@ -172,7 +209,7 @@ function StartRay()
end
if IsControlPressed(0, 178) then
ps.hideText()
Bridge.HelpText.HideHelpText()
run = false
created = false
DeleteObject(table)
@@ -188,10 +225,10 @@ function StartRay2()
requestModel('bkr_prop_coke_press_01aa', 30000)
local table = CreateObject('bkr_prop_coke_press_01aa', pedcoord.x, pedcoord.y, pedcoord.z+1, heading, false, false)
repeat
local hit, endCoords, surfaceNormal, entityHit = ps.raycast()
local hit, endCoords, surfaceNormal, entityHit = ray()
if not created then
created = true
ps.drawText([[[E] To Place
Bridge.HelpText.ShowHelpText([[[E] To Place
[DEL] To Cancel
[<-] To Move Left
[->] To Move Right]])
@@ -208,7 +245,7 @@ function StartRay2()
heading = heading + 2
end
if IsControlPressed(0, 38) then
ps.hideText()
Bridge.HelpText.HideHelpText()
run = false
DeleteObject(table)
created = false
@@ -216,7 +253,7 @@ function StartRay2()
end
if IsControlPressed(0, 178) then
ps.hideText()
Bridge.HelpText.HideHelpText()
run = false
created = false
DeleteObject(table)
@@ -226,20 +263,25 @@ function StartRay2()
until run == false
end
ps.registerCallback('md-drugs:client:uncuff', function(data)
Bridge.Callback.Register('md-drugs:client:uncuff', function(data)
if not progressbar(data, 4000, 'uncuff') then return end
return true
end)
RegisterCommand('DrugRep', function()
if not Config.TierSystem then return end
local rep = ps.callback('md-drugs:server:GetRep', false)
ps.menu('Drug Rep', 'Drug Rep', {
local rep = GetRep()
Bridge.Menu.Open({
id = 'drugrep',
title = 'Drug Reputation',
description = 'Your Current Drug Reputation Stats',
options = {
{icon = "fa-solid fa-face-flushed", title = 'Cocaine: '..rep.coke},
{icon = "fa-solid fa-syringe", title = 'Heroin: '..rep.heroin},
{icon = "fa-solid fa-vial", title = 'LSD: '..rep.lsd},
{icon = "fa-solid fa-plug", title = 'Dealer: '..rep.dealerrep},
{icon = "fa-solid fa-money-bill", title = 'Corner Selling: ' .. rep.cornerselling.rep, description = 'Rank: ' .. rep.cornerselling.label }
}
})
end, false)
+62 -16
View File
@@ -1,61 +1,67 @@
local started = false
local hit = 0
local location = ps.callback('md-drugs:server:GetLeanLocs')
local leanCar = nil
local location = GlobalState.MDDrugsLocations.Lean
local function SpawnCarPedChase()
local function SpawnCarPedChase(loc)
local stoploc = vector3(-1157.63, -3056.71, 13.94)
local start = location.StartLoc[math.random(1,#location.StartLoc)]
if started then Bridge.Notify.SendNotify(Bridge.Language.Locale('lean.alreadyChasing'), 'error') return end
started = true
ps.callback('md-drugs:server:RegisterLean')
requestModel("pounder", 30000)
requestModel("ig_priest", 30000)
requestModel("cargobob3", 30000)
local leancar = CreateVehicle("pounder", start.x+3, start.y-2, start.z-1, 52.0, true, false)
leanCar = CreateVehicle("pounder", start.x+3, start.y-2, start.z-1, 52.0, true, false)
local driver = CreatePed(26, "ig_priest", start.x, start.y, start.z, 268.9422, false, false)
local pilot2 = CreatePed(26, "ig_priest", stoploc.x-3, stoploc.y-3, stoploc.z-1, 268.9422, false, false)
local can = Bridge.Callback.Trigger('md-drugs:server:registerLean', loc, NetworkGetNetworkIdFromEntity(leanCar))
if not can then
Bridge.Notify.SendNotify(Bridge.Language.Locale('lean.cantStart'), 'error')
DeleteVehicle(leanCar)
DeleteEntity(driver)
DeleteEntity(pilot2)
started = false
return
end
SetPedIntoVehicle(pilot2, leanCar, 1)
FreezeEntityPosition(driver, true)
FreezeEntityPosition(pilot2, true)
SetEntityInvincible(pilot2, true)
SetEntityAsMissionEntity(leancar)
AddBlipForEntity(leancar)
SetPedIntoVehicle(driver, leancar, -1)
SetEntityAsMissionEntity(leanCar)
AddBlipForEntity(leanCar)
SetPedIntoVehicle(driver, leanCar, -1)
SetPedFleeAttributes(driver,false)
TaskVehicleDriveToCoordLongrange(driver, leancar, stoploc.x, stoploc.y, stoploc.z-1, 50.0, 524288, 25.0)
TaskVehicleDriveToCoordLongrange(driver, leanCar, stoploc.x, stoploc.y, stoploc.z-1, 50.0, 524288, 25.0)
SetPedKeepTask(driver, true)
repeat
Wait(1000)
until #(GetEntityCoords(driver) - stoploc) < 20.0 or GetEntityHealth(driver) == 0
RemoveBlip(leancar)
RemoveBlip(leanCar)
if GetEntityHealth(driver) == 0 then
Bridge.Target.AddLocalEntity(leancar, {
Bridge.Target.AddLocalEntity(leanCar, {
{
name = 'leancar',
icon = 'fa-solid fa-car',
label = Bridge.Language.Locale('lean.stealFromTruck'),
action = function()
hit = hit + 1
if not minigame() then return end
TriggerServerEvent('md-drugs:server:givelean')
started = false
if math.random(1,100) <= 30 or hit == 4 then
hit = 0
DeleteVehicle(leancar)
DeleteEntity(driver)
DeleteEntity(pilot2)
end
end
}
})
else
DeleteVehicle(leancar)
DeleteEntity(driver)
DeleteEntity(pilot2)
end
@@ -80,3 +86,43 @@ for k, v in pairs (location.SyrupVendor) do
},
})
end
local function concat(tbl)
local str = ""
for k, v in pairs (tbl) do
str = str .. v.item .. " X " .. v.amount .. " \n "
end
return str
end
local function getDisabled(recipe)
for k, v in pairs (recipe.ingredients) do
local count = Bridge.Inventory.GetItemCount(v.item)
if count < v.amount then
return true
end
end
return false
end
RegisterNetEvent("md-drugs:client:makeLean", function()
local menu = {}
for k, v in pairs (GlobalState.MDDrugsRecipes.Lean) do
menu[#menu+1] = {
title = Bridge.Inventory.GetItemInfo(v.item).label,
description = concat(v.ingredients),
icon = Bridge.Inventory.GetItemInfo(v.item).image,
disabled = getDisabled(v),
onSelect = function()
if not progressbar(Bridge.Language.Locale('lean.makingLean'), 4000, 'uncuff') then return end
TriggerServerEvent('md-drugs:server:makeLean', k)
end,
}
end
Bridge.Menu.Open({
id = 'makeLeanMenu',
title = Bridge.Language.Locale('lean.makeLeanMenuTitle'),
description = Bridge.Language.Locale('lean.makeLeanMenuDesc'),
options = menu
})
end)
+2 -2
View File
@@ -1,6 +1,6 @@
local badTrip = 100
local locations = GlobalState.MDDrugsLocations.Mescaline
local function AlienEffect()
CreateThread(function()
StartScreenEffect("DrugsMichaelAliensFightIn", 3.0, 0)
@@ -13,7 +13,7 @@ local function AlienEffect()
end)
end
local locations = GlobalState.MDDrugsLocations.Mescaline
for k, v in pairs (locations.DryOutMescaline) do
Bridge.Target.AddBoxZone('dryoutMesc'..k, v.loc, vector3(v.l, v.w, 2.0), v.loc.w or 180.0,{
{
+90 -25
View File
@@ -1,12 +1,12 @@
local exploded, drying = false, false
local locations = ps.callback('md-drugs:server:GetWeedLocs')
local locations, recipes = GlobalState.MDDrugsLocations.Weed, GlobalState.MDDrugsRecipes.Weed
for k, v in pairs (locations.WeedDry) do
ps.boxTarget('weed_dry'..k, v.loc, {length = v.l, width = v.w, heading = v.rot}, {
Bridge.Target.AddBoxZone('weed_dry'..k, v.loc, vector3(v.l or 1.0, v.w or 1.0, 1.0), v.loc.w or 180.0, {
{
icon = 'fa-solid fa-cannabis',
label = Bridge.Language.Locale('weed.targetDry'),
action = function()
if not ps.hasItem('wetcannabis', 1) then
if not Bridge.Inventory.HasItem( "wetcannabis") then
Bridge.Notify.SendNotify(Bridge.Language.Locale('weed.noDry'), "error")
return
end
@@ -25,7 +25,7 @@ for k, v in pairs (locations.WeedDry) do
action = function()
DeleteEntity(weedplant)
drying = false
TriggerServerEvent('md-drugs:server:dryoutweed')
TriggerServerEvent('md-drugs:server:dryoutweed', k)
end,
}
})
@@ -39,7 +39,7 @@ for k, v in pairs (locations.WeedDry) do
end
for k, v in pairs (locations.WeedTele) do
ps.boxTarget('weed_tele'..k, v.inside, {length = v.l, width = v.w, heading = v.rot}, {
Bridge.Target.AddBoxZone('weed_tele'..k, v.inside, vector3(v.l or 1.0, v.w or 1.0, 1.0), v.rot or 180.0, {
{
icon = 'fa-solid fa-door-open',
label = Bridge.Language.Locale('weed.teleportOut'),
@@ -48,7 +48,7 @@ for k, v in pairs (locations.WeedTele) do
end
}
})
ps.boxTarget('weed_teleout'..k, v.outside, {length = v.l, width = v.w, heading = v.rot}, {
Bridge.Target.AddBoxZone('weed_teleout'..k, v.outside, vector3(v.l or 1.0, v.w or 1.0, 1.0), v.rot or 180.0, {
{
icon = 'fa-solid fa-door-closed',
label = Bridge.Language.Locale('weed.teleportIn'),
@@ -83,30 +83,34 @@ local function AlienEffect()
end
RegisterNetEvent("md-drugs:client:dodabs", function()
if not ps.progressbar(Bridge.Language.Locale('weed.dabs'), 4000, 'bong2') then AlienEffect() return end
if not progressbar(Bridge.Language.Locale('weed.dabs'), 4000, 'bong2') then AlienEffect() return end
end)
local function createBluntOptions(contextId, contextTitle, eventLabelPrefix, tableName)
local options = {}
local items = ps.callback('md-drugs:server:GetWeedRecipe', tableName)
for k, v in pairs(items) do
for k, v in pairs(recipes[tableName]) do
local label = {}
local item = ''
for m, d in pairs(v.take) do table.insert(label, ps.getLabel(m) .. ' X ' .. d) end
for m, d in pairs(v.take) do table.insert(label, Bridge.Inventory.GetItemInfo(m).label .. ' X ' .. d .. ' \n ') end
for m, d in pairs(v.give) do item = m end
local itemData = Bridge.Inventory.GetItemInfo(item)
options[#options + 1] = {
icon = ps.getImage(item),
description = table.concat(label, ", "),
title = ps.getLabel(item),
action = function()
icon = itemData.image,
description = table.concat(label, " "),
title = itemData.label,
onSelect = function()
if not minigame() then return end
if not ps.progressbar(eventLabelPrefix .. ps.getLabel(item), 4000, 'uncuff') then return end
if not progressbar(eventLabelPrefix .. itemData.label, 4000, 'uncuff') then return end
TriggerServerEvent('md-drugs:server:MakeWeedItems', {item = item, recipe = 'weed', num = k, table = tableName})
end
}
end
ps.sorter(options, 'title')
ps.menu(contextTitle, contextTitle, options)
Bridge.Menu.Open({
id = contextId,
title = contextTitle,
options = options,
})
end
RegisterNetEvent('md-drugs:client:makeBluntWrap', function(data)
@@ -128,28 +132,33 @@ for k, v in pairs (locations.WeedSalesman) do
icon = "fa-solid fa-cannabis",
label = Bridge.Language.Locale('weed.targetSales'),
action = function()
local itemList = ps.callback('md-drugs:server:getWeedItems')
local options = {}
for m, d in pairs (itemList) do
for m, d in pairs (recipes.weedStore) do
local itemInfo = Bridge.Inventory.GetItemInfo(m)
options[#options + 1] = {
icon = ps.getImage(m),
title = ps.getLabel(m),
icon = itemInfo.image,
title = itemInfo.label,
description = '$' .. d,
action = function()
local input = ps.input('Amount To Buy',{
onSelect = function()
local input = Bridge.Input.Open('Amount To Buy',{
{type = 'number', title = 'How Many To Buy', min = 1, max = 1000}
})
if not input and input[1] then return end
if not ps.progressbar(Bridge.Language.Locale('weed.buying', ps.getLabel(m)), 2000, 'uncuff') then return end
if not progressbar(Bridge.Language.Locale('weed.buying', Bridge.Inventory.GetItemInfo(m).label), 2000, 'uncuff') then return end
TriggerServerEvent('md-drugs:server:buyWeedItem', k, m, input[1])
end
}
end
ps.menu('Weed Shop', 'Weed Shop', options)
Bridge.Menu.Open({
id = 'weedDude',
title = 'Weed Salesman',
options = options,
})
end
}
})
end
local props = {}
for locationKey, locationData in pairs (locations.MakeButter) do
@@ -158,6 +167,34 @@ for locationKey, locationData in pairs (locations.MakeButter) do
props[#props+1] = CreateObject(locationData.prop, locationData.loc.x, locationData.loc.y, locationData.loc.z - 1.0, false, false, false)
FreezeEntityPosition(props[#props], true)
SetEntityHeading(props[#props], locationData.loc.w)
Bridge.Target.AddLocalEntity(props[#props], {
{
icon = "fa-solid fa-cannabis",
label = Bridge.Language.Locale('weed.targetMakeButter'),
action = function()
local options = {}
for k, v in pairs (recipes.makeButter) do
local itemInfo = Bridge.Inventory.GetItemInfo(k)
local label = {}
for m, d in pairs(v.recipe) do table.insert(label, Bridge.Inventory.GetItemInfo(m).label .. ' X ' .. d .. ' \n ') end
options[#options + 1] = {
icon = itemInfo.image,
title = itemInfo.label,
description = table.concat(label, " "),
onSelect = function()
if not progressbar(Bridge.Language.Locale('weed.making', itemInfo.label), 2000, 'uncuff') then return end
TriggerServerEvent('md-drugs:server:MakeWeedItems', 'makeButter', k, locationKey)
end
}
end
Bridge.Menu.Open({
id = 'weedMakeButter',
title = Bridge.Language.Locale('weed.makeButter'),
options = options,
})
end
}
})
end
end
for locationKey, locationData in pairs (locations.MakeOil) do
@@ -166,5 +203,33 @@ for locationKey, locationData in pairs (locations.MakeOil) do
props[#props+1] = CreateObject(locationData.prop, locationData.loc.x, locationData.loc.y, locationData.loc.z - 1.0, false, false, false)
FreezeEntityPosition(props[#props], true)
SetEntityHeading(props[#props], locationData.loc.w)
Bridge.Target.AddLocalEntity(props[#props], {
{
icon = "fa-solid fa-cannabis",
label = Bridge.Language.Locale('weed.targetMakeOil'),
action = function()
local options = {}
for k, v in pairs (recipes.makeOil) do
local itemInfo = Bridge.Inventory.GetItemInfo(k)
local label = {}
for m, d in pairs(v.recipe) do table.insert(label, Bridge.Inventory.GetItemInfo(m).label .. ' X ' .. d .. ' \n ') end
options[#options + 1] = {
icon = itemInfo.image,
title = itemInfo.label,
description = table.concat(label, " "),
onSelect = function()
if not progressbar(Bridge.Language.Locale('weed.making', itemInfo.label), 2000, 'uncuff') then return end
TriggerServerEvent('md-drugs:server:MakeWeedItems', 'makeOil', k, locationKey)
end
}
end
Bridge.Menu.Open({
id = 'weedMakeButter',
title = Bridge.Language.Locale('weed.makeButter'),
options = options,
})
end
}
})
end
end
+36 -31
View File
@@ -1,12 +1,12 @@
local prop = nil
local function animation(color)
local coords = GetEntityCoords(PlayerPedId())
ps.requestAnim('mp_player_intdrink')
Bridge.Anim.RequestDict('mp_player_intdrink')
requestModel(color)
prop = CreateObject(GetHashKey(color), coords.x, coords.y, coords.z, true, true, true)
AttachEntityToEntity(prop, PlayerPedId(), GetPedBoneIndex(PlayerPedId(), 18905), 0.087000, -0.130001, 0.138999, 63.630001, 3.299881, -21.000000, true, true, false, true, 1, true)
TaskPlayAnim(PlayerPedId(), 'mp_player_intdrink', 'loop_bottle', 8.0, -8.0, -1, 49, 0, false, false, false)
if ps.progressbar('Inhaling Nitrous', 5000, false) then
if progressbar('Inhaling Nitrous', 5000, false) then
ClearPedTasks(PlayerPedId())
DetachEntity(prop, true, true)
DeleteEntity(prop)
@@ -28,7 +28,7 @@ local function blur(duration)
end)
end
ps.registerCallback('md-drugs:client:useWhippit', function(color)
Bridge.Callback.Register('md-drugs:client:useWhippit', function(color)
if animation(color) then
blur(30000)
return true
@@ -38,39 +38,44 @@ ps.registerCallback('md-drugs:client:useWhippit', function(color)
end)
local function spawnShops()
local locations = ps.callback('md-drugs:server:getWhippitLocations')
for k, v in pairs(locations) do
for k, v in pairs(GlobalState.MDDrugsLocations.Whippit) do
requestModel(v.ped)
local ped = CreatePed(5, GetHashKey(v.ped), v.loc.x, v.loc.y, v.loc.z, v.loc.w, true, true)
FreezeEntityPosition(ped, true)
SetEntityInvincible(ped, true)
SetBlockingOfNonTemporaryEvents(ped, true)
--Bridge.Target.AddLocalEntity(ped, {
-- {
-- label = Bridge.Language.Locale('Whippit.targetShop'),
-- icon = 'fa-solid fa-cart-shopping',
-- action = function()
-- local menu = {}
-- local items = ps.callback('md-drugs:server:getwhippitShop')
-- for item, price in pairs (items) do
-- menu[#menu + 1] = {
-- title = ps.getLabel(item),
-- icon = ps.getImage(item),
-- description = '$' .. price,
-- action = function()
-- local amount = ps.input(ps.getLabel(item), {
-- {type = 'number', label = 'Amount', name = 'amount', min = 1, max = 100, default = 1}
-- })
-- if amount and amount[1] then
-- TriggerServerEvent('md-drugs:server:buyWhippitItem', k, item, amount[1])
-- end
-- end
-- }
-- end
-- ps.menu(Bridge.Language.Locale('Whippit.shopHeader'), Bridge.Language.Locale('Whippit.shopHeader'), menu)
-- end
-- },
--})
Bridge.Target.AddLocalEntity(ped, {
{
label = Bridge.Language.Locale('Whippit.targetShop'),
icon = 'fa-solid fa-cart-shopping',
action = function()
local menu = {}
for item, price in pairs (GlobalState.MDDrugsRecipes.Whippit.shop) do
local itemInfo = Bridge.Inventory.GetItemInfo(item)
Bridge.Prints.Debug(itemInfo)
menu[#menu + 1] = {
title = itemInfo.label,
icon = itemInfo.image,
description = '$' .. price,
onSelect = function()
local amount = Bridge.Input.Open(itemInfo.label, {
{type = 'number', label = 'Amount', name = 'amount', min = 1, max = 100, default = 1}
})
if amount and amount[1] then
TriggerServerEvent('md-drugs:server:buyWhippitItem', k, item, amount[1])
end
end
}
end
Bridge.Menu.Open({
id = 'whippitShop',
title = Bridge.Language.Locale('Whippit.shopHeader'),
options = menu
})
end
},
})
end
end
+5 -5
View File
@@ -150,23 +150,23 @@ xanax = { anim = 'pill', effect = 'none', add = { stress = -40
}
for k, v in pairs(Consume) do
ps.createUseable(k, function(source, item)
if not ps.hasItem(source, k, 1) then return end
Bridge.Callback.Register(k, function(source, item)
if not Bridge.Inventory.HasItem(source, k, 1) then return end
local time = v.time or Consumables.defaulttime
local effect = v.effect or 0
local anim = v.anim or Consumables.defaultanim
local progressbartext = v.progressbartext or Consumables.defaultprogresstext
local add = v.add or {hunger = 0}
local done = ps.callback('md-drugs:client:consumedrugs', source, time, effect, anim, progressbartext, add, k)
local done = Bridge.Callback.Trigger('md-drugs:client:consumedrugs', source, time, effect, anim, progressbartext, add, k)
if done then
ps.removeItem(source, k, 1)
Bridge.Inventory.RemoveItem(source, k, 1)
end
end)
end
RegisterNetEvent('md-drugs:server:updatestatus', function(stat, statval)
local src = source
local Player = ps.getPlayer(src)
local Player = Bridge.Framework.GetPlayer(src)
if GetResourceState('es_extended') == 'started' then return end
local hunger, thirst = Player.PlayerData.metadata.hunger, Player.PlayerData.metadata.thirst
if stat == "thirst" then
+7 -8
View File
@@ -165,6 +165,7 @@ local function getLoc(src, ped)
end
return false
end
Bridge.Callback.Register('md-drugs:server:cornerselling:getAvailableDrugs', function(source, ped)
local src = source
local rep = getRep(source, 'cornerselling')
@@ -269,19 +270,17 @@ RegisterNetEvent('md-drugs:server:getBackRobbed', function(peds)
RobbedDrugs[src] = nil
end)
ps.registerCommand('cornersell', {
help = Bridge.Language.Locale('Cornerselling.comDes'),
params = {
},
}, function(source, args, raw)
RegisterCommand('cornersell', function(source, args, raw)
local src = source
local jobCount = ps.getJobTypeCount('leo')
if jobCount < cornsellConfig.policeRequired then
local jobCount = Bridge.Framework.GetPlayersByJob('police')
if #jobCount < cornsellConfig.policeRequired then
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Catches.noCops'), 'error')
return
end
TriggerClientEvent('md-drugs:client:cornerselling', src)
end)
end, false)
TriggerClientEvent('chat:addSuggestion', -1, '/cornersell', Bridge.Language.Locale('Cornerselling.comDes'))
RegisterServerEvent('md-drugs:server:cornerselling:stop', function()
local src = source
+1 -1
View File
@@ -91,7 +91,7 @@ for k, v in pairs (cokecut) do
return
end
if Bridge.Inventory.HasItem(src,item.name) then
local check = ps.callback('md-drugs:client:uncuff', src, 'Cutting It Further')
local check = Bridge.Callback.Trigger('md-drugs:client:uncuff', src, 'Cutting It Further')
if not check then return end
if Bridge.Inventory.RemoveItem(src, k, 1) and Bridge.Inventory.RemoveItem(src, 'bakingsoda', 1) then
Bridge.Inventory.AddItem(src, 'crackrock', v)
+2 -1
View File
@@ -235,6 +235,7 @@ ps.registerCommand("deletedealer", {
end
end)
RegisterNetEvent('md-drugs:server:buyItemDealer', function(num, loc)
local src = source
local itemData = Products[num]
@@ -249,7 +250,7 @@ RegisterNetEvent('md-drugs:server:buyItemDealer', function(num, loc)
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')
Bridge.Notify.SendNotify(src, string.format(Bridge.Language.Locale('Deliveries.buyItemSuccess'), 1, Bridge.Inventory.GetItemInfo(itemData.name).label, itemData.price), 'success')
end)
Dealers = MySQL.query.await('SELECT * FROM dealers')
+1 -1
View File
@@ -128,7 +128,7 @@ ps.registerCallback('md-drugs:server:GetCoppers', function(source, cb, args)
return Bridge.Framework.GetPlayersByJob('police')
end)
ps.registerCallback('md-drugs:server:GetRep', function(source, cb, args)
Bridge.Callback.Register('md-drugs:server:GetRep', function(source, cb, args)
local rep = GetAllRep(source)
return rep
end)
+90 -22
View File
@@ -1,6 +1,7 @@
Locations = Locations or {}
Recipes = Recipes or {}
local onRun = {}
local leanLocs = {
Locations.Lean = {
MakeLean = {
{
loc = vector3(2635.81, 4240.57, 45.32),
@@ -22,10 +23,28 @@ local leanLocs = {
},
}
ps.registerCallback('md-drugs:server:GetLeanLocs', function(source)
return leanLocs
end)
GlobalState.MDDrugsLocations = Locations
Recipes.Lean = {
{
item = 'cupoflean',
amount = 1,
ingredients = {
{item = 'leancup', amount = 1},
{item = 'mdlean', amount = 1},
{item = 'sprunk', amount = 1},
}
},
{
item = 'cupofdextro',
amount = 1,
ingredients = {
{item = 'leancup', amount = 1},
{item = 'mdreddextro', amount = 1},
{item = 'sprunk', amount = 1},
}
}
}
GlobalState.MDDrugsRecipes = Recipes
local function setTimeout(identifier)
if onRun[identifier] then
CreateThread(function()
@@ -36,21 +55,33 @@ local function setTimeout(identifier)
end
RegisterServerEvent('md-drugs:server:givelean', function()
local src = source
local amount = math.random(1,5)
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
if math.random(1,100) <= 50 then
ps.addItem(src, "mdlean", amount)
else
ps.addItem(src, "mdreddextro", amount)
if not onRun[src] then
return
end
if onRun[ps.getIdentifier(src)] >= 4 then
onRun[ps.getIdentifier(src)] = nil
local veh = onRun[src].vehicle
if not veh or veh == 0 then
return
end
if GetEntityModel(veh) ~= GetHashKey('pounder') then
return
end
local pcoords, vcoords = GetEntityCoords(GetPlayerPed(src)), GetEntityCoords(veh)
if #(pcoords - vcoords) > 10.0 then
return
end
onRun[src].taken = onRun[src].taken + 1
local item, amount = math.random(1,2) == 1 and 'mdlean' or 'mdreddextro', math.random(1,3)
Bridge.Inventory.AddItem(src, item, amount)
if onRun[src].taken < 5 then
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('lean.maxTaken'), 'error')
DeleteEntity(veh)
onRun[src] = nil
return
end
end)
exports.ps_lib:registerCrafter({
loc = leanLocs.MakeLean,
loc = Locations.Lean.MakeLean,
recipes = {
cupoflean = {
amount = 1,
@@ -80,14 +111,51 @@ exports.ps_lib:registerCrafter({
},
})
ps.registerCallback('md-drugs:server:RegisterLean', function(source)
local identifier = ps.getIdentifier(source)
if not identifier then return false end
if onRun[identifier] then
Bridge.Callback.Register('md-drugs:server:registerLean', function(source, loc, vehicleNetId)
local src = source
if onRun[src] then
return false
else
onRun[identifier] = 0
setTimeout(identifier)
if not checkDistance(src, Locations.Lean.SyrupVendor[loc].loc, 5.0) then
return false
end
if not vehicleNetId then
return false
end
local veh = NetworkGetEntityFromNetworkId(vehicleNetId)
if not veh or veh == 0 or GetEntityModel(veh) ~= GetHashKey('pounder') then
return false
end
onRun[src] = {
taken = 0,
vehicle = veh,
}
setTimeout(src)
return true
end
end)
Bridge.Framework.RegisterUsableItem('leancup', function(source, item)
local src = source
if not item then return end
TriggerClientEvent('md-drugs:client:makeLean', src)
end)
RegisterNetEvent('md-drugs:server:makeLean', function(recipe)
local src = source
if not Recipes.Lean[recipe] then
return
end
local rec = Recipes.Lean[recipe]
for k, v in pairs (rec.ingredients) do
if not Bridge.Inventory.HasItem(src, v.item, v.amount) then
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('lean.missingIngredients'), 'error')
return
end
end
for k, v in pairs (rec.ingredients) do
Bridge.Inventory.RemoveItem(src, v.item, v.amount)
end
Bridge.Inventory.AddItem(src, rec.item, rec.amount)
end)
+131 -122
View File
@@ -1,4 +1,7 @@
local weedLocs = {
Locations, Recipes = Locations or {}, Recipes or {}
Locations.Weed = {
WeedTele = { -- where you tele out of weed
{inside = vector3(1066.31, -3183.36, -39.16), outside = vector3(244.74, 374.54, 105.74), l = 1.0, w = 1.0, rot = 45.0, gang = ""},
},
@@ -18,19 +21,7 @@ local weedLocs = {
{loc = vector4(1030.77, -3203.18, -38.2, 262.37), ped = 'a_m_m_farmer_01', gang = ""},
},
}
local weedStore = {
weedgrinder =25,
mdbutter =25,
flour =25,
chocolate =25,
butane =25,
butanetorch =2,
dabrig =2,
mdwoods =2,
}
local weed = {
Recipes.Weed = {
blunts = {
blunt = {take = {bluntwrap = 1, grindedweed = 1}, give = {blunt = 1}},
chewyblunt = {take = {bluntwrap = 1, grindedweed = 1, loosecoke = 1}, give = {chewyblunt = 1}},
@@ -40,106 +31,8 @@ local weed = {
bluntwrap = {
leanbluntwrap = {take = {bluntwrap = 5, mdlean = 1}, give = {leanbluntwrap = 5}},
dextrobluntwrap = {take = {bluntwrap = 5, mdreddextro = 1}, give = {dextrobluntwrap = 5}},
}
}
ps.registerCallback('md-drugs:server:GetWeedRecipe', function(source, tableName)
if not source then return false end
return weed[tableName]
end)
ps.registerCallback('md-drugs:server:GetWeedLocs', function(source)
return weedLocs
end)
ps.registerCallback('md-drugs:server:getWeedItems', function(source)
return weedStore
end)
RegisterNetEvent('md-drugs:server:buyWeedItem', function(loc, name, amount)
local src = source
if not ps.checkDistance(src, weedLocs.WeedSalesman[loc].loc, 3.5) then
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Checks.notIn'), "error")
return
end
if not weedStore[name] then
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('weed.itemDoesntExist'), "error")
return
end
if ps.removeMoney(src, 'cash', weedStore[name] * amount) or ps.removeMoney(src, 'bank', weedStore[name] * amount) then
ps.addItem(src, name, amount)
else
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Catches.notEnoughMoney'), "error")
end
end)
RegisterServerEvent('md-drugs:server:dryoutweed', function()
local src = source
if timeOut(src, 'md-drugs:server:dryoutweed') then return end
if ps.removeItem(src,"wetcannabis", 1) then
ps.addItem(src,"drycannabis", 1)
else
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('weed.noDry'), "error")
end
end)
local bluntwrap = {'mdreddextro','mdlean'}
for k, v in pairs (bluntwrap) do
ps.createUseable(v, function(source, item) TriggerClientEvent('md-drugs:client:makeBluntWrap', source) end)
end
local bluntwraps = {'leanbluntwrap', 'dextrobluntwrap', 'bluntwrap'}
for k, v in pairs (bluntwraps) do
ps.createUseable(v, function(source, item) TriggerClientEvent('md-drugs:client:rollBlunt', source) end)
end
RegisterServerEvent('md-drugs:server:MakeWeedItems', function(data)
local src = source
if timeOut(src, 'md-drugs:server:MakeWeedItems') then return end
if not ps.craftItem(src, weed[data.table][data.item]) then
verifyHas(src, weed[data.table][data.item].take)
return
end
end)
ps.createUseable("dabrig", function(source, item)
local src = source
if ps.hasItem(src, "butanetorch") then
if ps.removeItem(src, "shatter", 1) then
TriggerClientEvent("md-drugs:client:dodabs", src)
end
else
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('weed.needItem', ps.getItemLabel("butanetorch")), 'error')
end
end)
ps.createUseable("weedgrinder", function(source, item)
local src = source
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')
if not check then return end
if ps.removeItem(src, "drycannabis",1 ) then
ps.addItem(src, "grindedweed", 1)
end
end)
ps.createUseable("mdwoods", function(source, item)
local src = source
local check = ps.callback('md-drugs:client:uncuff', src, Bridge.Language.Locale('weed.crackBlunt'))
if not check then return end
if ps.removeItem(src, "mdwoods",1 ) then
ps.addItem(src, "bluntwrap", 5)
ps.addItem(src, "tobacco", 5)
end
end)
exports['ps_lib']:registerCrafter({
loc = weedLocs.MakeButter,
recipes = {
},
makeButter= {
cannabutter = {
amount = 1,
time = 4000,
@@ -186,13 +79,8 @@ exports['ps_lib']:registerCrafter({
flour = 1
}
}
}
})
exports['ps_lib']:registerCrafter({
loc = weedLocs.MakeOil,
recipes = {
},
makeOil = {
shatter = {
amount = 1,
time = 4000,
@@ -202,7 +90,128 @@ exports['ps_lib']:registerCrafter({
grindedweed = 1
}
}
},
weedStore = {
weedgrinder =25,
mdbutter =25,
flour =25,
chocolate =25,
butane =25,
butanetorch =2,
dabrig =2,
mdwoods =2,
}
})
}
GlobalState.MDDrugsLocations = Locations
GlobalState.MDDrugsRecipes = Recipes
RegisterNetEvent('md-drugs:server:buyWeedItem', function(loc, name, amount)
local src = source
if not checkDistance(src, Locations.Weed.WeedSalesman[loc].loc, 3.5) then
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Checks.notIn'), "error")
return
end
if not Recipes.Weed.weedStore[name] then
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('weed.itemDoesntExist'), "error")
return
end
if Bridge.Framework.RemoveAccountBalance(src, 'cash', Recipes.Weed.weedStore[name] * amount) or Bridge.Framework.RemoveAccountBalance(src, 'bank', Recipes.Weed.weedStore[name] * amount) then
Bridge.Inventory.AddItem(src, name, amount)
else
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Catches.notEnoughMoney'), "error")
end
end)
RegisterServerEvent('md-drugs:server:dryoutweed', function(loc)
local src = source
if timeOut(src, 'md-drugs:server:dryoutweed') then return end
if checkDistance(src, Locations.Weed.WeedDry[loc].loc, 5.0) == false then
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Checks.notIn'), "error")
return
end
if Bridge.Inventory.RemoveItem(src,"wetcannabis", 1) then
Bridge.Inventory.AddItem(src,"drycannabis", 1)
else
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('weed.noDry'), "error")
end
end)
local bluntwrap = {'mdreddextro','mdlean'}
for k, v in pairs (bluntwrap) do
Bridge.Framework.RegisterUsableItem(v, function(source, item) TriggerClientEvent('md-drugs:client:makeBluntWrap', source) end)
end
local bluntwraps = {'leanbluntwrap', 'dextrobluntwrap', 'bluntwrap'}
for k, v in pairs (bluntwraps) do
Bridge.Framework.RegisterUsableItem(v, function(source, item) TriggerClientEvent('md-drugs:client:rollBlunt', source) end)
end
RegisterServerEvent('md-drugs:server:MakeWeedItems', function(tabl, item, loc)
local src = source
if timeOut(src, 'md-drugs:server:MakeWeedItems') then return end
local locs = tabl == 'makeButter' and 'MakeButter' or tabl == 'makeOil' and 'MakeOil' or nil
if not locs then
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('weed.invalidTable'), "error")
return
end
if not checkDistance(src, Locations.Weed[locs][loc].loc, 5.0) then
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Checks.notIn'), "error")
return
end
local recipe = Recipes.Weed[tabl][item]
if not recipe then
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('weed.itemDoesntExist'), "error")
return
end
for k, v in pairs (recipe.recipe) do
if not Bridge.Inventory.HasItem(src, k, v) then
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('weed.missingItem', Bridge.Inventory.GetItemInfo(k).label), "error")
return
end
end
for k, v in pairs (recipe.recipe) do
if not Bridge.Inventory.RemoveItem(src, k, v) then
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('weed.missingItem', Bridge.Inventory.GetItemInfo(k).label), "error")
return
end
end
Bridge.Inventory.AddItem(src, item, recipe.amount)
end)
Bridge.Framework.RegisterUsableItem("dabrig", function(source, item)
local src = source
if Bridge.Inventory.HasItem(src, "butanetorch") then
if Bridge.Inventory.RemoveItem(src, "shatter", 1) then
TriggerClientEvent("md-drugs:client:dodabs", src)
end
else
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('weed.needItem', Bridge.Inventory.GetItemInfo("butanetorch").label), 'error')
end
end)
Bridge.Framework.RegisterUsableItem("weedgrinder", function(source, item)
local src = source
if not Bridge.Inventory.HasItem(src, "drycannabis") then
Bridge.Notify.SendNotify(src, Bridge.Language.Locale('weed.needItem', Bridge.Inventory.GetItemInfo("drycannabis").label), 'error')
return
end
local check = Bridge.Callback.Trigger('md-drugs:client:uncuff', src, 'Grinding Weed')
if not check then return end
if Bridge.Inventory.RemoveItem(src, "drycannabis",1 ) then
Bridge.Inventory.AddItem(src, "grindedweed", 1)
end
end)
Bridge.Framework.RegisterUsableItem("mdwoods", function(source, item)
local src = source
local check = Bridge.Callback.Trigger('md-drugs:client:uncuff', src, Bridge.Language.Locale('weed.crackBlunt'))
if not check then return end
if Bridge.Inventory.RemoveItem(src, "mdwoods",1 ) then
Bridge.Inventory.AddItem(src, "bluntwrap", 5)
Bridge.Inventory.AddItem(src, "tobacco", 5)
end
end)
+30 -33
View File
@@ -1,5 +1,5 @@
local itemCraft = {
Locations, Recipes = Locations or {}, Recipes or {}
Recipes.Whippit = {
cracker = {
{color = 'blue', item = 'blue_uninflated_balloon'},
{color = 'green', item = 'green_uninflated_balloon'},
@@ -8,48 +8,45 @@ local itemCraft = {
{color = 'red', item = 'red_uninflated_balloon'},
{color = 'white', item = 'white_uninflated_balloon'},
{color = 'yellow', item = 'yellow_uninflated_balloon'}
},
shop = {
blue_uninflated_balloon =5,
green_uninflated_balloon =5,
orange_uninflated_balloon =5,
purple_uninflated_balloon =5,
red_uninflated_balloon =5,
white_uninflated_balloon =5,
yellow_uninflated_balloon =5,
cracker =500,
whipped_cream_cannister =10
}
}
local store = {
Locations.Whippit = {
{loc =vector4(1695.47, 4872.98, 42.16, 288.86), ped = 'ig_priest' },
}
ps.registerCallback('md-drugs:server:getWhippitLocations', function(source)
return store
end)
local itemShop = {
blue_uninflated_balloon = 5,
green_uninflated_balloon = 5,
orange_uninflated_balloon = 5,
purple_uninflated_balloon = 5,
red_uninflated_balloon = 5,
white_uninflated_balloon = 5,
yellow_uninflated_balloon = 5,
cracker = 500,
whipped_cream_cannister = 10
}
ps.registerCallback('md-drugs:server:getwhippitShop', function(source)
return itemShop
end)
GlobalState.MDDrugsLocations = Locations
GlobalState.MDDrugsRecipes = Recipes
RegisterServerEvent('md-drugs:server:buyWhippitItem', function(loc, item,amount)
local src = source
if not ps.checkDistance(src, store[loc].loc, 3.0) then return end
if not itemShop[item] then return end
local price = itemShop[item] * amount
if not ps.removeMoney(src, 'cash', price, 'whippit-shop') then
if not ps.checkDistance(src, Locations.Whippit[loc].loc, 3.0) then return end
if not Recipes.Whippit.shop[item] then return end
local price = Recipes.Whippit.shop[item] * amount
if not Bridge.Framework.RemoveAccountBalance(src, 'cash', price, 'whippit-shop') then
return Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Whippit.notEnoughMoney', price), 'error')
end
ps.addItem(src, item, amount)
Bridge.Inventory.AddItem(src, item, amount)
end)
ps.createUseable('cracker', function(source)
Bridge.Framework.RegisterUsableItem('cracker', function(source)
local src = source
if not ps.hasItem(src, 'cracker', 1) then return end
if not ps.hasItem(src, 'whipped_cream_cannister', 1) then return end
if not Bridge.Inventory.HasItem(src, 'cracker', 1) then return end
if not Bridge.Inventory.HasItem(src, 'whipped_cream_cannister', 1) then return end
local balloonItem, balloonColor = nil, nil
for _, balloon in pairs(itemCraft['cracker']) do
if ps.hasItem(src, balloon.item, 1) then
for _, balloon in pairs(Recipes.Whippit.cracker) do
if Bridge.Inventory.HasItem(src, balloon.item, 1) then
balloonItem = balloon.item
balloonColor = 'ate_balloon_' .. balloon.color
break
@@ -59,11 +56,11 @@ ps.createUseable('cracker', function(source)
return Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Whippit.needBalloon'), 'error')
end
if not ps.removeItem(src, 'whipped_cream_cannister', 1) then
if not Bridge.Inventory.RemoveItem(src, 'whipped_cream_cannister', 1) then
return Bridge.Notify.SendNotify(src, Bridge.Language.Locale('Whippit.needCanister'), 'error')
end
if not ps.removeItem(src, balloonItem, 1) then
if not Bridge.Inventory.RemoveItem(src, balloonItem, 1) then
return ps.warn(src, 'Failed to remove balloon', 'error')
end
ps.callback('md-drugs:client:useWhippit', src, balloonColor)
Bridge.Callback.Trigger('md-drugs:client:useWhippit', src, balloonColor)
end)