1
0
Fork 0
forked from Simnation/Main
This commit is contained in:
Nordi98 2025-07-11 23:51:04 +02:00
parent 30d02ee495
commit a1469c3c3c
2 changed files with 43 additions and 22 deletions

View file

@ -38,6 +38,41 @@ local function IsPlayerFacingWater()
return false
end
-- Funktion für den Polizei-Alarm (ähnlich wie MagnetFishing)
local function DynamiteFishingAlert(coords)
local gender = GetPlayerGender()
local streetName = GetStreetAndZone(coords)
local message = "^3Illegale Aktivität^7: Person beim Dynamitfischen"
local description = "Eine " .. gender .. " Person wurde beim Dynamitfischen gesehen. Explosion im Wasser gemeldet!"
local priority = 2
local blipSprite = 436 -- Explosion Blip
local blipColour = 1 -- Rot
local icon = 'fas fa-bomb'
local dispatchData = {
message = message,
codeName = 'dynamitefishing',
code = '10-67',
icon = icon,
priority = priority,
coords = coords,
gender = gender,
street = streetName,
alertTime = 5000,
blipSprite = blipSprite,
blipColour = blipColour,
blipScale = 1.0,
blipLength = 2 * 60000, -- 2 Minuten
sound = 'Lose_1st',
soundName = 'GTAO_FM_Events_Soundset',
infoM = description,
jobs = { 'police' }
}
TriggerServerEvent('ps-dispatch:server:notify', dispatchData)
end
-- Hauptfunktion
local function StartDynamiteFishing()
local ped = PlayerPedId()
@ -58,12 +93,12 @@ local function StartDynamiteFishing()
QBCore.Functions.TriggerCallback('dynamitefishing:checkItem', function(hasItem)
if not hasItem then
isActive = false
return QBCore.Functions.Notify('Du brauchst eine Rohrbombe!', 'error')
return QBCore.Functions.Notify('Du brauchst Dynamit!', 'error')
end
-- Wurf-Animation
local throwDict = "anim@mp_fireworks"
local throwAnim = "place_firework_3_box"
local throwDict = "weapons@projectile@grenade_str"
local throwAnim = "throw_h_fb_backward"
RequestAnimDict(throwDict)
while not HasAnimDictLoaded(throwDict) do
@ -78,7 +113,7 @@ local function StartDynamiteFishing()
if not lib.skillCheck(Config.SkillCheck.difficulty, Config.SkillCheck.keys) then
TriggerServerEvent('dynamitefishing:removeItem')
isActive = false
return QBCore.Functions.Notify('Fehlgeschlagen! Die Bombe ist ins Wasser gefallen.', 'error')
return QBCore.Functions.Notify('Fehlgeschlagen! Das Dynamit ist ins Wasser gefallen.', 'error')
end
-- Berechne Position für Explosion (etwas vor dem Spieler im Wasser)
@ -87,23 +122,14 @@ local function StartDynamiteFishing()
local radians = math.rad(heading)
local explosionX = coords.x + 8.0 * math.sin(-radians)
local explosionY = coords.y + 8.0 * math.cos(-radians)
local explosionZ = coords.z - 1.0 -- Etwas unter der Wasseroberfläche
local explosionZ = coords.z - 3.0 -- Etwas unter der Wasseroberfläche
-- EXPLOSION DIREKT NACH ERFOLGREICHEM SKILL CHECK
AddExplosion(explosionX, explosionY, explosionZ, Config.Explosion.type, Config.Explosion.volume, true, false, Config.Explosion.cameraShake)
-- PS-DISPATCH ALERT
-- PS-DISPATCH ALERT mit dem Format aus alerts.lua
if Config.Police.enable and math.random(1, 100) <= Config.Police.alertChance then
exports['ps-dispatch']:CustomAlert({
message = Config.Police.message,
dispatchCode = Config.Police.codeName,
code = Config.Police.code,
icon = Config.Police.icon,
priority = Config.Police.priority,
coords = coords,
gender = GetPlayerGender(), -- Nutzt die Funktion aus ps-dispatch
jobs = { 'police' }
})
DynamiteFishingAlert(coords)
end
-- Item entfernen (nach erfolgreicher Explosion)

View file

@ -20,12 +20,7 @@ Config.Explosion = {
-- POLICE ALERT (PS-DISPATCH)
Config.Police = {
enable = true,
alertChance = 80, -- % Chance für Alarm
message = "Illegales Dynamitfischen gemeldet",
codeName = "dynamitefishing",
code = "10-67",
icon = "fas fa-fish",
priority = 2
alertChance = 80 -- % Chance für Alarm
}