ESX.Game.GetVehicleInDirection, no more car spawn with radio

This commit is contained in:
ElPumpo
2018-05-05 23:56:12 +02:00
parent 8c129873f0
commit 987a40bf0d
+14 -2
View File
@@ -390,7 +390,6 @@ ESX.Game.SpawnVehicle = function(modelName, coords, heading, cb)
local id = NetworkGetNetworkIdFromEntity(vehicle)
SetNetworkIdCanMigrate(id, true)
--SetEntityAsMissionEntity(vehicle, true, false)
SetVehicleHasBeenOwnedByPlayer(vehicle, true)
SetModelAsNoLongerNeeded(model)
@@ -401,6 +400,8 @@ ESX.Game.SpawnVehicle = function(modelName, coords, heading, cb)
Citizen.Wait(0)
end
SetVehRadioStation(vehicle, 'OFF')
if cb ~= nil then
cb(vehicle)
end
@@ -423,7 +424,6 @@ ESX.Game.SpawnLocalVehicle = function(modelName, coords, heading, cb)
local vehicle = CreateVehicle(model, coords.x, coords.y, coords.z, heading, false, false)
--SetEntityAsMissionEntity(vehicle, true, false)
SetVehicleHasBeenOwnedByPlayer(vehicle, true)
SetModelAsNoLongerNeeded(model)
@@ -434,6 +434,8 @@ ESX.Game.SpawnLocalVehicle = function(modelName, coords, heading, cb)
Citizen.Wait(0)
end
SetVehRadioStation(vehicle, 'OFF')
if cb ~= nil then
cb(vehicle)
end
@@ -642,6 +644,16 @@ ESX.Game.GetVehiclesInArea = function(coords, area)
return vehiclesInArea
end
ESX.Game.GetVehicleInDirection = function()
local playerPed = GetPlayerPed(-1)
local playerCoords = GetEntityCoords(playerPed, 1)
local inDirection = GetOffsetFromEntityInWorldCoords(playerPed, 0.0, 5.0, 0.0)
local rayHandle = CastRayPointToPoint(playerCoords.x, playerCoords.y, playerCoords.z, inDirection.x, inDirection.y, inDirection.z, 10, playerPed, 0)
local a, b, c, d, vehicle = GetRaycastResult(rayHandle)
return vehicle
end
ESX.Game.GetPeds = function(ignoreList)
local ignoreList = ignoreList or {}