2024-05-02 18:34:14 -07:00
|
|
|
|
|
|
|
|
local minigametype = Config.minigametype
|
|
|
|
|
|
2026-01-16 02:57:26 -07:00
|
|
|
function requestModel(ped, timeout)
|
|
|
|
|
timeout = timeout or 15000
|
|
|
|
|
local startTime = GetGameTimer()
|
|
|
|
|
RequestModel(ped)
|
|
|
|
|
while not HasModelLoaded(ped) do
|
|
|
|
|
Wait(0)
|
|
|
|
|
if GetGameTimer() - startTime > timeout then
|
|
|
|
|
Bridge.Prints.Debug('requestModel timed out', ped, GetGameTimer() - startTime)
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
|
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
|
2025-08-09 03:10:00 -06:00
|
|
|
local check = exports['ps-ui']:Circle(false, game['ps_circle'].amount, game['ps_circle'].speed)
|
2024-10-02 01:00:46 -07:00
|
|
|
return check
|
|
|
|
|
elseif minigametype == 'ps_maze' then
|
2025-08-09 03:10:00 -06:00
|
|
|
local check = exports['ps-ui']:Maze(false, game['ps_maze'].timelimit)
|
2024-10-02 01:00:46 -07:00
|
|
|
return check
|
|
|
|
|
elseif minigametype == 'ps_scrambler' then
|
2025-08-09 03:10:00 -06:00
|
|
|
local check = exports['ps-ui']:Scrambler(false, game['ps_scrambler'].type, game['ps_scrambler'].time, game['ps_scrambler'].mirrored)
|
2024-10-02 01:00:46 -07:00
|
|
|
return check
|
|
|
|
|
elseif minigametype == 'ps_var' then
|
2025-08-09 03:10:00 -06:00
|
|
|
local check = exports['ps-ui']:VarHack(false, game['ps_var'].numBlocks, game['ps_var'].time)
|
2024-10-02 01:00:46 -07:00
|
|
|
return check
|
|
|
|
|
elseif minigametype == 'ps_thermite' then
|
2025-08-09 03:10:00 -06:00
|
|
|
local check = exports['ps-ui']:Thermite(false, 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
|
2025-09-05 21:28:04 -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
|
2025-09-05 21:28:04 -07:00
|
|
|
end
|
2024-07-11 17:39:58 -07:00
|
|
|
|
2024-10-23 16:04:09 -07:00
|
|
|
function GetRep()
|
2026-01-19 00:38:01 -07:00
|
|
|
local rep = Bridge.Callback.Trigger('md-drugs:server:GetRep')
|
2024-10-23 16:04:09 -07:00
|
|
|
return rep
|
|
|
|
|
end
|
|
|
|
|
|
2024-05-02 18:34:14 -07:00
|
|
|
function PoliceCall(chance)
|
|
|
|
|
local math = math.random(1,100)
|
|
|
|
|
if math <= chance then
|
2026-01-16 02:57:26 -07:00
|
|
|
Bridge.Dispatch.SendAlert({
|
|
|
|
|
message = "Suspisous Handoff",
|
|
|
|
|
code = "10-31",
|
|
|
|
|
coords = GetEntityCoords(PlayerPedId()),
|
|
|
|
|
jobs = {"police"},
|
|
|
|
|
blipData = {
|
|
|
|
|
sprite = 161,
|
|
|
|
|
color = 1,
|
|
|
|
|
scale = 1.0
|
|
|
|
|
},
|
|
|
|
|
time = 300000,
|
|
|
|
|
icon = "fas fa-exclamation-triangle"
|
|
|
|
|
})
|
2024-05-02 18:34:14 -07:00
|
|
|
else
|
2024-11-26 17:26:46 -08:00
|
|
|
return
|
2024-05-02 18:34:14 -07:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function GetCops(number)
|
2024-05-12 00:22:09 -07:00
|
|
|
if number == 0 then return true end
|
2026-01-19 00:38:01 -07:00
|
|
|
local amount = Bridge.Callback.Trigger('md-drugs:server:GetCoppers')
|
2026-01-16 02:57:26 -07:00
|
|
|
if amount >= number then return true else Bridge.Notify.SendNotify('You Need '.. number - amount .. ' More Cops To Do This', 'error') end
|
2024-05-02 18:34:14 -07:00
|
|
|
end
|
|
|
|
|
|
2024-07-11 17:39:58 -07:00
|
|
|
function Freeze(entity, toggle, head)
|
2024-12-12 17:26:08 -08:00
|
|
|
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
|
|
|
|
|
|
2026-01-19 00:38:01 -07:00
|
|
|
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
|
|
|
|
|
|
2024-09-24 15:07:41 -07:00
|
|
|
local created = false
|
|
|
|
|
local heading = 180.0
|
|
|
|
|
function StartRay()
|
|
|
|
|
local run = true
|
|
|
|
|
local pedcoord = GetEntityCoords(PlayerPedId())
|
2026-01-18 01:20:44 -07:00
|
|
|
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
|
2026-01-19 00:38:01 -07:00
|
|
|
local hit, endCoords, surfaceNormal, entityHit = ray()
|
2024-09-24 15:07:41 -07:00
|
|
|
if not created then
|
|
|
|
|
created = true
|
2026-01-19 00:38:01 -07:00
|
|
|
Bridge.HelpText.ShowHelpText([[[E] To Place
|
2024-09-24 15:07:41 -07:00
|
|
|
[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
|
2026-01-19 00:38:01 -07:00
|
|
|
Bridge.HelpText.HideHelpText()
|
2024-09-24 15:07:41 -07:00
|
|
|
run = false
|
|
|
|
|
DeleteObject(table)
|
|
|
|
|
created = false
|
|
|
|
|
return endCoords, heading
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if IsControlPressed(0, 178) then
|
2026-01-19 00:38:01 -07:00
|
|
|
Bridge.HelpText.HideHelpText()
|
2024-09-24 15:07:41 -07:00
|
|
|
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())
|
2026-01-18 01:20:44 -07:00
|
|
|
requestModel('bkr_prop_coke_press_01aa', 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
|
2026-01-19 00:38:01 -07:00
|
|
|
local hit, endCoords, surfaceNormal, entityHit = ray()
|
2024-09-24 15:07:41 -07:00
|
|
|
if not created then
|
|
|
|
|
created = true
|
2026-01-19 00:38:01 -07:00
|
|
|
Bridge.HelpText.ShowHelpText([[[E] To Place
|
2024-09-24 15:07:41 -07:00
|
|
|
[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
|
2026-01-19 00:38:01 -07:00
|
|
|
Bridge.HelpText.HideHelpText()
|
2024-09-24 15:07:41 -07:00
|
|
|
run = false
|
|
|
|
|
DeleteObject(table)
|
|
|
|
|
created = false
|
|
|
|
|
return endCoords, heading
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if IsControlPressed(0, 178) then
|
2026-01-19 00:38:01 -07:00
|
|
|
Bridge.HelpText.HideHelpText()
|
2024-09-24 15:07:41 -07:00
|
|
|
run = false
|
|
|
|
|
created = false
|
|
|
|
|
DeleteObject(table)
|
|
|
|
|
return nil, nil
|
|
|
|
|
end
|
|
|
|
|
Wait(0)
|
|
|
|
|
until run == false
|
|
|
|
|
end
|
|
|
|
|
|
2026-01-19 00:38:01 -07:00
|
|
|
Bridge.Callback.Register('md-drugs:client:uncuff', function(data)
|
2026-01-21 21:27:08 -07:00
|
|
|
if not progressbar(data) then return end
|
2024-11-23 14:38:23 -08:00
|
|
|
return true
|
2024-11-24 01:25:09 -08:00
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
RegisterCommand('DrugRep', function()
|
|
|
|
|
if not Config.TierSystem then return end
|
2026-01-19 00:38:01 -07:00
|
|
|
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 }
|
|
|
|
|
}
|
2025-08-09 03:10:00 -06:00
|
|
|
})
|
2024-12-12 15:26:48 -08:00
|
|
|
end, false)
|
|
|
|
|
|
2026-01-16 02:57:26 -07:00
|
|
|
if Bridge.Framework.GetResourceName() == 'es_extended' then
|
|
|
|
|
function handleGang(gang)
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
function handleGang(gang)
|
|
|
|
|
if not gang then
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
if #gang == 0 then
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
local data = Bridge.Framework.GetPlayerData()
|
|
|
|
|
if not data.gang then
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
return data.gang.name == gang
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function progressbar(text, time, emote, cancel)
|
|
|
|
|
local success = Bridge.ProgressBar.Open({
|
2026-01-21 21:27:08 -07:00
|
|
|
duration = time or 5000,
|
|
|
|
|
label = text or 'LAZY AF DEVS',
|
2026-01-16 02:57:26 -07:00
|
|
|
canCancel = true,
|
2026-01-21 21:27:08 -07:00
|
|
|
disable = cancel or Config.ProgressBar.Disables,
|
|
|
|
|
anim = emote or Config.DefaultAnimation,
|
2026-01-16 02:57:26 -07:00
|
|
|
})
|
|
|
|
|
return success
|
2026-01-21 21:27:08 -07:00
|
|
|
end
|
2026-01-21 22:02:25 -07:00
|
|
|
|
|
|
|
|
function itemCheck(item)
|
|
|
|
|
if not Bridge.Inventory.HasItem(item) then
|
|
|
|
|
Bridge.Notify.SendNotify(Bridge.Language.Locale('Catches.itemMissings', Bridge.Inventory.GetItemInfo(item).label), 'error')
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
return true
|
|
|
|
|
end
|