diff --git a/resources/[tools]/nordi_taxi/client/main.lua b/resources/[tools]/nordi_taxi/client/main.lua index e58d0e5e9..2df2c47a3 100644 --- a/resources/[tools]/nordi_taxi/client/main.lua +++ b/resources/[tools]/nordi_taxi/client/main.lua @@ -450,8 +450,11 @@ RegisterNetEvent('taxi:enterTaxi', function() -- Warten bis eingestiegen CreateThread(function() local timeout = GetGameTimer() + 10000 - while GetGameTimer() < timeout do + local entered = false + + while GetGameTimer() < timeout and not entered do if IsPedInVehicle(playerPed, currentTaxi, false) then + entered = true print("^2[TAXI DEBUG]^7 Player entered taxi successfully") -- qb-target entfernen @@ -466,13 +469,22 @@ RegisterNetEvent('taxi:enterTaxi', function() -- Ziel-Menu öffnen Wait(1000) OpenDestinationMenu() - break end Wait(100) end + + if not entered then + print("^1[TAXI DEBUG]^7 Player failed to enter taxi") + lib.notify({ + title = 'Taxi Service', + description = 'Einsteigen fehlgeschlagen', + type = 'error' + }) + end end) end) + function OpenDestinationMenu() print("^2[TAXI DEBUG]^7 Opening destination menu") @@ -782,6 +794,99 @@ RegisterCommand('stoptaxi', function() end end) +-- Thread zum Öffnen des Menüs mit Taste, wenn im Taxi +CreateThread(function() + while true do + Wait(0) + + if currentTaxi and DoesEntityExist(currentTaxi) then + local playerPed = PlayerPedId() + + if IsPedInVehicle(playerPed, currentTaxi, false) then + -- Zeige Hinweis an + lib.showTextUI('[E] - Ziel wählen', { + position = "top-center", + icon = 'map-marker', + style = { + borderRadius = 10, + backgroundColor = '#48BB78', + color = 'white' + } + }) + + -- Wenn E gedrückt wird, öffne Menü + if IsControlJustReleased(0, 38) then -- E Taste + OpenDestinationMenu() + end + else + lib.hideTextUI() + end + else + lib.hideTextUI() + Wait(1000) -- Längere Wartezeit wenn kein Taxi existiert + end + end +end) + + +-- Thread zum Überwachen des Einsteigens ins Taxi (ohne qb-target) +CreateThread(function() + while true do + Wait(1000) + + if currentTaxi and DoesEntityExist(currentTaxi) and not IsPedInVehicle(PlayerPedId(), currentTaxi, false) then + -- Spieler ist nicht im Taxi, aber Taxi existiert + local playerPed = PlayerPedId() + local playerCoords = GetEntityCoords(playerPed) + local taxiCoords = GetEntityCoords(currentTaxi) + + if #(playerCoords - taxiCoords) < 5.0 then + -- Spieler ist in der Nähe des Taxis + lib.showTextUI('[E] - Ins Taxi einsteigen', { + position = "top-center", + icon = 'car-side', + style = { + borderRadius = 10, + backgroundColor = '#4299E1', + color = 'white' + } + }) + + if IsControlJustReleased(0, 38) then -- E Taste + -- Spieler will einsteigen + lib.hideTextUI() + + -- Spieler hinten einsteigen lassen + local seatIndex = 1 -- Hinten links + if not IsVehicleSeatFree(currentTaxi, 1) then + seatIndex = 2 -- Hinten rechts + end + if not IsVehicleSeatFree(currentTaxi, seatIndex) then + seatIndex = 0 -- Beifahrer als Fallback + end + + TaskEnterVehicle(playerPed, currentTaxi, 10000, seatIndex, 1.0, 1, 0) + + -- Warten bis eingestiegen + local entryTimeout = GetGameTimer() + 10000 + while GetGameTimer() < entryTimeout do + if IsPedInVehicle(playerPed, currentTaxi, false) then + -- Spieler ist eingestiegen + Wait(1000) + OpenDestinationMenu() + break + end + Wait(100) + end + end + else + lib.hideTextUI() + end + end + end +end) + + -- Cleanup beim Resource Stop AddEventHandler('onResourceStop', function(resourceName) if GetCurrentResourceName() == resourceName then diff --git a/resources/[tools]/nordi_taxi/config.lua b/resources/[tools]/nordi_taxi/config.lua index 848c58915..fbf3cda76 100644 --- a/resources/[tools]/nordi_taxi/config.lua +++ b/resources/[tools]/nordi_taxi/config.lua @@ -47,7 +47,7 @@ Config.TaxiStations = { }, { model = 'taxi', - coords = vector4(919.23, -163.87, 74.77, 102.32), + coords = vector4(899.74, -180.99, 73.86, 247.36), pricePerKm = 5 } }