This commit is contained in:
Nordi98 2025-06-12 22:09:59 +02:00
parent bd65997839
commit f9b8f9ccad
3 changed files with 283 additions and 294 deletions

View file

@ -16,7 +16,7 @@ RegisterNUICallback('searchCar', function(data, cb)
TriggerEvent("roadphone:sendNotification", {
apptitle = 'APP_VALET_NAME',
title = 'APP_VALET_TITLE_WAYPOINT',
img = "/public/img/Apps/light_mode/valet.webp"
img = "/public/img/Apps/valet.jpg"
})
end
@ -38,7 +38,7 @@ RegisterNUICallback('searchCar', function(data, cb)
TriggerEvent("roadphone:sendNotification", {
apptitle = "APP_VALET_NAME",
title = "APP_VALET_TITLE_WAYPOINT",
img = "/public/img/Apps/light_mode/valet.webp"
img = "/public/img/Apps/valet.jpg"
})
cb('ok')
return
@ -49,70 +49,65 @@ RegisterNUICallback('searchCar', function(data, cb)
TriggerEvent("roadphone:sendNotification", {
apptitle = "APP_VALET_NAME",
title = "APP_VALET_TITLE_CARNOTOUT",
img = "/public/img/Apps/light_mode/valet.webp"
img = "/public/img/Apps/valet.jpg"
})
end, data.plate)
cb('ok')
end)
RegisterNUICallback("deliverormarkcar", function(data, cb)
QBCore.Functions.TriggerCallback("roadphone:valet:loadVehicle", function(vehicle, coords)
-- RegisterNUICallback("deliverormarkcar", function(data, cb)
-- QBCore.Functions.TriggerCallback("roadphone:valet:loadVehicle", function(vehicle, coords)
-- if not vehicle and not coords then
-- return
-- end
-- if vehicle == false then
-- if coords then
-- SetNewWaypoint(coords.x, coords.y)
-- TriggerEvent("roadphone:sendNotification", {
-- apptitle = 'APP_VALET_NAME',
-- title = 'APP_VALET_TITLE_WAYPOINT',
-- img = "/public/img/Apps/valet.jpg"
-- })
-- end
-- return;
-- end
if not vehicle and not coords then
return
end
-- local plate = vehicle[1].plate
if vehicle == false then
if coords then
SetNewWaypoint(coords.x, coords.y)
TriggerEvent("roadphone:sendNotification", {
apptitle = 'APP_VALET_NAME',
title = 'APP_VALET_TITLE_WAYPOINT',
img = "/public/img/Apps/light_mode/valet.webp"
})
-- local gameVehicles = GetGamePool('CVehicle')
-- for i = 1, #gameVehicles do
-- local vehicle = gameVehicles[i]
-- if DoesEntityExist(vehicle) then
-- if GetVehicleNumberPlateText(vehicle) == plate then
-- local vehicleCoords = GetEntityCoords(vehicle)
-- SetNewWaypoint(vehicleCoords.x, vehicleCoords.y)
-- TriggerEvent("roadphone:sendNotification", {
-- apptitle = 'APP_VALET_NAME',
-- title = 'APP_VALET_TITLE_WAYPOINT',
-- img = "/public/img/Apps/valet.jpg"
-- })
-- cb('ok')
-- return
-- end
-- end
-- end
end
return;
end
-- QBCore.Functions.TriggerCallback("roadphone:valet:checkMoney", function(cb)
-- if cb then
-- SpawnVehicle(vehicle[1].vehicle, plate, json.decode(vehicle[1].mods))
-- end
-- end)
local plate = vehicle[1].plate
-- end, data.plate)
local gameVehicles = GetGamePool('CVehicle')
-- cb('ok')
-- end)
for i = 1, #gameVehicles do
local vehicle = gameVehicles[i]
if DoesEntityExist(vehicle) then
if GetVehicleNumberPlateText(vehicle) == plate then
local vehicleCoords = GetEntityCoords(vehicle)
SetNewWaypoint(vehicleCoords.x, vehicleCoords.y)
TriggerEvent("roadphone:sendNotification", {
apptitle = 'APP_VALET_NAME',
title = 'APP_VALET_TITLE_WAYPOINT',
img = "/public/img/Apps/light_mode/valet.webp"
})
cb('ok')
return
end
end
end
QBCore.Functions.TriggerCallback("roadphone:valet:checkMoney", function(cb)
if cb then
SpawnVehicle(vehicle[1].vehicle, plate, json.decode(vehicle[1].mods))
end
end)
end, data.plate)
cb('ok')
end)
function SpawnVehicle(vehicle, plate, mods)
print("RoadPhone Valet: "..plate)
local player = PlayerPedId()
local playerPos = GetEntityCoords(player)
local found, spawnPos, spawnHeading = GetClosestVehicleNodeWithHeading(playerPos.x + math.random(-100, 100),
@ -201,15 +196,6 @@ RegisterNUICallback("getCars", function(data, cb)
for i = 1, #data do
if(data[i]) then
local vehiclename = data[i].vehicle
local vehiclemodelnames = getVehicleNames()
for k, v in pairs(vehiclemodelnames) do
if v[1] == model then
vehiclename = v[2]
end
end
data[i].vehicle = {}
data[i].vehicle.model = vehiclename
end