forked from Simnation/Main
Update main.lua
This commit is contained in:
parent
7ecdc5330d
commit
124e30ddab
1 changed files with 7 additions and 22 deletions
|
@ -124,29 +124,11 @@ local function toggleAnchor(vehicle)
|
||||||
|
|
||||||
QBCore.Functions.Notify('⚓ Anker gelichtet! Das Boot kann wieder bewegt werden.', 'success')
|
QBCore.Functions.Notify('⚓ Anker gelichtet! Das Boot kann wieder bewegt werden.', 'success')
|
||||||
else
|
else
|
||||||
-- Anker werfen (ohne Sound und Effekte)
|
-- Anker werfen (ohne Sound und Effekte)
|
||||||
local coords = GetEntityCoords(vehicle)
|
local coords = GetEntityCoords(vehicle)
|
||||||
local heading = GetEntityHeading(vehicle)
|
local heading = GetEntityHeading(vehicle)
|
||||||
|
|
||||||
-- Finde die Wasseroberfläche unter dem Boot
|
|
||||||
local waterHeight = GetWaterHeightNoWaves(coords.x, coords.y, coords.z)
|
|
||||||
|
|
||||||
-- Wenn kein Wasser gefunden wurde, nutze eine alternative Methode
|
|
||||||
if waterHeight == 0 then
|
|
||||||
-- Versuche mit TestVerticalProbeAgainstAllWater
|
|
||||||
local success, height = TestVerticalProbeAgainstAllWater(coords.x, coords.y, coords.z, 0, coords.z - 10.0)
|
|
||||||
if success then
|
|
||||||
waterHeight = height
|
|
||||||
else
|
|
||||||
-- Fallback: Setze Boot leicht unter aktuelle Position
|
|
||||||
waterHeight = coords.z - 0.5
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Setze das Boot auf die Wasseroberfläche mit leichtem Offset
|
|
||||||
SetEntityCoords(vehicle, coords.x, coords.y, waterHeight)
|
|
||||||
coords = GetEntityCoords(vehicle) -- Aktualisiere Koordinaten nach Positionsänderung
|
|
||||||
|
|
||||||
|
-- Keine Höhenanpassung - Boot bleibt genau da, wo es ist
|
||||||
FreezeEntityPosition(vehicle, true)
|
FreezeEntityPosition(vehicle, true)
|
||||||
SetEntityInvincible(vehicle, true)
|
SetEntityInvincible(vehicle, true)
|
||||||
|
|
||||||
|
@ -161,6 +143,9 @@ anchoredBoats[vehicleNetId] = anchorData
|
||||||
-- Speichere auf Server
|
-- Speichere auf Server
|
||||||
saveAnchorToServer(vehicle, anchorData)
|
saveAnchorToServer(vehicle, anchorData)
|
||||||
|
|
||||||
|
QBCore.Functions.Notify('⚓ Anker geworfen! Das Boot ist jetzt verankert.', 'success')
|
||||||
|
|
||||||
|
|
||||||
QBCore.Functions.Notify('⚓ Anker geworfen! Das Boot ist jetzt verankert.', 'success')
|
QBCore.Functions.Notify('⚓ Anker geworfen! Das Boot ist jetzt verankert.', 'success')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue