forked from Simnation/Main
Update main.lua
This commit is contained in:
parent
4bba6b7dd5
commit
3ec4b4c27b
1 changed files with 51 additions and 4 deletions
|
@ -794,7 +794,7 @@ RegisterCommand('stoptaxi', function()
|
|||
end
|
||||
end)
|
||||
|
||||
-- Thread zum Öffnen des Menüs mit Taste, wenn im Taxi
|
||||
-- Thread zum Überwachen der Tasten im Taxi
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Wait(0)
|
||||
|
@ -803,10 +803,11 @@ CreateThread(function()
|
|||
local playerPed = PlayerPedId()
|
||||
|
||||
if IsPedInVehicle(playerPed, currentTaxi, false) then
|
||||
-- Zeige Hinweis an
|
||||
lib.showTextUI('[E] - Ziel wählen', {
|
||||
-- Zeige Hinweise an
|
||||
local helpText = '[E] - Ziel wählen [F] - Fahrt beenden'
|
||||
lib.showTextUI(helpText, {
|
||||
position = "top-center",
|
||||
icon = 'map-marker',
|
||||
icon = 'taxi',
|
||||
style = {
|
||||
borderRadius = 10,
|
||||
backgroundColor = '#48BB78',
|
||||
|
@ -818,6 +819,12 @@ CreateThread(function()
|
|||
if IsControlJustReleased(0, 38) then -- E Taste
|
||||
OpenDestinationMenu()
|
||||
end
|
||||
|
||||
-- Wenn F gedrückt wird, beende Fahrt
|
||||
if IsControlJustReleased(0, 23) then -- F Taste
|
||||
lib.hideTextUI()
|
||||
EndTaxiRide()
|
||||
end
|
||||
else
|
||||
lib.hideTextUI()
|
||||
end
|
||||
|
@ -828,6 +835,45 @@ CreateThread(function()
|
|||
end
|
||||
end)
|
||||
|
||||
-- Funktion zum Beenden der Fahrt
|
||||
function EndTaxiRide()
|
||||
print("^2[TAXI DEBUG]^7 Ending taxi ride")
|
||||
|
||||
if not currentTaxi or not DoesEntityExist(currentTaxi) then
|
||||
return
|
||||
end
|
||||
|
||||
local playerPed = PlayerPedId()
|
||||
|
||||
-- Fahrt beenden Benachrichtigung
|
||||
lib.notify({
|
||||
title = 'Taxi Service',
|
||||
description = 'Fahrt beendet. Du steigst aus.',
|
||||
type = 'info'
|
||||
})
|
||||
|
||||
-- Spieler aussteigen lassen
|
||||
TaskLeaveVehicle(playerPed, currentTaxi, 0)
|
||||
|
||||
-- Warten bis ausgestiegen
|
||||
CreateThread(function()
|
||||
local timeout = GetGameTimer() + 5000
|
||||
while GetGameTimer() < timeout do
|
||||
if not IsPedInVehicle(playerPed, currentTaxi, false) then
|
||||
-- Spieler ist ausgestiegen
|
||||
break
|
||||
end
|
||||
Wait(100)
|
||||
end
|
||||
|
||||
-- Taxi nach 5 Sekunden despawnen
|
||||
SetTimeout(5000, function()
|
||||
DespawnTaxi()
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- Thread zum Überwachen des Einsteigens ins Taxi (ohne qb-target)
|
||||
CreateThread(function()
|
||||
|
@ -887,6 +933,7 @@ CreateThread(function()
|
|||
end)
|
||||
|
||||
|
||||
|
||||
-- Cleanup beim Resource Stop
|
||||
AddEventHandler('onResourceStop', function(resourceName)
|
||||
if GetCurrentResourceName() == resourceName then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue