forked from Simnation/Main
ed
This commit is contained in:
parent
c571bcb450
commit
561715960d
4 changed files with 58 additions and 27 deletions
|
@ -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)
|
||||
|
|
|
@ -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 }
|
||||
}
|
||||
|
|
|
@ -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',
|
||||
-- }
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue