1
0
Fork 0
forked from Simnation/Main
This commit is contained in:
Nordi98 2025-07-11 23:16:30 +02:00
parent c571bcb450
commit 561715960d
4 changed files with 58 additions and 27 deletions

View file

@ -1,3 +1,4 @@
local QBCore = exports['qb-core']:GetCoreObject()
local isActive = false local isActive = false
-- Hauptfunktion -- Hauptfunktion
@ -26,6 +27,7 @@ local function StartDynamiteFishing()
-- Skill-Check -- Skill-Check
if not lib.skillCheck(Config.SkillCheck.difficulty, Config.SkillCheck.keys) then if not lib.skillCheck(Config.SkillCheck.difficulty, Config.SkillCheck.keys) then
TriggerServerEvent('dynamitefishing:removeItem') TriggerServerEvent('dynamitefishing:removeItem')
isActive = false
return QBCore.Functions.Notify('Fehlgeschlagen!', 'error') return QBCore.Functions.Notify('Fehlgeschlagen!', 'error')
end end
@ -39,6 +41,22 @@ local function StartDynamiteFishing()
local coords = GetEntityCoords(ped) local coords = GetEntityCoords(ped)
AddExplosion(coords.x, coords.y, coords.z, Config.Explosion.type, Config.Explosion.volume, true, false, Config.Explosion.cameraShake) 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') TriggerServerEvent('dynamitefishing:reward')
ClearPedTasks(ped) ClearPedTasks(ped)
isActive = false isActive = false
@ -49,5 +67,12 @@ end
-- Befehl registrieren -- Befehl registrieren
RegisterCommand('dynamitefish', StartDynamiteFishing) RegisterCommand('dynamitefish', StartDynamiteFishing)
-- Tastaturbindung (Optional) -- Item-Nutzung registrieren
-- RegisterKeyMapping('dynamitefish', 'Dynamite Fishing', 'keyboard', 'e') 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)

View file

@ -30,19 +30,21 @@ Config.Explosion = {
cameraShake = true cameraShake = true
} }
-- POLICE ALERT -- POLICE ALERT (PS-DISPATCH)
Config.Police = { Config.Police = {
enable = true, enable = true,
alertChance = 70, alertChance = 80, -- % Chance für Alarm
blipSettings = { message = "Illegales Dynamitfischen gemeldet",
sprite = 436, codeName = "dynamitefishing",
color = 1, code = "10-66",
duration = 30 -- Sekunden icon = "fas fa-fish",
} priority = 2
} }
-- REWARDS -- REWARDS
Config.FishRewards = { Config.FishRewards = {
{ name = 'fish', chance = 75, amount = {1, 3} }, { name = 'salmon', chance = 75, amount = {1, 3} },
{ name = 'shark', chance = 15, amount = 1 } { name = 'tuna', chance = 75, amount = {1, 3} },
{ name = 'trout', chance = 20, amount = {1, 2} },
{ name = 'pufferfish', chance = 5, amount = 1 }
} }

View file

@ -2,31 +2,25 @@ fx_version 'cerulean'
game 'gta5' game 'gta5'
author 'YourName' 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' version '1.0.0'
shared_scripts { shared_scripts {
'@qb-core/shared/locale.lua', '@qb-core/shared/locale.lua',
'config.lua', -- (Optional: if you separate settings) 'config.lua',
} }
client_scripts { client_scripts {
'@ox_lib/init.lua', -- Required for skill checks '@ox_lib/init.lua',
'client/cl_dynamitefishing.lua' 'client/cl_dynamitefishing.lua'
} }
server_scripts { server_scripts {
'@oxmysql/lib/MySQL.lua', -- Needed if using QB-Core database
'server/sv_dynamitefishing.lua' 'server/sv_dynamitefishing.lua'
} }
dependencies { dependencies {
'qb-core', -- Required for QB framework 'qb-core',
'ox_lib', -- Required for skill checks 'ox_lib',
'qb-policejob' -- Needed for police alerts (optional) 'ps-dispatch'
} }
-- Uncomment if using custom assets (explosion effects, sounds)
-- files {
-- 'audio/dynamite_explosion.ogg',
-- }

View file

@ -1,3 +1,4 @@
local QBCore = exports['qb-core']:GetCoreObject()
local cooldowns = {} local cooldowns = {}
-- Item-Check Callback -- Item-Check Callback
@ -27,18 +28,27 @@ RegisterNetEvent('dynamitefishing:reward', function()
end end
-- Belohnungen geben -- Belohnungen geben
local rewardGiven = false
for _, reward in ipairs(Config.FishRewards) do for _, reward in ipairs(Config.FishRewards) do
if math.random(1, 100) <= reward.chance then 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 local amount = type(reward.amount) == 'table' and math.random(reward.amount[1], reward.amount[2]) or reward.amount
player.Functions.AddItem(reward.name, amount) player.Functions.AddItem(reward.name, amount)
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items[reward.name], 'add') TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items[reward.name], 'add')
rewardGiven = true
break
end end
end end
-- Polizeialarm -- Fallback-Belohnung, falls keine andere gegeben wurde
if Config.Police.enable and math.random(1, 100) <= Config.Police.alertChance then if not rewardGiven then
-- Hier deinen Police-Alert-Trigger einfügen player.Functions.AddItem('fish_common', 1)
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items['fish_common'], 'add')
end end
cooldowns[src] = os.time() cooldowns[src] = os.time()
end) end)
-- Item-Nutzung registrieren
QBCore.Functions.CreateUseableItem(Config.RequiredItem, function(source)
TriggerClientEvent('dynamitefishing:useItem', source)
end)