[HELP] about SetEntityNoCollisionEntity

hi

i want to disable collision for vehicle1 and vehicle2 to all vehicles in city but its only effecting vehicle2

my example code :



vehicle1 = CreateVehicle(GetHashKey('neon'), spawncoords, heading, true, false)
vehicle2 = CreateVehicle(GetHashKey('neon'), spawncoords, heading, true, false)

while true do
    Wait(0)
    vehs = GetGamePool('CVehicle')
	for _, veh in ipairs(vehs) do
		SetEntityNoCollisionEntity(veh, vehicle1, true)
        SetEntityNoCollisionEntity(veh, vehicle2, true)
	end
end


i tested many times, its only effecting vehicle2 unless i remove the SetEntityNoCollisionEntity for vehicle2 but i want to do it for both

any suggestion ?

1 Like

Hey,

You mispelled vehicle1 in SetEntityNoCollisionEntity

You’ve set SetEntityNoCollisionEntity(veh, vehicle, true)
Instead of SetEntityNoCollisionEntity(veh, vehicle1, true)

hey
I wrote it here wrong but on my server the coding is right and not working on both vehicles

but I found another method :

NetworkFadeOutEntity
NetworkFadeInEntity

the different is this method is better with better resmon (using it with a loop)
the only thing that was gone was visibility of the entity but since i could not fix SetEntityNoCollisionEntity i guess its the only choice here