1
0
Fork 0
forked from Simnation/Main
This commit is contained in:
Nordi98 2025-07-11 23:09:42 +02:00
parent c0b8baa515
commit c571bcb450
4 changed files with 177 additions and 0 deletions

View file

@ -0,0 +1,53 @@
local isActive = false
-- Hauptfunktion
local function StartDynamiteFishing()
local ped = PlayerPedId()
-- Prüfungen
if isActive or not IsEntityInWater(ped) then
return QBCore.Functions.Notify('Nicht möglich!', 'error')
end
isActive = true
-- Item-Check
QBCore.Functions.TriggerCallback('dynamitefishing:checkItem', function(hasItem)
if not hasItem then
isActive = false
return QBCore.Functions.Notify('Du brauchst eine Rohrbombe!', 'error')
end
-- Wurf-Animation
lib.playAnim(Config.Animations.throw.dict, Config.Animations.throw.anim, Config.Animations.throw.flag)
Wait(1500)
ClearPedTasks(ped)
-- Skill-Check
if not lib.skillCheck(Config.SkillCheck.difficulty, Config.SkillCheck.keys) then
TriggerServerEvent('dynamitefishing:removeItem')
return QBCore.Functions.Notify('Fehlgeschlagen!', 'error')
end
-- Erfolgreich: Sammel-Animation
lib.playAnim(Config.Animations.collect.dict, Config.Animations.collect.anim, Config.Animations.collect.flag)
QBCore.Functions.Progressbar('dynamite_fishing', 'Fische sammeln...', 5000, false, true, {
disableMovement = true,
disableCarMovement = true
}, {}, {}, {}, function()
local coords = GetEntityCoords(ped)
AddExplosion(coords.x, coords.y, coords.z, Config.Explosion.type, Config.Explosion.volume, true, false, Config.Explosion.cameraShake)
TriggerServerEvent('dynamitefishing:reward')
ClearPedTasks(ped)
isActive = false
end)
end, Config.RequiredItem)
end
-- Befehl registrieren
RegisterCommand('dynamitefish', StartDynamiteFishing)
-- Tastaturbindung (Optional)
-- RegisterKeyMapping('dynamitefish', 'Dynamite Fishing', 'keyboard', 'e')

View file

@ -0,0 +1,48 @@
Config = {}
-- CORE SETTINGS
Config.RequiredItem = 'weapon_pipebomb' -- Item für Dynamite Fishing
Config.Cooldown = 120 -- Cooldown in Sekunden
-- ANIMATIONS
Config.Animations = {
throw = {
dict = 'mp_weapon_explosive',
anim = 'throw_b',
flag = 49
},
collect = {
dict = 'amb@world_human_stand_fishing@idle_a',
anim = 'idle_c',
flag = 1
}
}
-- GAMEPLAY
Config.SkillCheck = {
difficulty = {'easy', 'easy', 'medium'}, -- OxLib Skill-Check
keys = {'w', 'a', 's', 'd'}
}
Config.Explosion = {
type = 29, -- EXPLOSION_PIPEBOMB
volume = 1.0,
cameraShake = true
}
-- POLICE ALERT
Config.Police = {
enable = true,
alertChance = 70,
blipSettings = {
sprite = 436,
color = 1,
duration = 30 -- Sekunden
}
}
-- REWARDS
Config.FishRewards = {
{ name = 'fish', chance = 75, amount = {1, 3} },
{ name = 'shark', chance = 15, amount = 1 }
}

View file

@ -0,0 +1,32 @@
fx_version 'cerulean'
game 'gta5'
author 'YourName'
description 'QB-Core Dynamite Fishing Script using Pipe Bombs and ox_lib Skill Checks'
version '1.0.0'
shared_scripts {
'@qb-core/shared/locale.lua',
'config.lua', -- (Optional: if you separate settings)
}
client_scripts {
'@ox_lib/init.lua', -- Required for skill checks
'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)
}
-- Uncomment if using custom assets (explosion effects, sounds)
-- files {
-- 'audio/dynamite_explosion.ogg',
-- }

View file

@ -0,0 +1,44 @@
local cooldowns = {}
-- Item-Check Callback
QBCore.Functions.CreateCallback('dynamitefishing:checkItem', function(source, cb, item)
local player = QBCore.Functions.GetPlayer(source)
cb(player and player.Functions.GetItemByName(item) ~= nil)
end)
-- Item-Entfernung
RegisterNetEvent('dynamitefishing:removeItem', function()
local src = source
local player = QBCore.Functions.GetPlayer(src)
if player then
player.Functions.RemoveItem(Config.RequiredItem, 1)
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items[Config.RequiredItem], 'remove')
end
end)
-- Belohnungssystem
RegisterNetEvent('dynamitefishing:reward', function()
local src = source
local player = QBCore.Functions.GetPlayer(src)
-- Cooldown-Check
if cooldowns[src] and os.time() - cooldowns[src] < Config.Cooldown then
return QBCore.Functions.Notify(src, string.format('Warte %s Sekunden!', Config.Cooldown), 'error')
end
-- Belohnungen geben
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')
end
end
-- Polizeialarm
if Config.Police.enable and math.random(1, 100) <= Config.Police.alertChance then
-- Hier deinen Police-Alert-Trigger einfügen
end
cooldowns[src] = os.time()
end)