esx:spawnVehicle using Player Heading (#486)

* esx:spawnVehicle using Player Heading

Updated esx:spawnVehicle to use the players heading as opposed to the default 90.0 degree angle

* Update main.lua
This commit is contained in:
Jay
2020-02-11 19:45:48 +01:00
committed by GitHub
parent 0bd4267715
commit 8e13cf6613
+4 -3
View File
@@ -243,10 +243,11 @@ AddEventHandler('esx:spawnVehicle', function(vehicle)
local model = (type(vehicle) == 'number' and vehicle or GetHashKey(vehicle))
if IsModelInCdimage(model) then
local playerPed = PlayerPedId()
local coords = GetEntityCoords(playerPed)
local playerPed = PlayerPedId()
local coords = GetEntityCoords(playerPed)
local playerHeading = GetEntityHeading(playerPed)
ESX.Game.SpawnVehicle(model, coords, 90.0, function(vehicle)
ESX.Game.SpawnVehicle(model, coords, playerHeading, function(vehicle)
TaskWarpPedIntoVehicle(playerPed, vehicle, -1)
end)
else