forked from Simnation/Main
Update main.lua
This commit is contained in:
parent
baef534533
commit
79a5801e62
1 changed files with 27 additions and 4 deletions
|
@ -22,6 +22,28 @@ local seatNames = {
|
||||||
[9] = "Deck 6"
|
[9] = "Deck 6"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- Funktion um aktuellen Sitz zu bekommen
|
||||||
|
local function getCurrentSeat(ped, vehicle)
|
||||||
|
if not IsPedInVehicle(ped, vehicle, false) then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Prüfe Fahrersitz
|
||||||
|
if GetPedInVehicleSeat(vehicle, -1) == ped then
|
||||||
|
return -1
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Prüfe Passagiersitze
|
||||||
|
local maxSeats = GetVehicleMaxNumberOfPassengers(vehicle)
|
||||||
|
for i = 0, maxSeats - 1 do
|
||||||
|
if GetPedInVehicleSeat(vehicle, i) == ped then
|
||||||
|
return i
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
-- Prüfe ob Fahrzeug ein Boot ist
|
-- Prüfe ob Fahrzeug ein Boot ist
|
||||||
local function isBoat(vehicle)
|
local function isBoat(vehicle)
|
||||||
local vehicleClass = GetVehicleClass(vehicle)
|
local vehicleClass = GetVehicleClass(vehicle)
|
||||||
|
@ -78,6 +100,7 @@ local function toggleAnchor(vehicle)
|
||||||
|
|
||||||
-- Kleine Wellen-Animation
|
-- Kleine Wellen-Animation
|
||||||
for i = 1, 5 do
|
for i = 1, 5 do
|
||||||
|
local coords = GetEntityCoords(vehicle)
|
||||||
local waterHeight = GetWaterHeight(coords.x, coords.y, coords.z)
|
local waterHeight = GetWaterHeight(coords.x, coords.y, coords.z)
|
||||||
if waterHeight then
|
if waterHeight then
|
||||||
-- Erstelle Wasser-Effekt um das Boot
|
-- Erstelle Wasser-Effekt um das Boot
|
||||||
|
@ -90,7 +113,7 @@ local function toggleAnchor(vehicle)
|
||||||
for j = 1, 3 do
|
for j = 1, 3 do
|
||||||
local offsetX = math.random(-200, 200) / 100
|
local offsetX = math.random(-200, 200) / 100
|
||||||
local offsetY = math.random(-200, 200) / 100
|
local offsetY = math.random(-200, 200) / 100
|
||||||
UsePartikelFxAssetNextCall(effect)
|
UseParticleFxAssetNextCall(effect)
|
||||||
StartParticleFxNonLoopedAtCoord("ent_sht_water", coords.x + offsetX, coords.y + offsetY, waterHeight, 0.0, 0.0, 0.0, 0.5, false, false, false)
|
StartParticleFxNonLoopedAtCoord("ent_sht_water", coords.x + offsetX, coords.y + offsetY, waterHeight, 0.0, 0.0, 0.0, 0.5, false, false, false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -313,7 +336,7 @@ local function showSeatMenu(vehicle)
|
||||||
|
|
||||||
-- Anker-Kontrolle (nur für Boote und nur wenn im Boot)
|
-- Anker-Kontrolle (nur für Boote und nur wenn im Boot)
|
||||||
if isVehicleBoat and isInVehicle then
|
if isVehicleBoat and isInVehicle then
|
||||||
local currentSeat = GetPedVehicleSeat(playerPed)
|
local currentSeat = getCurrentSeat(playerPed, vehicle)
|
||||||
-- Nur Kapitän kann Anker bedienen
|
-- Nur Kapitän kann Anker bedienen
|
||||||
if currentSeat == -1 then
|
if currentSeat == -1 then
|
||||||
table.insert(options, {
|
table.insert(options, {
|
||||||
|
@ -571,8 +594,8 @@ RegisterCommand('anchor', function()
|
||||||
local vehicle = GetVehiclePedIsIn(playerPed, false)
|
local vehicle = GetVehiclePedIsIn(playerPed, false)
|
||||||
|
|
||||||
if vehicle ~= 0 and isBoat(vehicle) then
|
if vehicle ~= 0 and isBoat(vehicle) then
|
||||||
local seat = GetPedVehicleSeat(playerPed)
|
local currentSeat = getCurrentSeat(playerPed, vehicle)
|
||||||
if seat == -1 then -- Nur Kapitän
|
if currentSeat == -1 then -- Nur Kapitän
|
||||||
toggleAnchor(vehicle)
|
toggleAnchor(vehicle)
|
||||||
else
|
else
|
||||||
QBCore.Functions.Notify('Nur der Kapitän kann den Anker bedienen!', 'error')
|
QBCore.Functions.Notify('Nur der Kapitän kann den Anker bedienen!', 'error')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue