diff --git a/resources/[jobs]/[crime]/nordi_dynamitefishing/client/cl_dynamitefishing.lua b/resources/[jobs]/[crime]/nordi_dynamitefishing/client/cl_dynamitefishing.lua index 08e435e6d..239cb271f 100644 --- a/resources/[jobs]/[crime]/nordi_dynamitefishing/client/cl_dynamitefishing.lua +++ b/resources/[jobs]/[crime]/nordi_dynamitefishing/client/cl_dynamitefishing.lua @@ -1,3 +1,4 @@ +local QBCore = exports['qb-core']:GetCoreObject() local isActive = false -- Hauptfunktion @@ -26,6 +27,7 @@ local function StartDynamiteFishing() -- Skill-Check if not lib.skillCheck(Config.SkillCheck.difficulty, Config.SkillCheck.keys) then TriggerServerEvent('dynamitefishing:removeItem') + isActive = false return QBCore.Functions.Notify('Fehlgeschlagen!', 'error') end @@ -39,6 +41,22 @@ local function StartDynamiteFishing() local coords = GetEntityCoords(ped) AddExplosion(coords.x, coords.y, coords.z, Config.Explosion.type, Config.Explosion.volume, true, false, Config.Explosion.cameraShake) + -- PS-DISPATCH ALERT + if Config.Police.enable and math.random(1, 100) <= Config.Police.alertChance then + -- PS-Dispatch Alert + 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' } + }) + end + + TriggerServerEvent('dynamitefishing:removeItem') TriggerServerEvent('dynamitefishing:reward') ClearPedTasks(ped) isActive = false @@ -49,5 +67,12 @@ end -- Befehl registrieren RegisterCommand('dynamitefish', StartDynamiteFishing) --- Tastaturbindung (Optional) --- RegisterKeyMapping('dynamitefish', 'Dynamite Fishing', 'keyboard', 'e') +-- Item-Nutzung registrieren +RegisterNetEvent('dynamitefishing:useItem', function() + StartDynamiteFishing() +end) + +-- Item-Nutzung mit QB-Core verbinden +RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function() + TriggerEvent('inventory:client:ItemBox', QBCore.Shared.Items[Config.RequiredItem], 'add') +end) diff --git a/resources/[jobs]/[crime]/nordi_dynamitefishing/config.lua b/resources/[jobs]/[crime]/nordi_dynamitefishing/config.lua index b479f9d24..bf8c627f0 100644 --- a/resources/[jobs]/[crime]/nordi_dynamitefishing/config.lua +++ b/resources/[jobs]/[crime]/nordi_dynamitefishing/config.lua @@ -30,19 +30,21 @@ Config.Explosion = { cameraShake = true } --- POLICE ALERT +-- POLICE ALERT (PS-DISPATCH) Config.Police = { enable = true, - alertChance = 70, - blipSettings = { - sprite = 436, - color = 1, - duration = 30 -- Sekunden - } + alertChance = 80, -- % Chance für Alarm + message = "Illegales Dynamitfischen gemeldet", + codeName = "dynamitefishing", + code = "10-66", + icon = "fas fa-fish", + priority = 2 } -- REWARDS Config.FishRewards = { - { name = 'fish', chance = 75, amount = {1, 3} }, - { name = 'shark', chance = 15, amount = 1 } + { name = 'salmon', chance = 75, amount = {1, 3} }, + { name = 'tuna', chance = 75, amount = {1, 3} }, + { name = 'trout', chance = 20, amount = {1, 2} }, + { name = 'pufferfish', chance = 5, amount = 1 } } diff --git a/resources/[jobs]/[crime]/nordi_dynamitefishing/fxmanifest.lua b/resources/[jobs]/[crime]/nordi_dynamitefishing/fxmanifest.lua index 34a567e37..709398812 100644 --- a/resources/[jobs]/[crime]/nordi_dynamitefishing/fxmanifest.lua +++ b/resources/[jobs]/[crime]/nordi_dynamitefishing/fxmanifest.lua @@ -2,31 +2,25 @@ fx_version 'cerulean' game 'gta5' author 'YourName' -description 'QB-Core Dynamite Fishing Script using Pipe Bombs and ox_lib Skill Checks' +description 'QB-Core Dynamite Fishing Script mit PS-Dispatch Integration' version '1.0.0' shared_scripts { '@qb-core/shared/locale.lua', - 'config.lua', -- (Optional: if you separate settings) + 'config.lua', } client_scripts { - '@ox_lib/init.lua', -- Required for skill checks + '@ox_lib/init.lua', 'client/cl_dynamitefishing.lua' } server_scripts { - '@oxmysql/lib/MySQL.lua', -- Needed if using QB-Core database 'server/sv_dynamitefishing.lua' } dependencies { - 'qb-core', -- Required for QB framework - 'ox_lib', -- Required for skill checks - 'qb-policejob' -- Needed for police alerts (optional) + 'qb-core', + 'ox_lib', + 'ps-dispatch' } - --- Uncomment if using custom assets (explosion effects, sounds) --- files { --- 'audio/dynamite_explosion.ogg', --- } diff --git a/resources/[jobs]/[crime]/nordi_dynamitefishing/server/sv_dynamitefishing.lua b/resources/[jobs]/[crime]/nordi_dynamitefishing/server/sv_dynamitefishing.lua index 617f58896..5d7f65842 100644 --- a/resources/[jobs]/[crime]/nordi_dynamitefishing/server/sv_dynamitefishing.lua +++ b/resources/[jobs]/[crime]/nordi_dynamitefishing/server/sv_dynamitefishing.lua @@ -1,3 +1,4 @@ +local QBCore = exports['qb-core']:GetCoreObject() local cooldowns = {} -- Item-Check Callback @@ -27,18 +28,27 @@ RegisterNetEvent('dynamitefishing:reward', function() end -- Belohnungen geben + local rewardGiven = false for _, reward in ipairs(Config.FishRewards) do if math.random(1, 100) <= reward.chance then local amount = type(reward.amount) == 'table' and math.random(reward.amount[1], reward.amount[2]) or reward.amount player.Functions.AddItem(reward.name, amount) TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items[reward.name], 'add') + rewardGiven = true + break end end - - -- Polizeialarm - if Config.Police.enable and math.random(1, 100) <= Config.Police.alertChance then - -- Hier deinen Police-Alert-Trigger einfügen + + -- Fallback-Belohnung, falls keine andere gegeben wurde + if not rewardGiven then + player.Functions.AddItem('fish_common', 1) + TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items['fish_common'], 'add') end cooldowns[src] = os.time() end) + +-- Item-Nutzung registrieren +QBCore.Functions.CreateUseableItem(Config.RequiredItem, function(source) + TriggerClientEvent('dynamitefishing:useItem', source) +end)