The scripts works, but i am unable to take spawned vehicles that the car dealer sells and so on.
So im wondering is there a way to disable people from breaking the car glass to steal a car and disable people from pulling people out of cars.
The scripts works, but i am unable to take spawned vehicles that the car dealer sells and so on.
So im wondering is there a way to disable people from breaking the car glass to steal a car and disable people from pulling people out of cars.
I’m having the same problem, seems to be fixable by calling this event in es_extended/functions.lua!spawncar
I’ll try this once i’m home
Try this in your functions.lua
inside es_extended/client
ESX.Game.SpawnVehicle = function(modelName, coords, heading, cb)
local model = (type(modelName) == 'number' and modelName or GetHashKey(modelName))
Citizen.CreateThread(function()
RequestModel(model)
while not HasModelLoaded(model) do
Citizen.Wait(0)
end
local vehicle = CreateVehicle(model, coords.x, coords.y, coords.z, heading, true, false)
local id = NetworkGetNetworkIdFromEntity(vehicle)
SetNetworkIdCanMigrate(id, true)
SetEntityAsMissionEntity(vehicle, true, true)
SetVehicleHasBeenOwnedByPlayer(vehicle, true)
SetModelAsNoLongerNeeded(model)
TriggerClientEvent('nocarjack:addOwnedVehicle', playerId, id) --Send the networkID to the player
---
ESX.Game.SpawnLocalVehicle = function(modelName, coords, heading, cb)
local model = (type(modelName) == 'number' and modelName or GetHashKey(modelName))
Citizen.CreateThread(function()
RequestModel(model)
while not HasModelLoaded(model) do
Citizen.Wait(0)
end
local vehicle = CreateVehicle(model, coords.x, coords.y, coords.z, heading, false, false)
local id = NetworkGetNetworkIdFromEntity(vehicle)
SetEntityAsMissionEntity(vehicle, true, true)
SetVehicleHasBeenOwnedByPlayer(vehicle, true)
SetModelAsNoLongerNeeded(model)
TriggerClientEvent('nocarjack:addOwnedVehicle', playerId, id)
dont work
not very useful code