Skip to content

Commit

Permalink
Valet featurea added.
Browse files Browse the repository at this point in the history
  • Loading branch information
ulasdemirci0 committed Jan 24, 2024
1 parent 0497d35 commit f8e370d
Show file tree
Hide file tree
Showing 9 changed files with 3,508 additions and 130 deletions.
Binary file added output/npwd_qb_garage-vallet.zip
Binary file not shown.
29 changes: 28 additions & 1 deletion client/client.lua → output/npwd_qb_garage/client/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,31 @@ RegisterNUICallback("npwd:qb-garage:requestWaypoint", function(data, cb)
QBCore.Functions.Notify("This vehicle cannot be located", "error")
end
cb({})
end)
end)

RegisterNuiCallback("npwd:qb-garage:valetVehicle", function(data, cb)
local coords = QBCore.Functions.GetCoords(PlayerPedId())
local ret, coordsTemp, heading = GetClosestVehicleNodeWithHeading(coords.x, coords.y, coords.z, 1, 3.0, 0)
local retval, coordsSide = GetPointOnRoadSide(coordsTemp.x, coordsTemp.y, coordsTemp.z)
-- coordsSide vector3 location / heading float
print(data.vehicle.model .. 'spawned')
print(data.vehicle.state)
if data.vehicle.state == 'garaged' then
QBCore.Functions.SpawnVehicle(data.vehicle.model, function(veh)
QBCore.Functions.TriggerCallback('qb-garage:server:GetVehicleProperties', function(properties)
QBCore.Functions.SetVehicleProperties(veh, properties)
SetVehicleNumberPlateText(veh, data.vehicle.plate)
exports['ed-fuel']:SetFuel(veh, data.vehicle.fuel)
SetEntityAsMissionEntity(veh, true, true)
SetEntityHeading(veh, heading)
TriggerServerEvent('qb-garage:server:updateVehicleState', 0, data.vehicle.plate, "Out")
TriggerServerEvent('vehiclekeys:server:SetVehicleOwner', data.vehicle.plate)
SetVehicleEngineOn(veh, true, true, false)
end, data.vehicle.plate)
end, coordsSide, true)
else
QBCore.Functions.Notify("Arac zaten disarida!", "error")
end

cb({})
end)
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit f8e370d

Please sign in to comment.