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
|
|
|
|
|
print"dude, it literally tells you what you need to set it as in the config"
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function minigame(num1, num2)
|
|
|
|
|
local check
|
|
|
|
|
if minigametype == 'ps' then
|
|
|
|
|
exports['ps-ui']:Circle(function(success)
|
|
|
|
|
check = success
|
|
|
|
|
end, num1, num2)
|
|
|
|
|
return check
|
|
|
|
|
elseif minigametype == 'ox' then
|
|
|
|
|
num1 = 'easy'
|
|
|
|
|
if num2 <= 6 then num2 = 'hard' elseif num2 >= 7 and num2 <= 12 then num2 = 'medium' else num2 = 'easy' end
|
|
|
|
|
local success = lib.skillCheck({num1, num2}, {'1', '2', '3', '4'})
|
|
|
|
|
return success
|
2024-05-13 13:42:10 -07:00
|
|
|
elseif minigametype == 'none' then
|
|
|
|
|
return true
|
|
|
|
|
else
|
|
|
|
|
|
2024-05-02 18:34:14 -07:00
|
|
|
print"dude, it literally tells you what you need to set it as in the config"
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2024-05-13 13:42:10 -07:00
|
|
|
|
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-05-02 18:34:14 -07:00
|
|
|
else
|
2024-06-20 18:46:51 -07:00
|
|
|
print"dude, it literally tells you what you need to set it as in the config"
|
|
|
|
|
end
|
2024-05-02 18:34:14 -07:00
|
|
|
end
|
2024-07-10 16:21:34 -07:00
|
|
|
|
|
|
|
|
function GetImage(img)
|
|
|
|
|
if GetResourceState('ox_inventory') == 'started' then
|
|
|
|
|
local Items = exports['ox_inventory']:Items()
|
|
|
|
|
if Items[img]['client']['image'] == nil then
|
|
|
|
|
return Items[img]
|
|
|
|
|
else
|
|
|
|
|
return Items[img]['client']['image']
|
|
|
|
|
end
|
|
|
|
|
elseif GetResourceState('ps-inventory') == 'started' then
|
|
|
|
|
return "nui://ps-inventory/html/images/".. QBCore.Shared.Items[img].image
|
|
|
|
|
elseif GetResourceState('lj-inventory') == 'started' then
|
|
|
|
|
return "nui://lj-inventory/html/images/".. QBCore.Shared.Items[img].image
|
|
|
|
|
elseif GetResourceState('qb-inventory') == 'started' then
|
|
|
|
|
return "nui://qb-inventory/html/images/".. QBCore.Shared.Items[img].image
|
|
|
|
|
elseif GetResourceState('qs-inventory') == 'started' then
|
|
|
|
|
return "nui://qs-inventory/html/img/".. QBCore.Shared.Items[img].image
|
|
|
|
|
elseif GetResourceState('origen_inventory') == 'started' then
|
|
|
|
|
return "nui://origen_inventory/html/img/".. QBCore.Shared.Items[img].image
|
|
|
|
|
elseif GetResourceState('core_inventory') == 'started' then
|
|
|
|
|
return "nui://core_inventory/html/img/".. QBCore.Shared.Items[img].image
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function GetLabel(label)
|
|
|
|
|
if GetResourceState('ox_inventory') == 'started' then
|
|
|
|
|
local Items = exports['ox_inventory']:Items()
|
|
|
|
|
return Items[label]['label']
|
|
|
|
|
else
|
|
|
|
|
return QBCore.Shared.Items[label]['label']
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2024-05-02 18:34:14 -07:00
|
|
|
|
|
|
|
|
function ItemCheck(item)
|
|
|
|
|
local success
|
2024-06-30 17:35:26 -07:00
|
|
|
if GetResourceState('ox_inventory') == 'started' then
|
2024-07-10 16:21:34 -07:00
|
|
|
if exports.ox_inventory:GetItemCount(item) >= 1 then return true else Notify('You Need ' .. GetLabel(item) .. " !", 'error') 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
|
|
|
|
|
if QBCore.Functions.HasItem(item) then success = item return success else Notify('You Need ' .. QBCore.Shared.Items[item].label .. " !", 'error') end
|
|
|
|
|
end
|
2024-05-02 18:34:14 -07:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
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,
|
|
|
|
|
blip = {
|
|
|
|
|
sprite = 431,
|
|
|
|
|
scale = 1.2,
|
|
|
|
|
colour = 3,
|
|
|
|
|
flashes = false,
|
|
|
|
|
text = '420-69 Drug Sale',
|
|
|
|
|
time = 5,
|
|
|
|
|
radius = 0,
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
elseif dispatch == 'core' then
|
|
|
|
|
exports['core_dispatch']:addCall("420-69", "Drugs Are Being Sold", {
|
|
|
|
|
{icon="fa-ruler", info="4.5 MILES"},
|
|
|
|
|
}, {GetEntityCoords(PlayerPedId())}, "police", 3000, 11, 5 )
|
|
|
|
|
elseif dispatch == 'aty' then
|
|
|
|
|
exports["aty_dispatch"]:SendDispatch('Drug Sale', '420-69', 40, {'police'})
|
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-06-13 22:12:37 -07:00
|
|
|
local need = false
|
|
|
|
|
local nope = false
|
2024-05-02 18:34:14 -07:00
|
|
|
QBCore.Functions.TriggerCallback('md-drugs:server:GetCoppers', function(amount)
|
2024-06-13 22:12:37 -07:00
|
|
|
if amount >= number then need = true else Notify('You Need '.. number - amount .. ' More Cops To Do This', 'error') nope = true end
|
2024-05-02 18:34:14 -07:00
|
|
|
end)
|
2024-06-13 22:12:37 -07:00
|
|
|
repeat
|
|
|
|
|
Wait(100)
|
|
|
|
|
until need or nope
|
|
|
|
|
if need then return true end
|
2024-05-02 18:34:14 -07:00
|
|
|
end
|
|
|
|
|
|
2024-06-13 22:12:37 -07:00
|
|
|
|