1
0
Fork 0
forked from Simnation/Main
This commit is contained in:
Nordi98 2025-07-30 00:27:25 +02:00
parent 00910d1237
commit 0f392143e5
11 changed files with 329 additions and 14 deletions

View file

@ -712,32 +712,57 @@ RegisterNetEvent('vending:client:startRobbery', function(coords)
end
end)
-- Police alert
RegisterNetEvent('vending:client:policeAlert', function(coords, streetName)
local alert = {
title = "Verkaufsautomat Aufbruch",
coords = coords,
description = "Ein Verkaufsautomat wird aufgebrochen in " .. streetName
}
-- Police alert with ox_lib notification and blinking blip
RegisterNetEvent('vending:client:policeAlert', function(alertData)
-- Extract data
local coords = alertData.coords
local locationName = alertData.locationName
-- Add blip
-- Create a blinking blip
local blip = AddBlipForCoord(coords.x, coords.y, coords.z)
SetBlipSprite(blip, 161)
SetBlipColour(blip, 1)
SetBlipScale(blip, 1.0)
SetBlipSprite(blip, 161) -- Robbery icon
SetBlipColour(blip, 1) -- Red color
SetBlipScale(blip, 1.2)
SetBlipAsShortRange(blip, false)
-- Make the blip flash
SetBlipFlashes(blip, true)
SetBlipFlashInterval(blip, 200) -- Flash interval in milliseconds
-- Set blip name
BeginTextCommandSetBlipName("STRING")
AddTextComponentString("Verkaufsautomat Aufbruch")
EndTextCommandSetBlipName(blip)
-- Create route to the robbery
SetBlipRoute(blip, true)
SetBlipRouteColour(blip, 1) -- Red route
-- Show ox_lib notification
if lib and lib.notify then
lib.notify({
title = 'Verkaufsautomat Aufbruch',
description = 'Ein Verkaufsautomat wird aufgebrochen bei ' .. locationName,
type = 'error',
icon = 'fas fa-mask',
position = 'top-right',
duration = 8000
})
else
-- Fallback to QBCore notification if ox_lib is not available
QBCore.Functions.Notify('Verkaufsautomat Aufbruch gemeldet: ' .. locationName, 'error', 8000)
end
-- Play alert sound
PlaySound(-1, "Lose_1st", "GTAO_FM_Events_Soundset", 0, 0, 1)
-- Remove blip after 5 minutes
SetTimeout(300000, function()
RemoveBlip(blip)
end)
QBCore.Functions.Notify('Verkaufsautomat Aufbruch gemeldet: ' .. streetName, 'error', 8000)
end)
-- Management menu (alternative opening method)
RegisterNetEvent('vending:client:openManagement', function(machine)
-- Fast check for management permissions

View file

@ -523,10 +523,20 @@ RegisterNetEvent('vending:server:startRobbery', function(coords)
-- Alert police - use a generic location name instead of street name
local locationName = "Verkaufsautomat #" .. machineId
-- Get player position for more accurate location
local playerPos = GetEntityCoords(GetPlayerPed(src))
-- Alert police with enhanced data
local alertData = {
coords = coords,
locationName = locationName,
machineId = machineId
}
local players = QBCore.Functions.GetQBPlayers()
for k, v in pairs(players) do
if v.PlayerData.job.name == 'police' and v.PlayerData.job.onduty then
TriggerClientEvent('vending:client:policeAlert', v.PlayerData.source, coords, locationName)
TriggerClientEvent('vending:client:policeAlert', v.PlayerData.source, alertData)
end
end
@ -550,6 +560,7 @@ RegisterNetEvent('vending:server:startRobbery', function(coords)
TriggerClientEvent('vending:client:startRobbery', src, coords)
end)
-- Complete robbery
RegisterNetEvent('vending:server:completeRobbery', function(coords, success)
local src = source