1
0
Fork 0
forked from Simnation/Main

Update fireworks.lua

This commit is contained in:
Nordi98 2025-07-02 17:20:48 +02:00
parent 0926c09684
commit 517a9ed97c

View file

@ -7,7 +7,7 @@ local fireworkModels = {
["firework1"] = "ind_prop_firework_01", -- Rakete für firework1
["firework2"] = "ind_prop_firework_04", -- Standard-Batterie für firework2
["firework3"] = "ind_prop_firework_03", -- Große Batterie für firework3
["firework4"] = "prop_firework_03" -- Alternative Batterie für firework4
["firework4"] = "prop_firework_03" -- Alternative Batterie für firework4 (Fontäne)
}
-- Verbesserte Feuerwerkseffekte ohne Flammen
@ -162,6 +162,146 @@ local function launchFireworkRocket(coords)
DeleteEntity(rocket)
end
-- Funktion für eine kreischende Fontäne (firework4)
local function launchFireworkFountain(coords)
-- Lade das Fontänenmodell
local fountainModel = "prop_firework_03"
RequestModel(GetHashKey(fountainModel))
while not HasModelLoaded(GetHashKey(fountainModel)) do
Wait(10)
end
-- Erstelle die Fontäne
local fountain = CreateObject(GetHashKey(fountainModel),
coords.x, coords.y, coords.z - 0.5,
true, true, false)
-- Stelle die Fontäne richtig auf den Boden
PlaceObjectOnGroundProperly(fountain)
FreezeEntityPosition(fountain, true)
-- Warte kurz, damit die Fontäne sichtbar ist
Wait(500)
-- Lade die Feuerwerkseffekte
local ptfxAssets = {
"scr_indep_fireworks",
"core"
}
for _, asset in ipairs(ptfxAssets) do
RequestNamedPtfxAsset(asset)
while not HasNamedPtfxAssetLoaded(asset) do
Wait(10)
end
end
-- Füge einen Zündungseffekt hinzu
UseParticleFxAssetNextCall("scr_indep_fireworks")
local ignitionEffect = StartParticleFxLoopedOnEntity("scr_indep_firework_sparkle_spawn",
fountain, 0.0, 0.0, 0.2, 0.0, 0.0, 0.0, 0.5, false, false, false)
-- Zündungsgeräusch
PlaySoundFromEntity(-1, "DISTANT_FIREWORK_LAUNCH_01", fountain, "dlc_sum20_beach_party_sounds", true, 20)
-- Warte kurz für den Zündungseffekt
Wait(1000)
-- Stoppe den Zündungseffekt
StopParticleFxLooped(ignitionEffect, 0)
-- Starte die Fontäne
print("Starte kreischende Fontäne")
-- Dauer der Fontäne
local fountainDuration = 15000 -- 15 Sekunden
local startTime = GetGameTimer()
-- Haupteffekt der Fontäne (kontinuierlich)
UseParticleFxAssetNextCall("scr_indep_fireworks")
local mainEffect = StartParticleFxLoopedOnEntity("scr_indep_firework_fountain",
fountain, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 2.0, false, false, false)
-- Kreischendes Geräusch in Schleife
local lastSoundTime = 0
-- Fontänen-Schleife
while GetGameTimer() - startTime < fountainDuration do
-- Füge zusätzliche Funkeneffekte hinzu
if math.random(1, 100) > 70 then -- 30% Chance pro Frame
UseParticleFxAssetNextCall("scr_indep_fireworks")
StartParticleFxNonLoopedOnEntity(
"scr_indep_firework_sparkle_spawn",
fountain,
math.random(-10, 10) / 10, math.random(-10, 10) / 10, math.random(5, 15) / 10,
0.0, 0.0, 0.0,
math.random(10, 20) / 10,
false, false, false
)
end
-- Kreischendes Geräusch alle 500-1500ms
if GetGameTimer() - lastSoundTime > math.random(500, 1500) then
-- Wähle zufällig zwischen verschiedenen Geräuschen
local sounds = {
"POLICE_SIREN_WAIL", -- Kreischendes Geräusch
"CAR_BOMB_TICK", -- Tickendes Geräusch
"DISTANT_FIREWORK_LAUNCH_01" -- Startgeräusch
}
local sound = sounds[math.random(1, #sounds)]
PlaySoundFromEntity(-1, sound, fountain, "dlc_sum20_beach_party_sounds", true, math.random(10, 30))
lastSoundTime = GetGameTimer()
end
-- Intensivere Effekte gegen Ende
local progress = (GetGameTimer() - startTime) / fountainDuration
if progress > 0.7 and math.random(1, 100) > 50 then -- 50% Chance in der letzten Phase
-- Zusätzliche Funken in verschiedenen Höhen
UseParticleFxAssetNextCall("core")
StartParticleFxNonLoopedOnEntity(
"ent_sht_electrical_box_sp",
fountain,
0.0, 0.0, math.random(5, 20) / 10,
0.0, 0.0, 0.0,
math.random(15, 25) / 10,
false, false, false
)
end
Wait(0)
end
-- Stoppe den Haupteffekt
StopParticleFxLooped(mainEffect, 0)
-- Finale der Fontäne
print("Fontänen-Finale")
-- Mehrere intensive Funkeneffekte für das Finale
for i = 1, 10 do
UseParticleFxAssetNextCall("scr_indep_fireworks")
StartParticleFxNonLoopedOnEntity(
"scr_indep_firework_starburst",
fountain,
0.0, 0.0, math.random(5, 15) / 10,
0.0, 0.0, 0.0,
math.random(15, 25) / 10,
false, false, false
)
-- Finale-Geräusch
PlaySoundFromEntity(-1, "DISTANT_FIREWORK_BURST_0" .. math.random(1, 3),
fountain, "dlc_sum20_beach_party_sounds", true, 40)
Wait(math.random(100, 300))
end
-- Lösche die Fontäne nach einer Weile
Wait(2000)
DeleteEntity(fountain)
end
-- Funktion zum Starten einer Feuerwerks-Batterie ohne Flammeneffekte
local function startFireworkBattery(coords, itemName)
-- Wähle ein Batteriemodell basierend auf dem Item
@ -223,8 +363,6 @@ local function startFireworkBattery(coords, itemName)
numShots = 30 -- Mehr Schüsse für firework3 (große Batterie)
elseif itemName == "firework2" then
numShots = 15 -- Standard für firework2
elseif itemName == "firework4" then
numShots = 20 -- Etwas mehr für firework4
end
print("Starte Feuerwerks-Batterie mit " .. numShots .. " Schüssen")
@ -419,6 +557,9 @@ local function startFirework(asset, coords, itemName)
if itemName == "firework1" then
-- Rakete für firework1
launchFireworkRocket(coords)
elseif itemName == "firework4" then
-- Kreischende Fontäne für firework4
launchFireworkFountain(coords)
else
-- Batterie für alle anderen
startFireworkBattery(coords, itemName)
@ -527,6 +668,8 @@ RegisterCommand('feuerwerk', function(source, args)
-- Starte das passende Feuerwerk
if itemName == "firework1" then
launchFireworkRocket(coords)
elseif itemName == "firework4" then
launchFireworkFountain(coords)
else
startFireworkBattery(coords, itemName)
end
@ -583,3 +726,21 @@ RegisterCommand('grossebatterie', function()
-- Starte die große Batterie (firework3)
startFireworkBattery(coords, "firework3")
end)
RegisterCommand('fontaene', function()
local playerPed = PlayerPedId()
local coords = GetEntityCoords(playerPed)
-- Überprüfe zuerst, ob der Spieler ein Feuerzeug hat
if not hasLighter() then
QBCore.Functions.Notify(Lang:t('firework.no_lighter'), 'error')
return
end
-- Spiele die Feuerzeug-Animation ab
playLighterAnimation()
-- Starte die kreischende Fontäne (firework4)
launchFireworkFountain(coords)
end)