diff --git a/resources/[tools]/nordi_dj/client/main.lua b/resources/[tools]/nordi_dj/client/main.lua index 69368b2fd..b5cae487d 100644 --- a/resources/[tools]/nordi_dj/client/main.lua +++ b/resources/[tools]/nordi_dj/client/main.lua @@ -192,6 +192,13 @@ end) RegisterNUICallback('djInterfaceClosed', function(data, cb) SetNuiFocus(false, false) isUIOpen = false + + -- Kurze Verzögerung, um sicherzustellen, dass alle Animationen abgeschlossen sind + Wait(100) + + -- Aktiviere alle Controls wieder + EnableAllControlActions(0) + cb('ok') end) @@ -241,6 +248,64 @@ RegisterNUICallback('songEnded', function(data, cb) cb('ok') end) +RegisterNUICallback('loadTrack', function(data, cb) + if data.deck and data.track then + -- Lade Track in Deck + if data.deck == "A" or data.deck == "B" then + -- Hier könntest du zusätzliche Logik hinzufügen + cb({success = true}) + else + cb({success = false, error = "Ungültiges Deck"}) + end + else + cb({success = false, error = "Fehlende Daten"}) + end +end) + +RegisterNUICallback('playTrack', function(data, cb) + if data.deck and data.track then + -- Spiele Track ab + PlayMusicAsDJ(data.track.title, data.track.url, currentVolume) + cb({success = true}) + else + cb({success = false, error = "Fehlende Daten"}) + end +end) + +RegisterNUICallback('getPlaylists', function(data, cb) + -- Hole Playlists vom Server + QBCore.Functions.TriggerCallback('dj:server:getPlaylists', function(playlists) + cb({success = true, playlists = playlists}) + end) +end) + +RegisterNUICallback('createPlaylist', function(data, cb) + if data.name then + -- Erstelle Playlist + TriggerServerEvent('dj:server:createPlaylist', data.name, data.description, data.isPublic) + cb({success = true}) + else + cb({success = false, error = "Fehlender Name"}) + end +end) + +RegisterNUICallback('addToPlaylist', function(data, cb) + if data.playlistId and data.track then + -- Füge Track zu Playlist hinzu + TriggerServerEvent('dj:server:addSongToPlaylist', data.playlistId, data.track) + cb({success = true}) + else + cb({success = false, error = "Fehlende Daten"}) + end +end) + +RegisterNUICallback('getSessionHistory', function(data, cb) + -- Hole Session-Historie vom Server + QBCore.Functions.TriggerCallback('dj:server:getSessionHistory', function(history) + cb({success = true, history = history}) + end, data.limit) +end) + -- Functions function CanUseDJScript() if not Config.UseJobRestriction then @@ -283,6 +348,10 @@ function OpenDJInterface() DisableAllControlActions(0) EnableControlAction(0, 1, true) -- Mouse look EnableControlAction(0, 2, true) -- Mouse look + EnableControlAction(0, 3, true) -- Mouse movement + EnableControlAction(0, 4, true) -- Mouse movement + EnableControlAction(0, 5, true) -- Mouse wheel + EnableControlAction(0, 6, true) -- Mouse wheel Wait(0) end end) @@ -388,7 +457,7 @@ end -- Regelmäßige Prüfung der Distanz zu DJ-Booths und aktiven Musiken CreateThread(function() while true do - Wait(Config.DistanceVolume.updateInterval) + Wait(Config.DistanceVolume and Config.DistanceVolume.updateInterval or 1000) local playerCoords = GetEntityCoords(PlayerPedId()) local foundBooth = false @@ -560,62 +629,3 @@ if Config.Debug then end end) end - --- NUI Callbacks für das DJ-Interface -RegisterNUICallback('loadTrack', function(data, cb) - if data.deck and data.track then - -- Lade Track in Deck - if data.deck == "A" or data.deck == "B" then - -- Hier könntest du zusätzliche Logik hinzufügen - cb({success = true}) - else - cb({success = false, error = "Ungültiges Deck"}) - end - else - cb({success = false, error = "Fehlende Daten"}) - end -end) - -RegisterNUICallback('playTrack', function(data, cb) - if data.deck and data.track then - -- Spiele Track ab - PlayMusicAsDJ(data.track.title, data.track.url, currentVolume) - cb({success = true}) - else - cb({success = false, error = "Fehlende Daten"}) - end -end) - -RegisterNUICallback('getPlaylists', function(data, cb) - -- Hole Playlists vom Server - QBCore.Functions.TriggerCallback('dj:server:getPlaylists', function(playlists) - cb({success = true, playlists = playlists}) - end) -end) - -RegisterNUICallback('createPlaylist', function(data, cb) - if data.name then - -- Erstelle Playlist - TriggerServerEvent('dj:server:createPlaylist', data.name, data.description, data.isPublic) - cb({success = true}) - else - cb({success = false, error = "Fehlender Name"}) - end -end) - -RegisterNUICallback('addToPlaylist', function(data, cb) - if data.playlistId and data.track then - -- Füge Track zu Playlist hinzu - TriggerServerEvent('dj:server:addSongToPlaylist', data.playlistId, data.track) - cb({success = true}) - else - cb({success = false, error = "Fehlende Daten"}) - end -end) - -RegisterNUICallback('getSessionHistory', function(data, cb) - -- Hole Session-Historie vom Server - QBCore.Functions.TriggerCallback('dj:server:getSessionHistory', function(history) - cb({success = true, history = history}) - end, data.limit) -end)