Vorab sorry wenn es der falsche Bereich ist habe grade keinen anderen dafür gefunden.
Hey Leute habe eine Frage bezüglich FiveM scripting (genauer lua client side)
Ich habe IsPedInAnyVehicle öfters schon benutzt aber warum auch immer
geht es genau bei dem Script nicht? Vielleicht sieht ja jemand den Fehler.
Es soll einfach nicht durch rattern wenn man in einem Fahrzeug ist
was es dennoch tut. mit else und return habe ich es auch
schon probiert.
Keine Errors etc vorhanden.
Das X makiert die Stelle
8. Zeile
Danke im Voraus.
Mit freundlichen Grüßen,
MAVERICK.
Code
- Citizen.CreateThread(function()
- while ESX == nil do TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) Wait(0) end
- while not NetworkIsSessionStarted() or ESX.GetPlayerData().job == nil do Wait(0) end
- while true do
- local vehicle = GetClosestVehicle(GetEntityCoords(PlayerPedId()), 10.0, 0, 70)
- local playerPed = PlayerPedId()
- if DoesEntityExist(vehicle) and IsPedInAnyVehicle(playerPed, false) then -- X
- local trunk = GetEntityBoneIndexByName(vehicle, 'boot')
- if trunk ~= -1 then
- local coords = GetWorldPositionOfEntityBone(vehicle, trunk)
- if GetDistanceBetweenCoords(GetEntityCoords(PlayerPedId()), coords, true) <= 2.5 then
- if not inTrunk then
- if GetVehicleDoorAngleRatio(vehicle, 5) < 0.9 then
- DrawText3D(coords, '[ . ] Hide in trunk\n[H] Open trunk')
- if IsControlJustReleased(0, 81) then
- SetCarBootOpen(vehicle)
- end
- else
- DrawText3D(coords, '[ . ] Hide in trunk\n[H] Close trunk')
- if IsControlJustReleased(0, 81) then
- SetVehicleDoorShut(vehicle, 5)
- end
- end
- end
- if IsControlJustReleased(0, 81) and not inTrunk then
- local player = ESX.Game.GetClosestPlayer()
- local playerPed = GetPlayerPed(player)
- if DoesEntityExist(playerPed) then
- if not IsEntityAttached(playerPed) or GetDistanceBetweenCoords(GetEntityCoords(playerPed), GetEntityCoords(PlayerPedId()), true) >= 5.0 then
- SetCarBootOpen(vehicle)
- Wait(350)
- AttachEntityToEntity(PlayerPedId(), vehicle, -1, 0.0, -2.2, 0.5, 0.0, 0.0, 0.0, false, false, false, false, 20, true)
- loadDict('timetable@floyd@cryingonbed@base')
- TaskPlayAnim(PlayerPedId(), 'timetable@floyd@cryingonbed@base', 'base', 8.0, -8.0, -1, 1, 0, false, false, false)
- Wait(50)
- inTrunk = true
- Wait(1500)
- SetVehicleDoorShut(vehicle, 5)
- else
- ESX.ShowNotification('Someone is already hiding in that vehicle!')
- end
- end
- end
- end
- end
- end
- Wait(0)
- end
- end)