forked from Simnation/Main
Update stations.lua
This commit is contained in:
parent
375bd7489a
commit
c9febb2a97
1 changed files with 63 additions and 0 deletions
|
@ -1223,6 +1223,68 @@ function EndStationTaxiRide(stationId, vehicleId, vehicle, driver)
|
|||
end)
|
||||
end
|
||||
|
||||
-- Thread zum Überwachen der Tasten im Stations-Taxi
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Wait(0)
|
||||
|
||||
local playerPed = PlayerPedId()
|
||||
local inStationTaxi = false
|
||||
local currentStationTaxi = nil
|
||||
local currentStationId = nil
|
||||
local currentVehicleId = nil
|
||||
local currentDriver = nil
|
||||
local pricePerKm = 0
|
||||
|
||||
-- Prüfen ob Spieler in einem Stations-Taxi sitzt
|
||||
for stationId, vehicles in pairs(stationVehicles) do
|
||||
for vehicleId, vehicleInfo in pairs(vehicles) do
|
||||
if vehicleInfo.entity and DoesEntityExist(vehicleInfo.entity) and vehicleInfo.occupied then
|
||||
if IsPedInVehicle(playerPed, vehicleInfo.entity, false) then
|
||||
inStationTaxi = true
|
||||
currentStationTaxi = vehicleInfo.entity
|
||||
currentStationId = stationId
|
||||
currentVehicleId = vehicleId
|
||||
currentDriver = vehicleInfo.driver
|
||||
pricePerKm = vehicleInfo.data.pricePerKm
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
if inStationTaxi then break end
|
||||
end
|
||||
|
||||
if inStationTaxi and currentStationTaxi then
|
||||
-- Zeige Hinweise an
|
||||
local helpText = '[E] - Ziel wählen [F] - Fahrt beenden'
|
||||
lib.showTextUI(helpText, {
|
||||
position = "top-center",
|
||||
icon = 'taxi',
|
||||
style = {
|
||||
borderRadius = 10,
|
||||
backgroundColor = '#48BB78',
|
||||
color = 'white'
|
||||
}
|
||||
})
|
||||
|
||||
-- Wenn E gedrückt wird, öffne Menü
|
||||
if IsControlJustReleased(0, 38) then -- E Taste
|
||||
OpenStationTaxiMenu(currentStationId, currentVehicleId, currentStationTaxi, currentDriver, pricePerKm)
|
||||
end
|
||||
|
||||
-- Wenn F gedrückt wird, beende Fahrt
|
||||
if IsControlJustReleased(0, 23) then -- F Taste
|
||||
lib.hideTextUI()
|
||||
EndStationTaxiRide(currentStationId, currentVehicleId, currentStationTaxi, currentDriver)
|
||||
end
|
||||
else
|
||||
-- Nicht in einem Stations-Taxi
|
||||
lib.hideTextUI()
|
||||
Wait(1000)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
-- Cleanup beim Resource Stop
|
||||
AddEventHandler('onResourceStop', function(resourceName)
|
||||
|
@ -1255,6 +1317,7 @@ AddEventHandler('onResourceStop', function(resourceName)
|
|||
end)
|
||||
|
||||
|
||||
|
||||
-- Cleanup beim Resource Stop
|
||||
AddEventHandler('onResourceStop', function(resourceName)
|
||||
if GetCurrentResourceName() == resourceName then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue