added troll feature
This commit is contained in:
1 parent
fb500dc502
commit
d46e28e8f2
9 files changed
+833
-802
No files matched your search
+90
-89
@@ -1,89 +1,90 @@
|
||||
--TODO: Make dealers better
|
||||
local isActive = false
|
||||
local dealer = {}
|
||||
local function SpawnDealer()
|
||||
if #dealer >= 1 then
|
||||
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"
|
||||
requestModel(Ped, 30000)
|
||||
local loc = json.decode(v.coords)
|
||||
dealer[k] = CreatePed(0, Ped,loc.x,loc.y, loc.z-1, loc.h, false, false)
|
||||
Freeze(dealer[k], true, loc.h)
|
||||
Bridge.Target.AddLocalEntity(dealer[k], {
|
||||
{
|
||||
icon = 'fas fa-user-secret',
|
||||
label = Bridge.Language.Locale('Deliveries.targetGetDel'),
|
||||
action = function()
|
||||
local data = Bridge.Callback.Trigger('md-drugs:server:GetDeliveryItem', k)
|
||||
if type(data) == 'table' and data.coords then
|
||||
TriggerEvent('md-drugs:client:setLocation', data)
|
||||
end
|
||||
end,
|
||||
},
|
||||
{
|
||||
icon = "fa-solid fa-store",
|
||||
label = Bridge.Language.Locale('Deliveries.targetOpenShop'),
|
||||
action = function()
|
||||
local rep = GetRep()
|
||||
local items = Bridge.Callback.Trigger('md-drugs:server:dealerList', k)
|
||||
local options = {}
|
||||
for m, d in pairs (items) do
|
||||
if rep.dealerrep >= d.minrep then
|
||||
options[#options+1] = {
|
||||
title = Bridge.Inventory.GetItemInfo(d.name).label,
|
||||
description = '$' .. d.price,
|
||||
icon = Bridge.Inventory.GetItemInfo(d.name).image,
|
||||
onSelect = function()
|
||||
TriggerServerEvent('md-drugs:server:buyItemDealer', m, k)
|
||||
end,
|
||||
}
|
||||
end
|
||||
end
|
||||
Bridge.Menu.Open({
|
||||
id = 'DealerMenu',
|
||||
title = Bridge.Language.Locale('Deliveries.shopHeader'),
|
||||
description = Bridge.Language.Locale('Deliveries.shopHeader'),
|
||||
options = options
|
||||
})
|
||||
end,
|
||||
}
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
RegisterNetEvent('md-drugs:client:RefreshDealers', function()
|
||||
SpawnDealer()
|
||||
end)
|
||||
|
||||
SpawnDealer()
|
||||
|
||||
RegisterNetEvent('md-drugs:client:setLocation', function(data)
|
||||
local coord = json.decode(data.coords)
|
||||
SetNewWaypoint(coord.x, coord.y)
|
||||
if isActive then return end
|
||||
isActive = true
|
||||
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)
|
||||
Bridge.Target.AddLocalEntity(Buyer, {
|
||||
{
|
||||
icon = 'fas fa-user-secret',
|
||||
label = Bridge.Language.Locale('Deliveries.targetHandOff'),
|
||||
action = function()
|
||||
if not progressbar(Bridge.Language.Locale('Deliveries.delivering'), 4000, 'uncuff') then return end
|
||||
isActive = false
|
||||
DeletePed(Buyer)
|
||||
TriggerServerEvent('md-drugs:server:giveDeliveryItems', data.item, data.amount)
|
||||
end,
|
||||
canInteract = function()
|
||||
if isActive then
|
||||
return true
|
||||
end
|
||||
end
|
||||
}
|
||||
})
|
||||
end)
|
||||
----TODO: Make dealers better
|
||||
--local isActive = false
|
||||
--local dealer = {}
|
||||
--local function SpawnDealer()
|
||||
-- if #dealer >= 1 then
|
||||
-- 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"
|
||||
-- requestModel(Ped, 30000)
|
||||
-- local loc = json.decode(v.coords)
|
||||
-- dealer[k] = CreatePed(0, Ped,loc.x,loc.y, loc.z-1, loc.h, false, false)
|
||||
-- Freeze(dealer[k], true, loc.h)
|
||||
-- Bridge.Target.AddLocalEntity(dealer[k], {
|
||||
-- {
|
||||
-- icon = 'fas fa-user-secret',
|
||||
-- label = Bridge.Language.Locale('Deliveries.targetGetDel'),
|
||||
-- action = function()
|
||||
-- local data = Bridge.Callback.Trigger('md-drugs:server:GetDeliveryItem', k)
|
||||
-- if type(data) == 'table' and data.coords then
|
||||
-- TriggerEvent('md-drugs:client:setLocation', data)
|
||||
-- end
|
||||
-- end,
|
||||
-- },
|
||||
-- {
|
||||
-- icon = "fa-solid fa-store",
|
||||
-- label = Bridge.Language.Locale('Deliveries.targetOpenShop'),
|
||||
-- action = function()
|
||||
-- local rep = GetRep()
|
||||
-- local items = Bridge.Callback.Trigger('md-drugs:server:dealerList', k)
|
||||
-- local options = {}
|
||||
-- for m, d in pairs (items) do
|
||||
-- if rep.dealerrep >= d.minrep then
|
||||
-- options[#options+1] = {
|
||||
-- title = Bridge.Inventory.GetItemInfo(d.name).label,
|
||||
-- description = '$' .. d.price,
|
||||
-- icon = Bridge.Inventory.GetItemInfo(d.name).image,
|
||||
-- onSelect = function()
|
||||
-- TriggerServerEvent('md-drugs:server:buyItemDealer', m, k)
|
||||
-- end,
|
||||
-- }
|
||||
-- end
|
||||
-- end
|
||||
-- Bridge.Menu.Open({
|
||||
-- id = 'DealerMenu',
|
||||
-- title = Bridge.Language.Locale('Deliveries.shopHeader'),
|
||||
-- description = Bridge.Language.Locale('Deliveries.shopHeader'),
|
||||
-- options = options
|
||||
-- })
|
||||
-- end,
|
||||
-- }
|
||||
-- })
|
||||
-- end
|
||||
--end
|
||||
--
|
||||
--RegisterNetEvent('md-drugs:client:RefreshDealers', function()
|
||||
-- SpawnDealer()
|
||||
--end)
|
||||
--
|
||||
--SpawnDealer()
|
||||
--
|
||||
--RegisterNetEvent('md-drugs:client:setLocation', function(data)
|
||||
-- local coord = json.decode(data.coords)
|
||||
-- SetNewWaypoint(coord.x, coord.y)
|
||||
-- if isActive then return end
|
||||
-- isActive = true
|
||||
-- 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)
|
||||
-- Bridge.Target.AddLocalEntity(Buyer, {
|
||||
-- {
|
||||
-- icon = 'fas fa-user-secret',
|
||||
-- label = Bridge.Language.Locale('Deliveries.targetHandOff'),
|
||||
-- action = function()
|
||||
-- if not progressbar(Bridge.Language.Locale('Deliveries.delivering'), 4000, 'uncuff') then return end
|
||||
-- isActive = false
|
||||
-- DeletePed(Buyer)
|
||||
-- TriggerServerEvent('md-drugs:server:giveDeliveryItems', data.item, data.amount)
|
||||
-- end,
|
||||
-- canInteract = function()
|
||||
-- if isActive then
|
||||
-- return true
|
||||
-- end
|
||||
-- end
|
||||
-- }
|
||||
-- })
|
||||
--end)
|
||||
--
|
||||
+152
-152
@@ -1,152 +1,152 @@
|
||||
local miss = false
|
||||
local settings = ps.callback('md-drugs:server:GetWSsettings')
|
||||
|
||||
function SetUpPeds(drugCount)
|
||||
local attackerCount = settings.WholesaleAmbushBase
|
||||
if settings.WholesaleAmbushScale then
|
||||
if drugCount > settings.WholesaleAmbushTier1 then
|
||||
attackerCount = 3
|
||||
end
|
||||
if drugCount > settings.WholesaleAmbushTier2 then
|
||||
attackerCount = 4
|
||||
end
|
||||
if drugCount > settings.WholesaleAmbushTier3 then
|
||||
attackerCount = 5
|
||||
end
|
||||
end
|
||||
local weaponTier = settings.WholesaleWeaponsTier1
|
||||
if settings.WholesaleWeaponTiers then
|
||||
if drugCount > settings.WholesaleAmbushTier3 then
|
||||
weaponTier = settings.WholesaleWeaponsTier4
|
||||
elseif drugCount > settings.WholesaleAmbushTier2 then
|
||||
weaponTier = settings.WholesaleWeaponsTier3
|
||||
elseif drugCount > settings.WholesaleAmbushTier1 then
|
||||
weaponTier = settings.WholesaleWeaponsTier2
|
||||
end
|
||||
end
|
||||
local playerPed = PlayerPedId()
|
||||
local playerCoords = GetEntityCoords(playerPed, false)
|
||||
local models = {"g_m_y_ballasout_01", "g_m_y_famdnf_01", "g_m_y_famca_01", "g_m_y_mexgoon_01", "g_m_y_salvagoon_01"}
|
||||
for i = 1, attackerCount do
|
||||
local angle = (360 / attackerCount) * i
|
||||
local x = playerCoords.x + math.cos(math.rad(angle)) * 15
|
||||
local y = playerCoords.y + math.sin(math.rad(angle)) * 15
|
||||
local z = playerCoords.z
|
||||
local modelHash = GetHashKey(models[math.random(1, #models)])
|
||||
requestModel(modelHash)
|
||||
local ped = CreatePed(4, modelHash, x, y, z, 0.0, true, false)
|
||||
local weapon = weaponTier[math.random(1, #weaponTier)]
|
||||
SetPedRelationshipGroupHash(ped, GetHashKey("HATES_PLAYER"))
|
||||
SetPedCombatAttributes(ped, 46, true)
|
||||
SetPedCombatAttributes(ped, 0, true)
|
||||
SetPedCombatAttributes(ped, 5, true)
|
||||
SetPedCombatAttributes(ped, 2, true)
|
||||
local healthMultiplier = 1.0
|
||||
if drugCount > settings.WholesaleAmbushTier3 then
|
||||
healthMultiplier = 1.5
|
||||
elseif drugCount > settings.WholesaleAmbushTier2 then
|
||||
healthMultiplier = 1.3
|
||||
elseif drugCount > settings.WholesaleAmbushTier1 then
|
||||
healthMultiplier = 1.2
|
||||
end
|
||||
local baseHealth = GetEntityHealth(ped)
|
||||
SetEntityHealth(ped, math.floor(baseHealth * healthMultiplier))
|
||||
GiveWeaponToPed(ped, GetHashKey(weapon), 500, false, true)
|
||||
TaskCombatPed(ped, playerPed, 0, 16)
|
||||
local blip = AddBlipForEntity(ped)
|
||||
SetBlipAsShortRange(blip, true)
|
||||
SetBlipColour(blip, 1)
|
||||
SetBlipScale(blip, 0.7)
|
||||
SetEntityAsNoLongerNeeded(ped)
|
||||
end
|
||||
local tierName = "Basic"
|
||||
if drugCount > settings.WholesaleAmbushTier3 then
|
||||
tierName = "Elite"
|
||||
elseif drugCount > settings.WholesaleAmbushTier2 then
|
||||
tierName = "Advanced"
|
||||
elseif drugCount > settings.WholesaleAmbushTier1 then
|
||||
tierName = "Medium"
|
||||
end
|
||||
Bridge.Notify.SendNotify(string.format(Bridge.Language.Locale('wholesale.ambush'), attackerCount, tierName), 'error')
|
||||
end
|
||||
|
||||
RegisterNetEvent("md-drugs:client:GetLocation", function(drug)
|
||||
if miss then
|
||||
SetNewWaypoint(drug.location.x, drug.location.y)
|
||||
else
|
||||
local loc = drug.location
|
||||
local timer = 0
|
||||
miss = true
|
||||
SetNewWaypoint(loc.x, loc.y)
|
||||
if settings.WholesaleShowEstimates and drug.count > 0 then
|
||||
local bonusTiers = math.floor(drug.count / 10)
|
||||
local potentialBonus = math.min(bonusTiers * settings.WholesaleQuantityBonus, settings.WholesaleMaxBonus)
|
||||
local bonusPercent = math.floor(potentialBonus * 100)
|
||||
local minPayout = math.floor(drug.price.min * (1 + potentialBonus))
|
||||
local maxPayout = math.floor(drug.price.max * (1 + potentialBonus))
|
||||
local totalMinPayout = drug.count * minPayout
|
||||
local totalMaxPayout = drug.count * maxPayout
|
||||
Bridge.Notify.SendNotify(string.format(Bridge.Language.Locale('wholesale.count'), drug.count), 'info')
|
||||
if bonusPercent > 0 then
|
||||
Bridge.Notify.SendNotify(string.format(Bridge.Language.Locale('wholesale.bonus'), bonusPercent), 'info')
|
||||
end
|
||||
Bridge.Notify.SendNotify(string.format(Bridge.Language.Locale('wholesale.estimate'), totalMinPayout, totalMaxPayout), 'info')
|
||||
elseif drug.count <= 0 then
|
||||
Bridge.Notify.SendNotify(Bridge.Language.Locale('wholesale.no_drugs'), 'error')
|
||||
end
|
||||
requestModel("g_m_y_famdnf_01", settings.RequestModelTime)
|
||||
local current = "g_m_y_famdnf_01"
|
||||
local drugdealer = CreatePed(0, current,loc.x,loc.y,loc.z-1, 90.0, false, false)
|
||||
FreezeEntityPosition(drugdealer, true)
|
||||
SetEntityInvincible(drugdealer, true)
|
||||
Bridge.Target.AddLocalEntity(drugdealer, {{
|
||||
label = Bridge.Language.Locale('wholesale.targetBuyer'),
|
||||
icon = "fas fa-eye",
|
||||
action = function()
|
||||
local luck = math.random(1,100)
|
||||
if luck <= settings.SuccessfulChance then
|
||||
if not ps.progressbar(Bridge.Language.Locale('wholesale.wholesaling'), 4000, 'uncuff') then return end
|
||||
TriggerServerEvent("md-drugs:server:SuccessSale", drug)
|
||||
else
|
||||
ps.progressbar("Deal Going Bad", 4000, 'uncuff')
|
||||
if settings.WholesaleAmbushEnabled then
|
||||
SetUpPeds(drug.count)
|
||||
end
|
||||
if settings.WholesaleFailPoliceAlert > 0 then
|
||||
local alertChance = math.random(1, 100)
|
||||
if alertChance <= settings.WholesaleFailPoliceAlert then
|
||||
PoliceCall(100)
|
||||
end
|
||||
end
|
||||
TriggerServerEvent('md-drugs:server:CleanupWholesale')
|
||||
end
|
||||
Wait(3000)
|
||||
DeleteEntity(drugdealer)
|
||||
miss = false
|
||||
end
|
||||
}},drugdealer )
|
||||
repeat
|
||||
Wait(1000)
|
||||
timer = timer + 1
|
||||
until #(GetEntityCoords(PlayerPedId()) - vector3(loc.x, loc.y, loc.z) ) < 4.0 or timer == settings.WholesaleTimeout + 1
|
||||
PoliceCall(settings.AlertPoliceWholesale)
|
||||
if timer <= settings.WholesaleTimeout or #(GetEntityCoords(PlayerPedId()) - vector3(loc.x, loc.y, loc.z) ) < 4.0 then
|
||||
timer = 0
|
||||
else
|
||||
Bridge.Notify.SendNotify(Bridge.Language.Locale('wholesale.tooLong'), 'error')
|
||||
DeleteEntity(drugdealer)
|
||||
TriggerServerEvent('md-drugs:server:CleanupWholesale')
|
||||
if settings.WholesaleResetOnTimeout then
|
||||
miss = false
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent('md-drugs:client:WholesaleComplete', function(data)
|
||||
local bonusText = ""
|
||||
if data.bonus > 0 then
|
||||
bonusText = " (+" .. data.bonus .. "% quantity bonus)"
|
||||
end
|
||||
Bridge.Notify.SendNotify(string.format(Bridge.Language.Locale('wholesale.complete'), data.quantity, data.payout, bonusText), 'success')
|
||||
end)
|
||||
--local miss = false
|
||||
--local settings = ps.callback('md-drugs:server:GetWSsettings')
|
||||
--
|
||||
--function SetUpPeds(drugCount)
|
||||
-- local attackerCount = settings.WholesaleAmbushBase
|
||||
-- if settings.WholesaleAmbushScale then
|
||||
-- if drugCount > settings.WholesaleAmbushTier1 then
|
||||
-- attackerCount = 3
|
||||
-- end
|
||||
-- if drugCount > settings.WholesaleAmbushTier2 then
|
||||
-- attackerCount = 4
|
||||
-- end
|
||||
-- if drugCount > settings.WholesaleAmbushTier3 then
|
||||
-- attackerCount = 5
|
||||
-- end
|
||||
-- end
|
||||
-- local weaponTier = settings.WholesaleWeaponsTier1
|
||||
-- if settings.WholesaleWeaponTiers then
|
||||
-- if drugCount > settings.WholesaleAmbushTier3 then
|
||||
-- weaponTier = settings.WholesaleWeaponsTier4
|
||||
-- elseif drugCount > settings.WholesaleAmbushTier2 then
|
||||
-- weaponTier = settings.WholesaleWeaponsTier3
|
||||
-- elseif drugCount > settings.WholesaleAmbushTier1 then
|
||||
-- weaponTier = settings.WholesaleWeaponsTier2
|
||||
-- end
|
||||
-- end
|
||||
-- local playerPed = PlayerPedId()
|
||||
-- local playerCoords = GetEntityCoords(playerPed, false)
|
||||
-- local models = {"g_m_y_ballasout_01", "g_m_y_famdnf_01", "g_m_y_famca_01", "g_m_y_mexgoon_01", "g_m_y_salvagoon_01"}
|
||||
-- for i = 1, attackerCount do
|
||||
-- local angle = (360 / attackerCount) * i
|
||||
-- local x = playerCoords.x + math.cos(math.rad(angle)) * 15
|
||||
-- local y = playerCoords.y + math.sin(math.rad(angle)) * 15
|
||||
-- local z = playerCoords.z
|
||||
-- local modelHash = GetHashKey(models[math.random(1, #models)])
|
||||
-- requestModel(modelHash)
|
||||
-- local ped = CreatePed(4, modelHash, x, y, z, 0.0, true, false)
|
||||
-- local weapon = weaponTier[math.random(1, #weaponTier)]
|
||||
-- SetPedRelationshipGroupHash(ped, GetHashKey("HATES_PLAYER"))
|
||||
-- SetPedCombatAttributes(ped, 46, true)
|
||||
-- SetPedCombatAttributes(ped, 0, true)
|
||||
-- SetPedCombatAttributes(ped, 5, true)
|
||||
-- SetPedCombatAttributes(ped, 2, true)
|
||||
-- local healthMultiplier = 1.0
|
||||
-- if drugCount > settings.WholesaleAmbushTier3 then
|
||||
-- healthMultiplier = 1.5
|
||||
-- elseif drugCount > settings.WholesaleAmbushTier2 then
|
||||
-- healthMultiplier = 1.3
|
||||
-- elseif drugCount > settings.WholesaleAmbushTier1 then
|
||||
-- healthMultiplier = 1.2
|
||||
-- end
|
||||
-- local baseHealth = GetEntityHealth(ped)
|
||||
-- SetEntityHealth(ped, math.floor(baseHealth * healthMultiplier))
|
||||
-- GiveWeaponToPed(ped, GetHashKey(weapon), 500, false, true)
|
||||
-- TaskCombatPed(ped, playerPed, 0, 16)
|
||||
-- local blip = AddBlipForEntity(ped)
|
||||
-- SetBlipAsShortRange(blip, true)
|
||||
-- SetBlipColour(blip, 1)
|
||||
-- SetBlipScale(blip, 0.7)
|
||||
-- SetEntityAsNoLongerNeeded(ped)
|
||||
-- end
|
||||
-- local tierName = "Basic"
|
||||
-- if drugCount > settings.WholesaleAmbushTier3 then
|
||||
-- tierName = "Elite"
|
||||
-- elseif drugCount > settings.WholesaleAmbushTier2 then
|
||||
-- tierName = "Advanced"
|
||||
-- elseif drugCount > settings.WholesaleAmbushTier1 then
|
||||
-- tierName = "Medium"
|
||||
-- end
|
||||
-- Bridge.Notify.SendNotify(string.format(Bridge.Language.Locale('wholesale.ambush'), attackerCount, tierName), 'error')
|
||||
--end
|
||||
--
|
||||
--RegisterNetEvent("md-drugs:client:GetLocation", function(drug)
|
||||
-- if miss then
|
||||
-- SetNewWaypoint(drug.location.x, drug.location.y)
|
||||
-- else
|
||||
-- local loc = drug.location
|
||||
-- local timer = 0
|
||||
-- miss = true
|
||||
-- SetNewWaypoint(loc.x, loc.y)
|
||||
-- if settings.WholesaleShowEstimates and drug.count > 0 then
|
||||
-- local bonusTiers = math.floor(drug.count / 10)
|
||||
-- local potentialBonus = math.min(bonusTiers * settings.WholesaleQuantityBonus, settings.WholesaleMaxBonus)
|
||||
-- local bonusPercent = math.floor(potentialBonus * 100)
|
||||
-- local minPayout = math.floor(drug.price.min * (1 + potentialBonus))
|
||||
-- local maxPayout = math.floor(drug.price.max * (1 + potentialBonus))
|
||||
-- local totalMinPayout = drug.count * minPayout
|
||||
-- local totalMaxPayout = drug.count * maxPayout
|
||||
-- Bridge.Notify.SendNotify(string.format(Bridge.Language.Locale('wholesale.count'), drug.count), 'info')
|
||||
-- if bonusPercent > 0 then
|
||||
-- Bridge.Notify.SendNotify(string.format(Bridge.Language.Locale('wholesale.bonus'), bonusPercent), 'info')
|
||||
-- end
|
||||
-- Bridge.Notify.SendNotify(string.format(Bridge.Language.Locale('wholesale.estimate'), totalMinPayout, totalMaxPayout), 'info')
|
||||
-- elseif drug.count <= 0 then
|
||||
-- Bridge.Notify.SendNotify(Bridge.Language.Locale('wholesale.no_drugs'), 'error')
|
||||
-- end
|
||||
-- requestModel("g_m_y_famdnf_01", settings.RequestModelTime)
|
||||
-- local current = "g_m_y_famdnf_01"
|
||||
-- local drugdealer = CreatePed(0, current,loc.x,loc.y,loc.z-1, 90.0, false, false)
|
||||
-- FreezeEntityPosition(drugdealer, true)
|
||||
-- SetEntityInvincible(drugdealer, true)
|
||||
-- Bridge.Target.AddLocalEntity(drugdealer, {{
|
||||
-- label = Bridge.Language.Locale('wholesale.targetBuyer'),
|
||||
-- icon = "fas fa-eye",
|
||||
-- action = function()
|
||||
-- local luck = math.random(1,100)
|
||||
-- if luck <= settings.SuccessfulChance then
|
||||
-- if not ps.progressbar(Bridge.Language.Locale('wholesale.wholesaling'), 4000, 'uncuff') then return end
|
||||
-- TriggerServerEvent("md-drugs:server:SuccessSale", drug)
|
||||
-- else
|
||||
-- ps.progressbar("Deal Going Bad", 4000, 'uncuff')
|
||||
-- if settings.WholesaleAmbushEnabled then
|
||||
-- SetUpPeds(drug.count)
|
||||
-- end
|
||||
-- if settings.WholesaleFailPoliceAlert > 0 then
|
||||
-- local alertChance = math.random(1, 100)
|
||||
-- if alertChance <= settings.WholesaleFailPoliceAlert then
|
||||
-- PoliceCall(100)
|
||||
-- end
|
||||
-- end
|
||||
-- TriggerServerEvent('md-drugs:server:CleanupWholesale')
|
||||
-- end
|
||||
-- Wait(3000)
|
||||
-- DeleteEntity(drugdealer)
|
||||
-- miss = false
|
||||
-- end
|
||||
-- }},drugdealer )
|
||||
-- repeat
|
||||
-- Wait(1000)
|
||||
-- timer = timer + 1
|
||||
-- until #(GetEntityCoords(PlayerPedId()) - vector3(loc.x, loc.y, loc.z) ) < 4.0 or timer == settings.WholesaleTimeout + 1
|
||||
-- PoliceCall(settings.AlertPoliceWholesale)
|
||||
-- if timer <= settings.WholesaleTimeout or #(GetEntityCoords(PlayerPedId()) - vector3(loc.x, loc.y, loc.z) ) < 4.0 then
|
||||
-- timer = 0
|
||||
-- else
|
||||
-- Bridge.Notify.SendNotify(Bridge.Language.Locale('wholesale.tooLong'), 'error')
|
||||
-- DeleteEntity(drugdealer)
|
||||
-- TriggerServerEvent('md-drugs:server:CleanupWholesale')
|
||||
-- if settings.WholesaleResetOnTimeout then
|
||||
-- miss = false
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
--end)
|
||||
--
|
||||
--RegisterNetEvent('md-drugs:client:WholesaleComplete', function(data)
|
||||
-- local bonusText = ""
|
||||
-- if data.bonus > 0 then
|
||||
-- bonusText = " (+" .. data.bonus .. "% quantity bonus)"
|
||||
-- end
|
||||
-- Bridge.Notify.SendNotify(string.format(Bridge.Language.Locale('wholesale.complete'), data.quantity, data.payout, bonusText), 'success')
|
||||
--end)
|
||||
+61
-40
@@ -1,20 +1,26 @@
|
||||
local xtcpress = false
|
||||
local locations = ps.callback('md-drugs:server:GetXtcLocs')
|
||||
local locations = GlobalState.MDDrugsLocations.XTC
|
||||
|
||||
local function getRecipeList(tbl)
|
||||
local rec = {}
|
||||
for m, d in pairs(tbl) do table.insert(rec, ps.getLabel(m) .. ' X ' .. d) end
|
||||
return table.concat(rec, ', ')
|
||||
local function getRecipeList(tbl, type)
|
||||
local rec
|
||||
if type == 'presses' then
|
||||
rec = {'XTC FROM THE PREVIOUS TIER REQUIRED TO UPGRADE \n '}
|
||||
else
|
||||
rec = {'REQUIRED INGREDIENTS: \n '}
|
||||
end
|
||||
|
||||
for m, d in pairs(tbl) do table.insert(rec, Bridge.Inventory.GetItemInfo(m).label .. ' X ' .. d .. ' \n ') end
|
||||
return table.concat(rec, ' ')
|
||||
end
|
||||
|
||||
ps.registerCallback('md-drugs:client:setpress', function(xtcData)
|
||||
Bridge.Callback.Register('md-drugs:client:setpress', function(xtcData)
|
||||
if xtcpress then
|
||||
Bridge.Notify.SendNotify(Bridge.Language.Locale('xtc.alreadyOut'), 'error')
|
||||
return
|
||||
end
|
||||
local coords, head = StartRay2()
|
||||
xtcpress = true
|
||||
if not ps.progressbar(Bridge.Language.Locale('xtc.settingDown'), 4000, 'uncuff') then return end
|
||||
if not 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)
|
||||
PlaceObjectOnGroundProperly(press)
|
||||
Freeze(press, true, head)
|
||||
@@ -27,19 +33,24 @@ ps.registerCallback('md-drugs:client:setpress', function(xtcData)
|
||||
local options = {}
|
||||
for k, v in pairs(xtcData.recipes) do
|
||||
local descript = getRecipeList(v.take)
|
||||
local itemInfo = Bridge.Inventory.GetItemInfo(k)
|
||||
options[#options + 1] = {
|
||||
icon = ps.getImage(k),
|
||||
title = ps.getLabel(k),
|
||||
icon = itemInfo.image,
|
||||
title = Bridge.Language.Locale(k),
|
||||
description = descript,
|
||||
action = function()
|
||||
onSelect = function()
|
||||
if not minigame() then Bridge.Notify.SendNotify(Bridge.Language.Locale('xtc.fail'), "error") return end
|
||||
if not ps.progressbar(Bridge.Language.Locale('xtc.making', ps.getLabel(k)), 4000, 'uncuff') then return end
|
||||
if not progressbar(Bridge.Language.Locale('xtc.making', Bridge.Language.Locale(k)), 4000, 'uncuff') then return end
|
||||
TriggerServerEvent("md-drugs:server:makextc", k)
|
||||
end,
|
||||
distance = 2.0
|
||||
}
|
||||
end
|
||||
ps.menu('XTC Recipes', 'XTC Recipes', options)
|
||||
Bridge.Menu.Open({
|
||||
id = 'XTC Recipes',
|
||||
title = 'XTC Recipes',
|
||||
options = options
|
||||
})
|
||||
end,
|
||||
canInteract = function()
|
||||
if xtcpress then return true end
|
||||
@@ -49,7 +60,7 @@ ps.registerCallback('md-drugs:client:setpress', function(xtcData)
|
||||
icon = "fas fa-eye",
|
||||
label = Bridge.Language.Locale('xtc.targetPickup'),
|
||||
action = function()
|
||||
if not ps.progressbar(Bridge.Language.Locale('xtc.picking'), 5000, 'uncuff') then return end
|
||||
if not progressbar(Bridge.Language.Locale('xtc.picking'), 5000, 'uncuff') then return end
|
||||
DeleteObject(press)
|
||||
xtcpress = false
|
||||
TriggerServerEvent("md-drugs:server:getpressback")
|
||||
@@ -64,13 +75,13 @@ ps.registerCallback('md-drugs:client:setpress', function(xtcData)
|
||||
end)
|
||||
|
||||
for k, v in pairs(locations.mdp2p) do
|
||||
ps.boxTarget('mdp2p'..k, v.loc, {length = v.l, width = v.w, heading = v.rot}, {
|
||||
Bridge.Target.AddBoxZone('mdp2p'..k, v.loc, vector3(v.l, v.w, 2.0), v.rot or 180.0, {
|
||||
{
|
||||
icon = 'fa-solid fa-flask',
|
||||
label = Bridge.Language.Locale('xtc.targetStealMDP2P'),
|
||||
action = function()
|
||||
if not minigame() then Bridge.Notify.SendNotify(Bridge.Language.Locale('xtc.fail'), "error") return end
|
||||
if not ps.progressbar(Bridge.Language.Locale('xtc.stealingMDP2P'), 4000, 'uncuff') then return end
|
||||
if not progressbar(Bridge.Language.Locale('xtc.stealingMDP2P'), 4000, 'uncuff') then return end
|
||||
TriggerServerEvent("md-drugs:server:stealmdp2p", k)
|
||||
end,
|
||||
canInteract = function()
|
||||
@@ -80,13 +91,13 @@ for k, v in pairs(locations.mdp2p) do
|
||||
})
|
||||
end
|
||||
for k, v in pairs(locations.isosafrole) do
|
||||
ps.boxTarget('isosafrole'..k, v.loc, {length = v.l, width = v.w, heading = v.rot}, {
|
||||
Bridge.Target.AddBoxZone('isosafrole'..k, v.loc, vector3(v.l, v.w, 2.0), v.rot or 180.0, {
|
||||
{
|
||||
icon = 'fa-solid fa-flask',
|
||||
label = Bridge.Language.Locale('xtc.targetStealIsosafrole'),
|
||||
action = function()
|
||||
if not minigame() then Bridge.Notify.SendNotify(Bridge.Language.Locale('xtc.fail'), "error") return end
|
||||
if not ps.progressbar(Bridge.Language.Locale('xtc.stealingIsosafrole'), 4000, 'uncuff') then return end
|
||||
if not progressbar(Bridge.Language.Locale('xtc.stealingIsosafrole'), 4000, 'uncuff') then return end
|
||||
TriggerServerEvent("md-drugs:server:stealisosafrole", k)
|
||||
end,
|
||||
canInteract = function()
|
||||
@@ -97,13 +108,13 @@ for k, v in pairs(locations.isosafrole) do
|
||||
end
|
||||
|
||||
for k, v in pairs(locations.rawxtcloc) do
|
||||
ps.boxTarget('xtcraw'..k, v.loc, {length = v.l, width = v.w, heading = v.rot}, {
|
||||
Bridge.Target.AddBoxZone('xtcraw'..k, v.loc, vector3(v.l, v.w, 2.0), v.rot or 180.0, {
|
||||
{
|
||||
icon = 'fa-solid fa-flask',
|
||||
label = Bridge.Language.Locale('xtc.targetRaw'),
|
||||
action = function()
|
||||
if not minigame() then Bridge.Notify.SendNotify(Bridge.Language.Locale('xtc.fail'), "error") return end
|
||||
if not ps.progressbar(Bridge.Language.Locale('xtc.makingRaw'), 4000, 'uncuff') then return end
|
||||
if not progressbar(Bridge.Language.Locale('xtc.makingRaw'), 4000, 'uncuff') then return end
|
||||
TriggerServerEvent("md-drugs:server:makingrawxtc", k)
|
||||
end,
|
||||
canInteract = function()
|
||||
@@ -121,30 +132,32 @@ for k, v in pairs(locations.xtcpress) do
|
||||
{
|
||||
icon = 'fa-solid fa-flask',
|
||||
label = Bridge.Language.Locale('xtc.getPress'),
|
||||
action = function()
|
||||
onSelect = function()
|
||||
local options = {}
|
||||
local recipeList = ps.callback('md-drugs:server:getpressrecipes')
|
||||
local recipeList = GlobalState.MDDrugsRecipes.XTC.presses
|
||||
for m, d in pairs(recipeList) do
|
||||
if m == 'singlepress' then
|
||||
local itemInfo = Bridge.Inventory.GetItemInfo(m)
|
||||
options[#options + 1] = {
|
||||
icon = ps.getImage(m),
|
||||
title = ps.getLabel(m),
|
||||
icon = itemInfo.image,
|
||||
title = itemInfo.label,
|
||||
description = Bridge.Language.Locale('xtc.buySingle', d.cash),
|
||||
type = d.type,
|
||||
action = function()
|
||||
if not ps.progressbar(Bridge.Language.Locale('xtc.buyp'), 4000, 'uncuff') then return end
|
||||
onSelect = function()
|
||||
if not progressbar(Bridge.Language.Locale('xtc.buyp'), 4000, 'uncuff') then return end
|
||||
TriggerServerEvent('md-drugs:server:buypress',k, m)
|
||||
end,
|
||||
}
|
||||
else
|
||||
local descript = getRecipeList(d.take)
|
||||
local itemInfo = Bridge.Inventory.GetItemInfo(m)
|
||||
local descript = getRecipeList(d.take, 'presses')
|
||||
options[#options + 1] = {
|
||||
icon = ps.getImage(m),
|
||||
title = ps.getLabel(m),
|
||||
icon = itemInfo.image,
|
||||
title = itemInfo.label,
|
||||
description = descript,
|
||||
type = d.type,
|
||||
action = function()
|
||||
if not ps.progressbar(Bridge.Language.Locale('xtc.buyp'), 4000, 'uncuff') then return end
|
||||
onSelect = function()
|
||||
if not progressbar(Bridge.Language.Locale('xtc.buyp'), 4000, 'uncuff') then return end
|
||||
TriggerServerEvent("md-drugs:server:upgradepress", k, m)
|
||||
end,
|
||||
distance = 2.0
|
||||
@@ -152,7 +165,11 @@ for k, v in pairs(locations.xtcpress) do
|
||||
end
|
||||
end
|
||||
table.sort(options, function(a, b) return a.type < b.type end)
|
||||
ps.menu('XTC Presses', 'XTC Presses', options)
|
||||
Bridge.Menu.Open({
|
||||
id = 'XTC Presses',
|
||||
title = 'XTC Presses',
|
||||
options = options
|
||||
})
|
||||
end,
|
||||
canInteract = function() return handleGang(v.gang) end
|
||||
}
|
||||
@@ -160,32 +177,36 @@ for k, v in pairs(locations.xtcpress) do
|
||||
end
|
||||
|
||||
for k, v in pairs (locations.stamp) do
|
||||
ps.boxTarget('xtcstamp'..k, v.loc, {length = v.l, width = v.w, heading = v.rot}, {
|
||||
Bridge.Target.AddBoxZone('xtcstamp'..k, v.loc, vector3(v.l, v.w, 2.0), v.rot or 180.0, {
|
||||
{
|
||||
icon = 'fa-solid fa-flask',
|
||||
label = Bridge.Language.Locale('xtc.targetStamp'),
|
||||
action = function()
|
||||
onSelect = function()
|
||||
local item = {
|
||||
{item = 'white_xtc', label = ps.getLabel('white_xtc'), color = 'white'},
|
||||
{item = 'red_xtc', label = ps.getLabel('red_xtc'), color = 'red'},
|
||||
{item = 'orange_xtc', label = ps.getLabel('orange_xtc'), color = 'orange'},
|
||||
{item = 'blue_xtc', label = ps.getLabel('blue_xtc'), color = 'blue'},
|
||||
{item = 'white_xtc', label = Bridge.Inventory.GetItemInfo('white_xtc').label, color = 'white'},
|
||||
{item = 'red_xtc', label = Bridge.Inventory.GetItemInfo('red_xtc').label, color = 'red'},
|
||||
{item = 'orange_xtc', label = Bridge.Inventory.GetItemInfo('orange_xtc').label, color = 'orange'},
|
||||
{item = 'blue_xtc', label = Bridge.Inventory.GetItemInfo('blue_xtc').label, color = 'blue'},
|
||||
}
|
||||
local options = {}
|
||||
for m, d in pairs (item) do
|
||||
options[#options + 1] = {
|
||||
icon = ps.getImage(d.item),
|
||||
icon = Bridge.Inventory.GetItemInfo(d.item).image,
|
||||
title = d.label,
|
||||
description = Bridge.Language.Locale('xtc.stamp_desc', d.color),
|
||||
action = function()
|
||||
if not minigame() then Bridge.Notify.SendNotify(Bridge.Language.Locale('xtc.fail'), "error") return end
|
||||
if not ps.progressbar(Bridge.Language.Locale('xtc.stamping', d.label), 4000, 'uncuff') then return end
|
||||
if not progressbar(Bridge.Language.Locale('xtc.stamping', d.label), 4000, 'uncuff') then return end
|
||||
TriggerServerEvent("md-drugs:server:stamp", k, d.color)
|
||||
end,
|
||||
distance = 2.0
|
||||
}
|
||||
end
|
||||
ps.menu('Stamp Pills', 'Stamp Pills', options)
|
||||
Bridge.Menu.Open({
|
||||
id = 'XTC Stamp',
|
||||
title = 'XTC Stamp',
|
||||
options = options
|
||||
})
|
||||
end,
|
||||
canInteract = function() return handleGang(v.gang) end
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user