So I need some help here I have been messing around with this for a while, basically I have a vehicle and a ped that get get created on a client and I need them to not migrate when other players are close to those entities while the creator is far away. I need that vehicle to continue to stay in the creators scope until it gets deleted by them. I just cant get it to work and need some help. PLEASE lmao
this is what i have so far
RegisterNetEvent("smth:smth")
AddEventHandler("smth:smth", function()
DeleteEntity(driver1)
DeleteEntity(limo1)
print()
local vhash = GetHashKey('stretch')
RequestModel(vhash)
while not HasModelLoaded(vhash) do
Citizen.Wait(1)
end
random = math.random(#Config.LimoSpawnCoords)
limo1 = CreateVehicle(vhash, Config.LimoSpawnCoords[random], true, false)
while not DoesEntityExist(limo1) do
Wait(1)
end
l1net = NetworkGetNetworkIdFromEntity(limo1)
SetEntityAsMissionEntity(limo1, true, true)
--DEBUG
local limoblip = AddBlipForEntity(limo1)
SetBlipSprite(limoblip, 198)
SetBlipFlashes(limoblip, true)
SetBlipFlashTimer(limoblip, 5000)
--END OF DEBUG
SetModelAsNoLongerNeeded(vhash)
print("Limo Spawned")
local dhash = GetHashKey('g_m_m_casrn_01')
RequestModel(dhash)
while not HasModelLoaded(dhash) do
Citizen.Wait(1)
end
driver1 = CreatePedInsideVehicle(limo1, 4, dhash, -1, true, false)
while not DoesEntityExist(driver1) do
Wait(1)
end
d1net = NetworkGetNetworkIdFromEntity(driver1)
SetBlockingOfNonTemporaryEvents(driver1, true)
SetEntityAsMissionEntity(driver1, true, true)
SetModelAsNoLongerNeeded(dhash)
print("Driver Spawned")
TaskVehicleDriveToCoordLongrange(driver1, limo1, Config.LimoDestination, 26.0, 447, 0)
SetPedKeepTask(driver1, true)
end)