2024-05-02 18:34:14 -07:00
|
|
|
local QBCore = exports['qb-core']:GetCoreObject()
|
|
|
|
|
|
|
|
|
|
local progressbartype = Config.progressbartype
|
|
|
|
|
local minigametype = Config.minigametype
|
|
|
|
|
local notifytype = Config.Notify
|
|
|
|
|
local dispatch = Config.Dispatch
|
|
|
|
|
|
2024-06-29 18:59:36 -07:00
|
|
|
function progressbar(text, time, anim)
|
2024-05-02 18:34:14 -07:00
|
|
|
TriggerEvent('animations:client:EmoteCommandStart', {anim})
|
|
|
|
|
if progressbartype == 'oxbar' then
|
|
|
|
|
if lib.progressBar({ duration = time, label = text, useWhileDead = false, canCancel = true, disable = { car = true, move = true},}) then
|
2024-06-29 13:18:27 -07:00
|
|
|
if GetResourceState('scully_emotemenu') == 'started' then
|
2024-06-29 18:59:36 -07:00
|
|
|
exports.scully_emotemenu:cancelEmote()
|
2024-07-06 15:19:20 -07:00
|
|
|
else
|
|
|
|
|
TriggerEvent('animations:client:EmoteCommandStart', {"c"})
|
2024-06-29 13:18:27 -07:00
|
|
|
end
|
2024-05-02 18:34:14 -07:00
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
elseif progressbartype == 'oxcir' then
|
|
|
|
|
if lib.progressCircle({ duration = time, label = text, useWhileDead = false, canCancel = true, position = 'bottom', disable = { car = true,move = true},}) then
|
2024-06-29 13:18:27 -07:00
|
|
|
if GetResourceState('scully_emotemenu') == 'started' then
|
2024-06-29 18:59:36 -07:00
|
|
|
exports.scully_emotemenu:cancelEmote()
|
2024-07-06 15:19:20 -07:00
|
|
|
else
|
|
|
|
|
TriggerEvent('animations:client:EmoteCommandStart', {"c"})
|
|
|
|
|
end
|
2024-05-02 18:34:14 -07:00
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
elseif progressbartype == 'qb' then
|
2024-06-03 19:51:30 -07:00
|
|
|
local test = false
|
|
|
|
|
local cancelled = false
|
2024-05-02 18:34:14 -07:00
|
|
|
QBCore.Functions.Progressbar("drink_something", text, time, false, true, { disableMovement = true, disableCarMovement = true, disableMouse = false, disableCombat = true, disableInventory = true,
|
|
|
|
|
}, {}, {}, {}, function()-- Done
|
|
|
|
|
test = true
|
2024-06-29 13:18:27 -07:00
|
|
|
if GetResourceState('scully_emotemenu') == 'started' then
|
2024-06-29 18:59:36 -07:00
|
|
|
exports.scully_emotemenu:cancelEmote()
|
2024-07-06 15:19:20 -07:00
|
|
|
else
|
|
|
|
|
TriggerEvent('animations:client:EmoteCommandStart', {"c"})
|
2024-06-29 13:18:27 -07:00
|
|
|
end
|
2024-06-03 19:51:30 -07:00
|
|
|
end, function()
|
|
|
|
|
cancelled = true
|
2024-06-29 13:18:27 -07:00
|
|
|
if GetResourceState('scully_emotemenu') == 'started' then
|
2024-06-29 18:59:36 -07:00
|
|
|
exports.scully_emotemenu:cancelEmote()
|
2024-07-06 15:19:20 -07:00
|
|
|
else
|
|
|
|
|
TriggerEvent('animations:client:EmoteCommandStart', {"c"})
|
2024-06-29 13:18:27 -07:00
|
|
|
end
|
2024-06-03 19:51:30 -07:00
|
|
|
end)
|
|
|
|
|
repeat
|
|
|
|
|
Wait(100)
|
|
|
|
|
until cancelled or test
|
|
|
|
|
if test then return true end
|
2024-05-02 18:34:14 -07:00
|
|
|
else
|
2024-09-24 15:07:41 -07:00
|
|
|
print"^1 SCRIPT ERROR: Md-DRUGS set your progressbar with one of the options!"
|
2024-05-02 18:34:14 -07:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2024-10-23 17:44:46 -07:00
|
|
|
function loadParticle(dict)
|
|
|
|
|
if not HasNamedPtfxAssetLoaded(dict) then
|
|
|
|
|
RequestNamedPtfxAsset(dict)
|
|
|
|
|
end
|
|
|
|
|
while not HasNamedPtfxAssetLoaded(dict) do
|
|
|
|
|
Wait(0)
|
|
|
|
|
end
|
|
|
|
|
SetPtfxAssetNextCall(dict)
|
|
|
|
|
end
|
|
|
|
|
|
2024-10-25 11:41:59 -07:00
|
|
|
function LoadModel(hash)
|
2024-10-28 14:11:49 -07:00
|
|
|
RequestModel(hash)
|
|
|
|
|
while not HasModelLoaded(hash) do
|
|
|
|
|
Wait(0)
|
|
|
|
|
end
|
2024-10-25 11:41:59 -07:00
|
|
|
end
|
|
|
|
|
|
2024-10-23 17:44:46 -07:00
|
|
|
function minigame()
|
2024-10-02 01:00:46 -07:00
|
|
|
local time = 0
|
|
|
|
|
local game = Config.Minigames
|
|
|
|
|
if minigametype == 'ps_circle' then
|
2024-09-24 15:07:41 -07:00
|
|
|
local check
|
2024-10-02 01:00:46 -07:00
|
|
|
exports['ps-ui']:Circle(function(success)
|
|
|
|
|
check = success
|
|
|
|
|
end, game['ps_circle'].amount, game['ps_circle'].speed)
|
|
|
|
|
return check
|
|
|
|
|
elseif minigametype == 'ps_maze' then
|
|
|
|
|
local check
|
|
|
|
|
exports['ps-ui']:Maze(function(success)
|
|
|
|
|
check = success
|
|
|
|
|
end, game['ps_maze'].timelimit)
|
|
|
|
|
return check
|
|
|
|
|
elseif minigametype == 'ps_scrambler' then
|
|
|
|
|
local check
|
|
|
|
|
exports['ps-ui']:Scrambler(function(success)
|
|
|
|
|
check = success
|
|
|
|
|
end, game['ps_scrambler'].type, game['ps_scrambler'].time, game['ps_scrambler'].mirrored)
|
|
|
|
|
return check
|
|
|
|
|
elseif minigametype == 'ps_var' then
|
|
|
|
|
local check
|
|
|
|
|
exports['ps-ui']:VarHack(function(success)
|
|
|
|
|
check = success
|
|
|
|
|
end, game['ps_var'].numBlocks, game['ps_var'].time)
|
|
|
|
|
return check
|
|
|
|
|
elseif minigametype == 'ps_thermite' then
|
|
|
|
|
local check
|
|
|
|
|
exports['ps-ui']:Thermite(function(success)
|
|
|
|
|
check = success
|
|
|
|
|
end, game['ps_thermite'].time, game['ps_thermite'].gridsize, game['ps_thermite'].incorrect)
|
|
|
|
|
return check
|
2024-05-02 18:34:14 -07:00
|
|
|
elseif minigametype == 'ox' then
|
2024-09-24 15:07:41 -07:00
|
|
|
local success = lib.skillCheck(game['ox'], {'1', '2', '3', '4'})
|
2024-05-02 18:34:14 -07:00
|
|
|
return success
|
2024-10-02 01:00:46 -07:00
|
|
|
elseif minigametype == 'blcirprog' then
|
2024-09-24 15:07:41 -07:00
|
|
|
local success = exports.bl_ui:CircleProgress(game['blcirprog'].amount, game['blcirprog'].speed)
|
|
|
|
|
return success
|
|
|
|
|
elseif minigametype == 'blprog' then
|
|
|
|
|
local success = exports.bl_ui:Progress(game['blprog'].amount, game['blprog'].speed)
|
|
|
|
|
return success
|
|
|
|
|
elseif minigametype == 'blkeyspam' then
|
|
|
|
|
local success = exports.bl_ui:KeySpam(game['blkeyspam'].amount, game['blprog'].difficulty)
|
|
|
|
|
return success
|
|
|
|
|
elseif minigametype == 'blkeycircle' then
|
|
|
|
|
local success = exports.bl_ui:KeyCircle(game['blkeycircle'].amount, game['blkeycircle'].difficulty, game['blkeycircle'].keynumbers)
|
|
|
|
|
return success
|
|
|
|
|
elseif minigametype == 'blnumberslide' then
|
|
|
|
|
local success = exports.bl_ui:NumberSlide(game['blnumberslide'].amount, game['blnumberslide'].difficulty, game['blnumberslide'].keynumbers)
|
|
|
|
|
return success
|
|
|
|
|
elseif minigametype == 'blrapidlines' then
|
|
|
|
|
local success = exports.bl_ui:RapidLines(game['blrapidlines'].amount, game['blrapidlines'].difficulty, game['blrapidlines'].numberofline)
|
|
|
|
|
return success
|
|
|
|
|
elseif minigametype == 'blcircleshake' then
|
|
|
|
|
local success = exports.bl_ui:CircleShake(game['blcircleshake'].amount, game['blcircleshake'].difficulty, game['blcircleshake'].stages)
|
|
|
|
|
return success
|
|
|
|
|
elseif minigametype == 'glpath' then
|
2024-10-02 01:00:46 -07:00
|
|
|
local settings = {gridSize = game['glpath'].gridSize, lives = game['glpath'].lives, timeLimit = game['glpath'].timelimit}
|
|
|
|
|
local successes = false
|
|
|
|
|
exports["glow_minigames"]:StartMinigame(function(success)
|
|
|
|
|
if success then successes = true else successes = false end
|
|
|
|
|
end, "path", settings)
|
|
|
|
|
repeat
|
|
|
|
|
Wait(1000)
|
|
|
|
|
time = time + 1
|
|
|
|
|
until successes or time == 100
|
|
|
|
|
if successes then return true end
|
2024-09-24 15:07:41 -07:00
|
|
|
elseif minigametype == 'glspot' then
|
2024-10-02 01:00:46 -07:00
|
|
|
local settings = {gridSize = game['glspot'].gridSize, timeLimit = game['glspot'].gridSize, charSet = game['glspot'].charSet, required = game['glspot'].required}
|
|
|
|
|
local successes = false
|
2024-09-24 15:07:41 -07:00
|
|
|
exports["glow_minigames"]:StartMinigame(function(success)
|
2024-10-02 01:00:46 -07:00
|
|
|
if success then successes = true else successes = false end
|
|
|
|
|
end, "spot", settings)
|
|
|
|
|
repeat
|
|
|
|
|
Wait(1000)
|
|
|
|
|
time = time + 1
|
|
|
|
|
until successes or time == 100
|
2024-09-24 15:07:41 -07:00
|
|
|
elseif minigametype == 'glmath' then
|
2024-10-02 01:00:46 -07:00
|
|
|
local settings = {timeLimit = game['glmath'].timeLimit}
|
|
|
|
|
local successes = false
|
2024-09-24 15:07:41 -07:00
|
|
|
exports["glow_minigames"]:StartMinigame(function(success)
|
2024-10-02 01:00:46 -07:00
|
|
|
if success then successes = true else successes = false end
|
|
|
|
|
end, "math", settings)
|
|
|
|
|
repeat
|
|
|
|
|
Wait(1000)
|
|
|
|
|
time = time + 1
|
|
|
|
|
until successes or time == 100
|
2024-09-24 15:07:41 -07:00
|
|
|
elseif minigametype == 'none' then
|
|
|
|
|
return true
|
2024-11-04 16:46:27 -08:00
|
|
|
else
|
|
|
|
|
print"^1 SCRIPT ERROR: Md-Drugs set your minigame with one of the options!"
|
2024-10-02 01:00:46 -07:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2024-05-02 18:34:14 -07:00
|
|
|
function Notify(text, type)
|
|
|
|
|
if notifytype =='ox' then
|
|
|
|
|
lib.notify({title = text, type = type})
|
2024-06-20 18:46:51 -07:00
|
|
|
elseif notifytype == 'qb' then
|
2024-05-02 18:34:14 -07:00
|
|
|
QBCore.Functions.Notify(text, type)
|
|
|
|
|
elseif notifytype == 'okok' then
|
2024-06-20 18:46:51 -07:00
|
|
|
exports['okokNotify']:Alert('', text, 4000, type, false)
|
2024-11-04 16:46:27 -08:00
|
|
|
else
|
2024-09-24 15:07:41 -07:00
|
|
|
print"^1 SCRIPT ERROR: Md-DRUGS set your notification with one of the options!"
|
2024-11-04 16:46:27 -08:00
|
|
|
end
|
2024-05-02 18:34:14 -07:00
|
|
|
end
|
2024-07-11 17:39:58 -07:00
|
|
|
|
|
|
|
|
function GetImage(img)
|
2024-10-25 11:41:59 -07:00
|
|
|
if GetResourceState('ox_inventory') == 'started' then
|
|
|
|
|
local Items = exports['ox_inventory']:Items()
|
2024-11-16 23:39:34 -08:00
|
|
|
if not Items[img] then print(' You Are Missing: ' .. img .. ' From Your ox items.lua') return end
|
2024-10-25 11:41:59 -07:00
|
|
|
local itemClient = Items[img] and Items[img]['client']
|
|
|
|
|
if itemClient and itemClient['image'] then
|
|
|
|
|
return itemClient['image']
|
|
|
|
|
else
|
|
|
|
|
return "nui://ox_inventory/web/images/" .. img .. '.png'
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
local invs = {
|
|
|
|
|
['ps-inventory'] = "nui://ps-inventory/html/images/",
|
|
|
|
|
['lj-inventory'] = "nui://lj-inventory/html/images/",
|
|
|
|
|
['qb-inventory'] = "nui://qb-inventory/html/images/",
|
|
|
|
|
['qs-inventory'] = "nui://qs-inventory/html/img/",
|
|
|
|
|
['origen_inventory'] = "nui://origen_inventory/html/img/",
|
|
|
|
|
['core_inventory'] = "nui://core_inventory/html/img/"
|
|
|
|
|
}
|
|
|
|
|
for k, v in pairs(invs) do
|
2024-11-16 23:39:34 -08:00
|
|
|
if not QBCore.Shared.Items[img] then print(' You Are Missing: ' .. img .. ' From Your QB items.lua') return end
|
2024-10-25 11:41:59 -07:00
|
|
|
if GetResourceState(k) == 'started' then
|
|
|
|
|
return v .. QBCore.Shared.Items[img].image
|
|
|
|
|
end
|
|
|
|
|
end
|
2024-07-11 17:39:58 -07:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function GetLabel(label)
|
|
|
|
|
if GetResourceState('ox_inventory') == 'started' then
|
|
|
|
|
local Items = exports['ox_inventory']:Items()
|
2024-11-16 23:39:34 -08:00
|
|
|
if not Items[img] then print(' You Are Missing: ' .. img .. ' From Your ox items.lua') return end
|
2024-07-11 17:39:58 -07:00
|
|
|
return Items[label]['label']
|
|
|
|
|
else
|
2024-11-16 23:39:34 -08:00
|
|
|
if QBCore.Shared.Items[label] == nil then print("There Is No " .. label .. " In Your QB Items.lua") return end
|
2024-07-11 17:39:58 -07:00
|
|
|
return QBCore.Shared.Items[label]['label']
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2024-10-23 16:04:09 -07:00
|
|
|
function GetRep()
|
|
|
|
|
local rep = lib.callback.await('md-drugs:server:GetRep', false)
|
|
|
|
|
return rep
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function sorter(sorting, value)
|
2024-10-28 14:11:49 -07:00
|
|
|
table.sort(sorting, function(a, b) return a[value] < b[value] end)
|
2024-10-23 16:04:09 -07:00
|
|
|
end
|
|
|
|
|
|
2024-10-24 19:45:39 -07:00
|
|
|
function makeMenu(name, rep)
|
|
|
|
|
local menu = {}
|
|
|
|
|
local data = lib.callback.await('md-drugs:server:menu', false, name)
|
|
|
|
|
for k, v in pairs (data.table) do
|
|
|
|
|
local allow = false
|
|
|
|
|
if rep == nil then
|
|
|
|
|
allow = true
|
|
|
|
|
else
|
|
|
|
|
if rep.dealerrep >= v.minrep then allow = true end
|
|
|
|
|
end
|
|
|
|
|
if allow then
|
|
|
|
|
menu[#menu + 1] = {
|
|
|
|
|
icon = GetImage(v.name),
|
|
|
|
|
description = '$'.. v.price,
|
|
|
|
|
title = GetLabel(v.name),
|
|
|
|
|
onSelect = function()
|
|
|
|
|
local settext = "Cost: $"..v.price
|
|
|
|
|
local dialog = exports.ox_lib:inputDialog(v.name .."!", {
|
|
|
|
|
{ type = 'select', label = "Payment Type", default = "cash", options = { { value = "cash"}, { value = "bank"},}},
|
|
|
|
|
{ type = 'number', label = "Amount to buy", description = settext, min = 0, max = v.amount, default = 1 },
|
|
|
|
|
})
|
|
|
|
|
if not dialog[1] then return end
|
|
|
|
|
TriggerServerEvent("md-drugs:server:purchaseGoods", dialog[2], dialog[1], v.name, v.price, data.table, k)
|
|
|
|
|
end,
|
|
|
|
|
}
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
sorter(menu, 'title')
|
|
|
|
|
lib.registerContext({id = data.id, title = data.title, options = menu})
|
|
|
|
|
end
|
2024-10-23 16:04:09 -07:00
|
|
|
|
2024-05-02 18:34:14 -07:00
|
|
|
|
|
|
|
|
function ItemCheck(item)
|
2024-06-30 17:35:26 -07:00
|
|
|
if GetResourceState('ox_inventory') == 'started' then
|
2024-09-24 15:07:41 -07:00
|
|
|
if exports.ox_inventory:GetItemCount(item) >= 1 then return true else Notify('You Need ' .. GetLabel(item) .. " !", 'error') return false end
|
2024-06-30 17:35:26 -07:00
|
|
|
else
|
|
|
|
|
if QBCore.Shared.Items[item] == nil then print("There Is No " .. item .. " In Your QB Items.lua") return end
|
2024-09-24 15:07:41 -07:00
|
|
|
if QBCore.Functions.HasItem(item) then return true else Notify('You Need ' .. QBCore.Shared.Items[item].label .. " !", 'error') return false end
|
2024-06-30 17:35:26 -07:00
|
|
|
end
|
2024-05-02 18:34:14 -07:00
|
|
|
end
|
|
|
|
|
|
2024-09-24 15:07:41 -07:00
|
|
|
function ItemCheckMulti(item)
|
|
|
|
|
local need = 0
|
|
|
|
|
local has = 0
|
|
|
|
|
for k,v in pairs (item) do
|
|
|
|
|
need = need + 1
|
|
|
|
|
if GetResourceState('ox_inventory') == 'started' then
|
|
|
|
|
if exports.ox_inventory:GetItemCount(v) >= 1 then has = has + 1 else Notify('You Need ' .. GetLabel(v) .. " !", 'error') end
|
|
|
|
|
else
|
|
|
|
|
if QBCore.Shared.Items[v] == nil then print("There Is No " .. item .. " In Your QB Items.lua") return end
|
|
|
|
|
if QBCore.Functions.HasItem(v) then has = has + 1 else Notify('You Need ' .. QBCore.Shared.Items[v].label .. " !", 'error') end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
if need == has then
|
|
|
|
|
return true
|
|
|
|
|
else
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2024-05-02 18:34:14 -07:00
|
|
|
function Email(sender, subject, message)
|
|
|
|
|
if Config.Phone == 'yflip' then
|
|
|
|
|
local receiver = GetPlayerServerId(PlayerId())
|
|
|
|
|
local insertId, received = exports["yflip-phone"]:SendMail({
|
|
|
|
|
title = subject,
|
|
|
|
|
sender = sender,
|
|
|
|
|
senderDisplayName = sender,
|
|
|
|
|
content = message,
|
|
|
|
|
}, 'phoneNumber', receiver)
|
2024-05-02 20:00:54 -07:00
|
|
|
elseif Config.Phone == 'qs' then
|
|
|
|
|
TriggerServerEvent('qs-smartphone:server:sendNewMail', {
|
|
|
|
|
sender = sender,
|
|
|
|
|
subject = subject,
|
|
|
|
|
message = message,
|
|
|
|
|
button = {}
|
|
|
|
|
})
|
2024-05-02 18:34:14 -07:00
|
|
|
else
|
|
|
|
|
TriggerServerEvent('qb-phone:server:sendNewMail', {
|
|
|
|
|
sender = sender,
|
|
|
|
|
subject = subject,
|
|
|
|
|
message = message,
|
|
|
|
|
})
|
|
|
|
|
end
|
2024-11-04 16:46:27 -08:00
|
|
|
end
|
2024-05-02 18:34:14 -07:00
|
|
|
|
|
|
|
|
function PoliceCall(chance)
|
|
|
|
|
local math = math.random(1,100)
|
|
|
|
|
if math <= chance then
|
|
|
|
|
if dispatch == 'ps' then
|
|
|
|
|
exports['ps-dispatch']:DrugSale()
|
|
|
|
|
elseif dispatch == 'cd' then
|
|
|
|
|
local data = exports['cd_dispatch']:GetPlayerInfo()
|
|
|
|
|
TriggerServerEvent('cd_dispatch:AddNotification', {
|
|
|
|
|
job_table = {'police', },
|
|
|
|
|
coords = data.coords,
|
|
|
|
|
title = '420-69 Drug Sale',
|
|
|
|
|
message = 'A '..data.sex..' robbing a store at '..data.street,
|
|
|
|
|
flash = 0,
|
|
|
|
|
unique_id = data.unique_id,
|
|
|
|
|
sound = 1,
|
2024-10-28 14:11:49 -07:00
|
|
|
blip = { sprite = 431, scale = 1.2, colour = 3, flashes = false, text = '420-69 Drug Sale', time = 5, radius = 0,}
|
2024-05-02 18:34:14 -07:00
|
|
|
})
|
|
|
|
|
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'})
|
2024-06-20 18:46:51 -07:00
|
|
|
elseif dispatch == 'qs' then
|
|
|
|
|
exports['qs-dispatch']:DrugSale()
|
2024-05-02 18:34:14 -07:00
|
|
|
else
|
|
|
|
|
print('Congrats, You Choose 0 of the options :)')
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function GetCops(number)
|
2024-05-12 00:22:09 -07:00
|
|
|
if number == 0 then return true end
|
2024-07-11 17:39:58 -07:00
|
|
|
local amount = lib.callback.await('md-drugs:server:GetCoppers', false)
|
|
|
|
|
if amount >= number then return true else Notify('You Need '.. number - amount .. ' More Cops To Do This', 'error') end
|
2024-05-02 18:34:14 -07:00
|
|
|
end
|
|
|
|
|
|
2024-06-13 22:12:37 -07:00
|
|
|
|
2024-07-11 17:39:58 -07:00
|
|
|
function Freeze(entity, toggle, head)
|
|
|
|
|
SetEntityInvincible(entity, toggle)
|
|
|
|
|
SetEntityAsMissionEntity(entity, toggle, toggle)
|
|
|
|
|
FreezeEntityPosition(entity, toggle)
|
|
|
|
|
SetEntityHeading(entity, head)
|
|
|
|
|
SetBlockingOfNonTemporaryEvents(entity, toggle)
|
2024-09-24 15:07:41 -07:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function tele(coords)
|
|
|
|
|
DoScreenFadeOut(500)
|
|
|
|
|
Wait(1000)
|
|
|
|
|
SetEntityCoords(PlayerPedId(),coords.x, coords.y, coords.z)
|
|
|
|
|
Wait(1000)
|
|
|
|
|
DoScreenFadeIn(500)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function AddBoxZoneSingle(name, loc, data)
|
|
|
|
|
if Config.Target == 'qb' then
|
|
|
|
|
exports['qb-target']:AddBoxZone(name, loc, 1.5, 1.75, {name = name, minZ = loc.z-1,maxZ = loc.z +1},
|
|
|
|
|
{ options = {
|
|
|
|
|
{
|
|
|
|
|
type = data.type or nil,
|
|
|
|
|
event = data.event or nil,
|
|
|
|
|
action = data.action or nil,
|
|
|
|
|
icon = data.icon,
|
|
|
|
|
label = data.label,
|
|
|
|
|
data = data.data,
|
|
|
|
|
canInteract = data.canInteract,
|
|
|
|
|
}
|
2024-11-04 16:46:27 -08:00
|
|
|
},
|
2024-09-24 15:07:41 -07:00
|
|
|
distance = 2.0
|
|
|
|
|
})
|
|
|
|
|
elseif Config.Target == 'ox' then
|
|
|
|
|
exports.ox_target:addBoxZone({coords = loc, size = vec3(1,1,1), options = {
|
|
|
|
|
{
|
|
|
|
|
type = data.type or nil,
|
|
|
|
|
event = data.event or nil,
|
|
|
|
|
onSelect = data.action or nil,
|
|
|
|
|
distance = 2.5,
|
|
|
|
|
icon = data.icon,
|
|
|
|
|
label = data.label,
|
|
|
|
|
data = data.data,
|
|
|
|
|
canInteract = data.canInteract,
|
|
|
|
|
}
|
|
|
|
|
}, })
|
2024-11-12 17:08:02 -08:00
|
|
|
elseif Config.Target == 'interact' then
|
|
|
|
|
exports.interact:AddInteraction({
|
|
|
|
|
coords = vector3(loc.x, loc.y, loc.z),
|
|
|
|
|
distance = 2.5,
|
|
|
|
|
interactDst = 2,
|
|
|
|
|
id = name,
|
|
|
|
|
options = {
|
|
|
|
|
{
|
|
|
|
|
type = data.type or nil,
|
|
|
|
|
event = data.event or nil,
|
|
|
|
|
onSelect = data.action or nil,
|
|
|
|
|
distance = 2.5,
|
|
|
|
|
label = data.label,
|
|
|
|
|
data = data.data,
|
|
|
|
|
canInteract = data.canInteract,
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
})
|
2024-09-24 15:07:41 -07:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2024-11-11 20:22:48 -08:00
|
|
|
function AddBoxZoneMulti(name, table, data)
|
2024-09-24 15:07:41 -07:00
|
|
|
for k, v in pairs (table) do
|
|
|
|
|
if v.gang == nil or v.gang == '' or v.gang == "" then v.gang = 1 end
|
|
|
|
|
if Config.Target == 'qb' then
|
|
|
|
|
exports['qb-target']:AddBoxZone(name .. k, v.loc, 1.5, 1.75, {name = name..k, minZ = v.loc.z-1.50,maxZ = v.loc.z +1.5},
|
|
|
|
|
{ options = {
|
|
|
|
|
{
|
|
|
|
|
type = data.type or nil,
|
|
|
|
|
event = data.event or nil,
|
|
|
|
|
action = data.action or nil,
|
|
|
|
|
icon = data.icon,
|
|
|
|
|
label = data.label,
|
|
|
|
|
data = k,
|
|
|
|
|
canInteract = data.canInteract or function()
|
|
|
|
|
if QBCore.Functions.GetPlayerData().gang.name == v.gang or v.gang == 1 then return true end end
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
distance = 2.5
|
|
|
|
|
})
|
|
|
|
|
elseif Config.Target == 'ox' then
|
|
|
|
|
exports.ox_target:addBoxZone({coords = v.loc, size = vec3(1,1,1), options = {
|
|
|
|
|
{
|
|
|
|
|
type = data.type or nil,
|
|
|
|
|
event = data.event or nil,
|
|
|
|
|
onSelect = data.action or nil,
|
|
|
|
|
icon = data.icon,
|
|
|
|
|
label = data.label,
|
|
|
|
|
data = k,
|
|
|
|
|
distance = 2.5,
|
|
|
|
|
canInteract = data.canInteract or function()
|
|
|
|
|
if QBCore.Functions.GetPlayerData().gang.name == v.gang or v.gang == 1 then return true end end
|
|
|
|
|
}
|
|
|
|
|
}, })
|
2024-11-12 17:08:02 -08:00
|
|
|
elseif Config.Target == 'interact' then
|
|
|
|
|
exports.interact:AddInteraction({
|
|
|
|
|
coords = vector3(v.loc.x, v.loc.y, v.loc.z),
|
|
|
|
|
distance = 2.5,
|
|
|
|
|
interactDst = 2,
|
|
|
|
|
id = name,
|
|
|
|
|
options = {
|
|
|
|
|
{
|
|
|
|
|
type = data.type or nil,
|
|
|
|
|
event = data.event or nil,
|
|
|
|
|
action = data.action or nil,
|
|
|
|
|
distance = 2.5,
|
|
|
|
|
label = data.label,
|
|
|
|
|
data = k,
|
|
|
|
|
canInteract = data.canInteract or function()
|
|
|
|
|
if QBCore.Functions.GetPlayerData().gang.name == v.gang or v.gang == 1 then return true end end
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
})
|
2024-09-24 15:07:41 -07:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2024-09-28 18:17:25 -07:00
|
|
|
|
|
|
|
|
function AddBoxZoneMultiOptions(name, loc, data)
|
2024-11-23 01:58:57 -08:00
|
|
|
local options = {}
|
|
|
|
|
for k, v in pairs (data) do
|
|
|
|
|
table.insert(options, {
|
|
|
|
|
icon = v.icon, label = v.label, event = v.event or nil, action = v.action or nil,
|
|
|
|
|
onSelect = v.action,data = v.data,canInteract = v.canInteract or nil, distance = 2.0,
|
|
|
|
|
})
|
2024-09-28 18:17:25 -07:00
|
|
|
end
|
2024-11-23 01:58:57 -08:00
|
|
|
if Config.Target == 'qb' then
|
|
|
|
|
exports['qb-target']:AddBoxZone(name , loc, 1.5, 1.75, {name = name, minZ = loc.z-1.50,maxZ = loc.z +1.5},
|
|
|
|
|
{ options = options, distance = 2.5})
|
|
|
|
|
elseif Config.Target == 'ox' then
|
|
|
|
|
exports.ox_target:addBoxZone({coords = loc, size = vec3(1,1,1), options = options })
|
|
|
|
|
elseif Config.Target == 'interact' then
|
|
|
|
|
exports.interact:AddInteraction({coords = vector3(loc.x, loc.y, loc.z),distance = 2.5,interactDst = 2,id = name,options = options})
|
|
|
|
|
end
|
|
|
|
|
end
|
2024-09-28 18:17:25 -07:00
|
|
|
|
2024-09-24 15:07:41 -07:00
|
|
|
|
|
|
|
|
function AddSingleModel(model, data, num)
|
|
|
|
|
if Config.Target == 'qb' then
|
|
|
|
|
exports['qb-target']:AddTargetEntity(model, {options = {
|
|
|
|
|
{icon = data.icon, label = data.label, event = data.event or nil, action = data.action or nil, data = num }
|
|
|
|
|
}, distance = 2.5})
|
|
|
|
|
elseif Config.Target == 'ox' then
|
|
|
|
|
exports.ox_target:addLocalEntity(model, {icon = data.icon, label = data.label, event = data.event or nil, onSelect = data.action or nil, data = num, distance = 2.5 })
|
2024-11-12 17:08:02 -08:00
|
|
|
elseif Config.Target == 'interact' then
|
|
|
|
|
exports.interact:AddLocalEntityInteraction({entity = model,offset = vec3(0.0, 0.0, 1.0),id = 'mddrugs'..model,distance = 2.5,interactDst = 2.5, options = {label = data.label, event = data.event or nil, action = data.action or nil, data = num, distance = 2.5 }})
|
2024-09-24 15:07:41 -07:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function AddMultiModel(model, data, num)
|
2024-10-28 14:11:49 -07:00
|
|
|
local options = {}
|
2024-10-25 01:55:35 -07:00
|
|
|
for k, v in pairs (data) do
|
2024-11-23 01:58:57 -08:00
|
|
|
table.insert(options, {
|
2024-10-28 14:11:49 -07:00
|
|
|
icon = v.icon, label = v.label, event = v.event or nil, action = v.action or nil,
|
2024-11-04 17:43:48 -08:00
|
|
|
onSelect = v.action,data = v.data,canInteract = v.canInteract or nil, distance = 2.0,
|
2024-11-23 01:58:57 -08:00
|
|
|
})
|
2024-10-25 01:55:35 -07:00
|
|
|
end
|
2024-09-24 15:07:41 -07:00
|
|
|
if Config.Target == 'qb' then
|
2024-10-28 14:11:49 -07:00
|
|
|
exports['qb-target']:AddTargetEntity(model, {options = options, distance = 2.5})
|
2024-09-24 15:07:41 -07:00
|
|
|
elseif Config.Target == 'ox' then
|
2024-10-28 14:11:49 -07:00
|
|
|
exports.ox_target:addLocalEntity(model, options)
|
2024-11-12 17:08:02 -08:00
|
|
|
elseif Config.Target == 'interact' then
|
|
|
|
|
exports.interact:AddLocalEntityInteraction({entity = model,offset = vec3(0.0, 0.0, 1.0),id = 'mddrugsmulti'..model,distance = 2.5,interactDst = 2.5, options = options})
|
2024-09-24 15:07:41 -07:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local created = false
|
|
|
|
|
local heading = 180.0
|
|
|
|
|
function StartRay()
|
|
|
|
|
local run = true
|
|
|
|
|
local pedcoord = GetEntityCoords(PlayerPedId())
|
2024-11-12 17:08:02 -08:00
|
|
|
lib.requestModel('v_ret_ml_tablea', 30000)
|
2024-09-24 15:07:41 -07:00
|
|
|
local table = CreateObject('v_ret_ml_tablea', pedcoord.x, pedcoord.y, pedcoord.z+1, heading, false, false)
|
|
|
|
|
repeat
|
|
|
|
|
local hit, entityHit, endCoords, surfaceNormal, matHash = lib.raycast.cam(511, 4, 10)
|
|
|
|
|
if not created then
|
|
|
|
|
created = true
|
|
|
|
|
lib.showTextUI([[[E] To Place
|
|
|
|
|
[DEL] To Cancel
|
|
|
|
|
[<-] To Move Left
|
|
|
|
|
[->] To Move Right]])
|
|
|
|
|
else
|
|
|
|
|
SetEntityCoords(table, endCoords.x, endCoords.y, endCoords.z+1)
|
|
|
|
|
SetEntityHeading(table, heading)
|
|
|
|
|
SetEntityCollision(table, false, false)
|
|
|
|
|
SetEntityAlpha(table, 100)
|
|
|
|
|
end
|
|
|
|
|
if IsControlPressed(0, 174) then
|
|
|
|
|
heading = heading - 2
|
|
|
|
|
end
|
|
|
|
|
if IsControlPressed(0, 175) then
|
|
|
|
|
heading = heading + 2
|
|
|
|
|
end
|
|
|
|
|
if IsControlPressed(0, 38) then
|
|
|
|
|
lib.hideTextUI()
|
|
|
|
|
run = false
|
|
|
|
|
DeleteObject(table)
|
|
|
|
|
created = false
|
|
|
|
|
return endCoords, heading
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if IsControlPressed(0, 178) then
|
|
|
|
|
lib.hideTextUI()
|
|
|
|
|
run = false
|
|
|
|
|
created = false
|
|
|
|
|
DeleteObject(table)
|
|
|
|
|
return nil, nil
|
|
|
|
|
end
|
|
|
|
|
Wait(0)
|
|
|
|
|
until run == false
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function StartRay2()
|
|
|
|
|
local run = true
|
|
|
|
|
local pedcoord = GetEntityCoords(PlayerPedId())
|
2024-11-12 17:08:02 -08:00
|
|
|
lib.requestModel('v_ret_ml_tablea', 30000)
|
2024-09-24 15:07:41 -07:00
|
|
|
local table = CreateObject('bkr_prop_coke_press_01aa', pedcoord.x, pedcoord.y, pedcoord.z+1, heading, false, false)
|
|
|
|
|
repeat
|
|
|
|
|
local hit, entityHit, endCoords, surfaceNormal, matHash = lib.raycast.cam(511, 4, 10)
|
|
|
|
|
if not created then
|
|
|
|
|
created = true
|
|
|
|
|
lib.showTextUI([[[E] To Place
|
|
|
|
|
[DEL] To Cancel
|
|
|
|
|
[<-] To Move Left
|
|
|
|
|
[->] To Move Right]])
|
|
|
|
|
else
|
|
|
|
|
SetEntityCoords(table, endCoords.x, endCoords.y, endCoords.z+1)
|
|
|
|
|
SetEntityHeading(table, heading)
|
|
|
|
|
SetEntityCollision(table, false, false)
|
|
|
|
|
SetEntityAlpha(table, 100)
|
|
|
|
|
end
|
|
|
|
|
if IsControlPressed(0, 174) then
|
|
|
|
|
heading = heading - 2
|
|
|
|
|
end
|
|
|
|
|
if IsControlPressed(0, 175) then
|
|
|
|
|
heading = heading + 2
|
|
|
|
|
end
|
|
|
|
|
if IsControlPressed(0, 38) then
|
|
|
|
|
lib.hideTextUI()
|
|
|
|
|
run = false
|
|
|
|
|
DeleteObject(table)
|
|
|
|
|
created = false
|
|
|
|
|
return endCoords, heading
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if IsControlPressed(0, 178) then
|
|
|
|
|
lib.hideTextUI()
|
|
|
|
|
run = false
|
|
|
|
|
created = false
|
|
|
|
|
DeleteObject(table)
|
|
|
|
|
return nil, nil
|
|
|
|
|
end
|
|
|
|
|
Wait(0)
|
|
|
|
|
until run == false
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function()
|
|
|
|
|
Wait(3000)
|
2024-11-12 02:07:16 -08:00
|
|
|
LoadModel('prop_plant_01b') LoadModel('prop_plant_01a') LoadModel('prop_cactus_03') LoadModel('bkr_prop_weed_lrg_01b')
|
2024-09-24 15:07:41 -07:00
|
|
|
local check = lib.callback.await('md-drugs:server:GetRep', false)
|
|
|
|
|
|
2024-10-25 11:41:59 -07:00
|
|
|
return
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
AddEventHandler('onResourceStart', function(resource)
|
|
|
|
|
if resource == GetCurrentResourceName() then
|
2024-11-12 02:07:16 -08:00
|
|
|
LoadModel('prop_plant_01b') LoadModel('prop_plant_01a') LoadModel('prop_cactus_03') LoadModel('bkr_prop_weed_lrg_01b')
|
2024-10-25 11:41:59 -07:00
|
|
|
end
|
2024-09-24 15:07:41 -07:00
|
|
|
end)
|
|
|
|
|
local active = false
|
|
|
|
|
RegisterNetEvent('md-drugs:client:minusTier', function(data)
|
|
|
|
|
if active then return end
|
|
|
|
|
if not data then return end
|
|
|
|
|
active = true
|
|
|
|
|
if not progressbar('Cutting This ' ..GetLabel(data.item) .. ' More', 4000, 'uncuff') then return end
|
|
|
|
|
TriggerServerEvent('md-drugs:server:AddMas', data)
|
|
|
|
|
active = false
|
2024-11-11 20:22:48 -08:00
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
CreateThread(function()
|
|
|
|
|
TriggerEvent('heroin:init')
|
|
|
|
|
TriggerEvent('coke:init')
|
|
|
|
|
TriggerEvent('Mescaline:init')
|
|
|
|
|
TriggerEvent('shrooms:init')
|
|
|
|
|
TriggerEvent('weed:init')
|
2024-09-24 15:07:41 -07:00
|
|
|
end)
|