forked from Simnation/Main
Update stations.lua
This commit is contained in:
parent
774d8834c2
commit
6344067f37
1 changed files with 24 additions and 5 deletions
|
@ -118,6 +118,22 @@ function SpawnStationVehicle(stationId, vehicleId, vehicleData)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Hilfsfunktion um Spieler-Sitz zu ermitteln
|
||||||
|
function GetPlayerVehicleSeat(ped, vehicle)
|
||||||
|
if not IsPedInVehicle(ped, vehicle, false) then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Alle möglichen Sitze prüfen
|
||||||
|
for seat = -1, 7 do -- -1 = Fahrer, 0 = Beifahrer, 1+ = Hintersitze
|
||||||
|
if GetPedInVehicleSeat(vehicle, seat) == ped then
|
||||||
|
return seat
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
-- Event für Einsteigen in Station-Taxi
|
-- Event für Einsteigen in Station-Taxi
|
||||||
RegisterNetEvent('taxi:enterStationVehicle', function(data)
|
RegisterNetEvent('taxi:enterStationVehicle', function(data)
|
||||||
print("^2[TAXI STATIONS DEBUG]^7 Player trying to enter station vehicle")
|
print("^2[TAXI STATIONS DEBUG]^7 Player trying to enter station vehicle")
|
||||||
|
@ -158,7 +174,7 @@ RegisterNetEvent('taxi:enterStationVehicle', function(data)
|
||||||
SetVehicleDoorsLocked(vehicle, 1)
|
SetVehicleDoorsLocked(vehicle, 1)
|
||||||
|
|
||||||
-- Info-Text anzeigen während Fahrer geladen wird
|
-- Info-Text anzeigen während Fahrer geladen wird
|
||||||
lib.showTextUI('🚕 Fahrer ist noch aufm Pott, bitte warte kurz...', {
|
lib.showTextUI('🚕 Fahrer wird geladen, bitte warten...', {
|
||||||
position = "top-center",
|
position = "top-center",
|
||||||
icon = 'taxi',
|
icon = 'taxi',
|
||||||
style = {
|
style = {
|
||||||
|
@ -263,12 +279,12 @@ RegisterNetEvent('taxi:enterStationVehicle', function(data)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Spieler HINTEN einsteigen lassen
|
-- Spieler HINTEN einsteigen lassen
|
||||||
local seatIndex = -1 -- Hinten rechts
|
local seatIndex = 1 -- Hinten links als Standard
|
||||||
|
|
||||||
-- Prüfen welche Hintersitze verfügbar sind
|
-- Prüfen welche Hintersitze verfügbar sind
|
||||||
local availableSeats = {}
|
local availableSeats = {}
|
||||||
for i = 1, 3 do -- Sitze 1, 2, 3 (hinten links, hinten mitte, hinten rechts)
|
for i = 1, 3 do -- Sitze 1, 2, 3 (hinten links, hinten mitte, hinten rechts)
|
||||||
if not IsVehicleSeatFree(vehicle, i) == false then
|
if IsVehicleSeatFree(vehicle, i) then
|
||||||
table.insert(availableSeats, i)
|
table.insert(availableSeats, i)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -314,12 +330,15 @@ RegisterNetEvent('taxi:enterStationVehicle', function(data)
|
||||||
print("^2[TAXI STATIONS DEBUG]^7 Player entered successfully")
|
print("^2[TAXI STATIONS DEBUG]^7 Player entered successfully")
|
||||||
|
|
||||||
-- Prüfen ob Spieler wirklich hinten sitzt
|
-- Prüfen ob Spieler wirklich hinten sitzt
|
||||||
local playerSeat = GetPedVehicleSeat(playerPed)
|
local playerSeat = GetPlayerVehicleSeat(playerPed, vehicle)
|
||||||
|
print("^2[TAXI STATIONS DEBUG]^7 Player is in seat: " .. tostring(playerSeat))
|
||||||
|
|
||||||
if playerSeat == -1 then -- Fahrersitz
|
if playerSeat == -1 then -- Fahrersitz
|
||||||
print("^3[TAXI STATIONS DEBUG]^7 Player is in driver seat, moving to passenger area")
|
print("^3[TAXI STATIONS DEBUG]^7 Player is in driver seat, moving to passenger area")
|
||||||
|
|
||||||
if driver and DoesEntityExist(driver) then
|
if driver and DoesEntityExist(driver) then
|
||||||
-- Spieler zum Beifahrersitz bewegen
|
-- Spieler zum nächsten verfügbaren Sitz bewegen
|
||||||
|
Wait(1000)
|
||||||
TaskShuffleToNextVehicleSeat(playerPed, vehicle)
|
TaskShuffleToNextVehicleSeat(playerPed, vehicle)
|
||||||
Wait(2000)
|
Wait(2000)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue