SpawnVehicle = function(vehicleProps, durum, garajNoData)
if inCekilmis then
QBCore.Functions.TriggerCallback("haso-araccek-aracalma", function(sure)
for k, v in ipairs(sure) do
print(v.alinabilme)
if v.alinabilme ~= nil then
QBCore.Functions.TriggerCallback("haso-araccek-sureyicek", function(zaman)
local time = (v.alinabilme - zaman)
print('sa' ..time)
if time <= 0 then
-- if garajNoData == cachedData["currentGarage"] or inCekilmis or inMeslek then
local playerPed = PlayerPedId()
local spawnpoint = GetEntityCoords(playerPed)
local spawnheading = GetEntityHeading(playerPed)
if Config.Garages[tonumber(cachedData["currentGarage"])]["sPosition"] then
spawnpoint = Config.Garages[tonumber(cachedData["currentGarage"])]["sPosition"]
spawnheading = Config.Garages[tonumber(cachedData["currentGarage"])]["sHeading"]
end
if not QBCore.Functions.IsSpawnPointClear(spawnpoint, 3.0) then
QBCore.Functions.Notify("Yakınlardaki Araç Yüzünden Araç Çıkarılamıyor.")
return
end
WaitForModel(vehicleProps["model"])
local gameVehicles = QBCore.Functions.GetVehicles()
for i = 1, #gameVehicles do
local vehicle = gameVehicles[i]
if DoesEntityExist(vehicle) then
if QBCore.Shared.Trim(GetVehicleNumberPlateText(vehicle)) == QBCore.Shared.Trim(vehicleProps["plate"]) then
QBCore.Functions.Notify("Aracın Zaten Dışarıda Bir Yerde.")
return
end
end
end
QBCore.Functions.SpawnVehicle(vehicleProps["model"], function(yourVehicle)
QBCore.Functions.SetVehicleProperties(yourVehicle, vehicleProps)
NetworkFadeInEntity(yourVehicle, true, true)
SetModelAsNoLongerNeeded(vehicleProps["model"])
TaskWarpPedIntoVehicle(PlayerPedId(), yourVehicle, -1)
SetVehicleHasBeenOwnedByPlayer(yourVehicle, true)
local id = NetworkGetNetworkIdFromEntity(yourVehicle)
SetNetworkIdCanMigrate(id, true)
QBCore.Functions.Notify("Araç çıkarıldı.")
if durum == "cekilmis" then
TriggerServerEvent("tgiann-garaj:arac-cekilmistemi", cachedData["currentGarage"], vehicleProps["plate"], 0, AracCekilmis)
elseif durum == "cekilmis-bot" then
TriggerServerEvent("tgiann-garaj:arac-cekilmistemi", cachedData["currentGarage"], vehicleProps["plate"], 0, BotCekilmis)
elseif durum == "cekilmis-ucak" then
TriggerServerEvent("tgiann-garaj:arac-cekilmistemi", cachedData["currentGarage"], vehicleProps["plate"], 0, UcakCekilmis)
else
TriggerServerEvent("tgiann-garaj:arac-cekilmistemi", cachedData["currentGarage"], vehicleProps["plate"], 0)
end
TriggerEvent("x-hotwire:give-keys", yourVehicle)
CloseMenu()
while not GetIsVehicleEngineRunning(yourVehicle) do Citizen.Wait(100) end
Citizen.Wait(100)
if durum == "cekilmis" or durum == "cekilmis-bot" or durum == "cekilmis-ucak" or durum == "cekilmis-ucak" or durum == "bot" then
SetVehicleFuelLevel(yourVehicle, 25.0)
DecorSetFloat(yourVehicle, "_FUEL_LEVEL", 25.0)
repairCar(yourVehicle)
else
SetVehicleFuelLevel(yourVehicle, vehicleProps["fuelLevel"]+0.0)
DecorSetFloat(yourVehicle, "_FUEL_LEVEL", vehicleProps["fuelLevel"]+0.0)
end
end, {x=spawnpoint.x, y=spawnpoint.y, z=spawnpoint.z, h=spawnheading}, true) -- coords, isnetwork
-- else
-- QBCore.Functions.Notify("Aracın Bu Garajda Değil! Aracın Bulunduğu Garaj GPS'de İşaretlendi!", "error")
-- local coords = Config.Garages[tonumber(garajNoData)]["blip"]
-- SetNewWaypoint(coords.x, coords.y)
-- end
else
QBCore.Functions.Notify("Bu araç polis tarafından süreli bir şekilde çekilmiş. Şuan alamazsın", "error")
QBCore.Functions.Notify('Bu aracı '.. QBCore.Shared.Round(((v.alinabilme-zaman)/60)/60,2) .. ' Saat Sonra Alabilirsin')
return
end
end)
else
if garajNoData == cachedData["currentGarage"] or inCekilmis or inMeslek then
local playerPed = PlayerPedId()
local spawnpoint = GetEntityCoords(playerPed)
local spawnheading = GetEntityHeading(playerPed)
if Config.Garages[tonumber(cachedData["currentGarage"])]["sPosition"] then
spawnpoint = Config.Garages[tonumber(cachedData["currentGarage"])]["sPosition"]
spawnheading = Config.Garages[tonumber(cachedData["currentGarage"])]["sHeading"]
end
if not QBCore.Functions.IsSpawnPointClear(spawnpoint, 3.0) then
QBCore.Functions.Notify("Yakınlardaki Araç Yüzünden Araç Çıkarılamıyor.")
return
end
WaitForModel(vehicleProps["model"])
local gameVehicles = QBCore.Functions.GetVehicles()
for i = 1, #gameVehicles do
local vehicle = gameVehicles[i]
if DoesEntityExist(vehicle) then
if QBCore.Shared.Trim(GetVehicleNumberPlateText(vehicle)) == QBCore.Shared.Trim(vehicleProps["plate"]) then
QBCore.Functions.Notify("Aracın Zaten Dışarıda Bir Yerde.")
return
end
end
end
QBCore.Functions.SpawnVehicle(vehicleProps["model"], function(yourVehicle)
QBCore.Functions.SetVehicleProperties(yourVehicle, vehicleProps)
NetworkFadeInEntity(yourVehicle, true, true)
SetModelAsNoLongerNeeded(vehicleProps["model"])
TaskWarpPedIntoVehicle(PlayerPedId(), yourVehicle, -1)
SetVehicleHasBeenOwnedByPlayer(yourVehicle, true)
local id = NetworkGetNetworkIdFromEntity(yourVehicle)
SetNetworkIdCanMigrate(id, true)
QBCore.Functions.Notify("Araç çıkarıldı.")
if durum == "cekilmis" then
TriggerServerEvent("tgiann-garaj:arac-cekilmistemi", cachedData["currentGarage"], vehicleProps["plate"], 0, AracCekilmis)
elseif durum == "cekilmis-bot" then
TriggerServerEvent("tgiann-garaj:arac-cekilmistemi", cachedData["currentGarage"], vehicleProps["plate"], 0, BotCekilmis)
elseif durum == "cekilmis-ucak" then
TriggerServerEvent("tgiann-garaj:arac-cekilmistemi", cachedData["currentGarage"], vehicleProps["plate"], 0, UcakCekilmis)
else
TriggerServerEvent("tgiann-garaj:arac-cekilmistemi", cachedData["currentGarage"], vehicleProps["plate"], 0)
end
TriggerEvent("x-hotwire:give-keys", yourVehicle)
CloseMenu()
while not GetIsVehicleEngineRunning(yourVehicle) do Citizen.Wait(100) end
Citizen.Wait(100)
if durum == "cekilmis" or durum == "cekilmis-bot" or durum == "cekilmis-ucak" or durum == "cekilmis-ucak" or durum == "bot" then
SetVehicleFuelLevel(yourVehicle, 25.0)
DecorSetFloat(yourVehicle, "_FUEL_LEVEL", 25.0)
repairCar(yourVehicle)
else
SetVehicleFuelLevel(yourVehicle, vehicleProps["fuelLevel"]+0.0)
DecorSetFloat(yourVehicle, "_FUEL_LEVEL", vehicleProps["fuelLevel"]+0.0)
end
end, {x=spawnpoint.x, y=spawnpoint.y, z=spawnpoint.z, h=spawnheading}, true) -- coords, isnetwork
else
QBCore.Functions.Notify("Aracın Bu Garajda Değil! Aracın Bulunduğu Garaj GPS'de İşaretlendi!", "error")
local coords = Config.Garages[tonumber(garajNoData)]["blip"]
SetNewWaypoint(coords.x, coords.y)
end
end
end
end, vehicleProps.plate)
else
if garajNoData == cachedData["currentGarage"] or inCekilmis or inMeslek then
local playerPed = PlayerPedId()
local spawnpoint = GetEntityCoords(playerPed)
local spawnheading = GetEntityHeading(playerPed)
if Config.Garages[tonumber(cachedData["currentGarage"])]["sPosition"] then
spawnpoint = Config.Garages[tonumber(cachedData["currentGarage"])]["sPosition"]
spawnheading = Config.Garages[tonumber(cachedData["currentGarage"])]["sHeading"]
end
if not QBCore.Functions.IsSpawnPointClear(spawnpoint, 3.0) then
QBCore.Functions.Notify("Yakınlardaki Araç Yüzünden Araç Çıkarılamıyor.")
return
end
WaitForModel(vehicleProps["model"])
local gameVehicles = QBCore.Functions.GetVehicles()
for i = 1, #gameVehicles do
local vehicle = gameVehicles[i]
if DoesEntityExist(vehicle) then
if QBCore.Shared.Trim(GetVehicleNumberPlateText(vehicle)) == QBCore.Shared.Trim(vehicleProps["plate"]) then
QBCore.Functions.Notify("Aracın Zaten Dışarıda Bir Yerde.")
return
end
end
end
QBCore.Functions.SpawnVehicle(vehicleProps["model"], function(yourVehicle)
QBCore.Functions.SetVehicleProperties(yourVehicle, vehicleProps)
NetworkFadeInEntity(yourVehicle, true, true)
SetModelAsNoLongerNeeded(vehicleProps["model"])
TaskWarpPedIntoVehicle(PlayerPedId(), yourVehicle, -1)
SetVehicleHasBeenOwnedByPlayer(yourVehicle, true)
local id = NetworkGetNetworkIdFromEntity(yourVehicle)
SetNetworkIdCanMigrate(id, true)
QBCore.Functions.Notify("Araç çıkarıldı.")
if durum == "cekilmis" then
TriggerServerEvent("tgiann-garaj:arac-cekilmistemi", cachedData["currentGarage"], vehicleProps["plate"], 0, AracCekilmis)
elseif durum == "cekilmis-bot" then
TriggerServerEvent("tgiann-garaj:arac-cekilmistemi", cachedData["currentGarage"], vehicleProps["plate"], 0, BotCekilmis)
elseif durum == "cekilmis-ucak" then
TriggerServerEvent("tgiann-garaj:arac-cekilmistemi", cachedData["currentGarage"], vehicleProps["plate"], 0, UcakCekilmis)
else
TriggerServerEvent("tgiann-garaj:arac-cekilmistemi", cachedData["currentGarage"], vehicleProps["plate"], 0)
end
TriggerEvent("x-hotwire:give-keys", yourVehicle)
CloseMenu()
while not GetIsVehicleEngineRunning(yourVehicle) do Citizen.Wait(100) end
Citizen.Wait(100)
if durum == "cekilmis" or durum == "cekilmis-bot" or durum == "cekilmis-ucak" or durum == "cekilmis-ucak" or durum == "bot" then
SetVehicleFuelLevel(yourVehicle, 25.0)
DecorSetFloat(yourVehicle, "_FUEL_LEVEL", 25.0)
repairCar(yourVehicle)
else
SetVehicleFuelLevel(yourVehicle, vehicleProps["fuelLevel"]+0.0)
DecorSetFloat(yourVehicle, "_FUEL_LEVEL", vehicleProps["fuelLevel"]+0.0)
end
end, {x=spawnpoint.x, y=spawnpoint.y, z=spawnpoint.z, h=spawnheading}, true) -- coords, isnetwork
else
QBCore.Functions.Notify("Aracın Bu Garajda Değil! Aracın Bulunduğu Garaj GPS'de İşaretlendi!", "error")
local coords = Config.Garages[tonumber(garajNoData)]["blip"]
SetNewWaypoint(coords.x, coords.y)
end
end
end