Hey how are you?
I need help with a script from me, namely I am trying to design a multi-function spawn point for my garage script but unfortunately all the time here are my code snippets:
RegisterNUICallback('parkout', function(data, cb)
local playerCoords = GetEntityCoords(PlayerPedId())
if tonumber(data.impound) == 1 then
if data.gtype == "impound" then
elseif data.gtype == "impoundair" then
elseif data.gtype == "impoundsea" then
else
TriggerEvent("blx_notify", "#ff0000", "FAHRZEUGVERWALTUNG", "Dein Fahrzeug befindet sich momentan auf dem Abschlepphof!")
end
else
ESX.TriggerServerCallback('blx_garage:getSpawnPoints', function(success, points)
if success then
if tonumber(data.stored) == 1 then
local foundSpawn, spawnPoint = GetAvailableVehicleSpawnPoint(points)
if foundSpawn then
menu2.close()
ESX.Game.SpawnVehicle(data.model, vector3(spawnPoint.x, spawnPoint.y, spawnPoint.z), spawnPoint.heading, function(vehicle)
local vehicleProps = data.props
ESX.Game.SetVehicleProperties(vehicle, vehicleProps)
TriggerServerEvent('esx_vehicleshop:spawnVehicle', data.plate, false)
TriggerEvent("blx_notify", "#2c14ff", "FAHRZEUGVERWALTUNG", "Raus")
end)
end
else
TriggerEvent("blx_notify", "#2c14ff", "FAHRZEUGVERWALTUNG", "Nicht verfügbar")
end
else
end
end, data.gid)
end
toggleField(false)
SetNuiFocus(false, false)
cb('ok')
end)
function GetAvailableVehicleSpawnPoint(points)
local spawnPoints = points
local found, foundSpawnPoint = false, nil
for i=1, #spawnPoints, 1 do
local x = tonumber(spawnPoints.x)
local y = tonumber(spawnPoints.y)
local z = tonumber(spawnPoints.z)
local coords = vector3(tonumber(spawnPoints.x), tonumber(spawnPoints.y), tonumber(spawnPoints.z))
if ESX.Game.IsSpawnPointClear(coords, spawnPoints.radius) then
found, foundSpawnPoint = true, spawnPoints
break
end
end
if found then
return true, foundSpawnPoint
else
TriggerEvent("blx_notify", "#2c14ff", "FAHRZEUGVERWALTUNG", "Blockiert")
return false
end
end
Can u help me please?